ALPHABETICAL ORDER IN RIGHT CLICK COMMAND
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

ALPHABETICAL ORDER IN RIGHT CLICK COMMAND

Started by -Slash-, 22 May, 2005, 15:13:50

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

-Slash-

how to arrange alphabetically the rc commands?
i give them an order in the script but the commands don't appear tidy in the hub...i want to arrange them alphabetically!!!!

Tw?sT?d-d?v

QuoteOriginally posted by -Slash-
how to arrange alphabetically the rc commands?
i give them an order in the script but the commands don't appear tidy in the hub...i want to arrange them alphabetically!!!!

Post here what you have already tried.

Dessamator

QuoteOriginally posted by -Slash-
how to arrange alphabetically the rc commands?
i give them an order in the script but the commands don't appear tidy in the hub...i want to arrange them alphabetically!!!!

Cant be done, with zrightclicker because its stored in tables and the table sort command isnt stable, and it sorts by size , maybe changing the script, then u can sort it ,manually !!
Ignorance is Bliss.

plop

QuoteOriginally posted by Dessamator
QuoteOriginally posted by -Slash-
how to arrange alphabetically the rc commands?
i give them an order in the script but the commands don't appear tidy in the hub...i want to arrange them alphabetically!!!!

Cant be done, with zrightclicker because its stored in tables and the table sort command isnt stable, and it sorts by size , maybe changing the script, then u can sort it ,manually !!
it can actualy be done, but it isn't a really nice way.
you would need a table and an array.
the table holds the user commands indexed by the command.
and the array only the commands.
now you can sort the array and loop that, using that 2 call the commands from the table.
all this should be done on function Main() 2 reduce the load.
this can also be done if you make your own sort function 2 sort the table (even more complex).

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Dessamator

hmmm indeed, ur right but as i said it cant be done with the current zrightlicker, u have to change its layout and functions, to accomodate it, :)
Ignorance is Bliss.

bastya_elvtars

#5
QuoteOriginally posted by Dessamator
hmmm indeed, ur right but as i said it cant be done with the current zrightlicker, u have to change its layout and functions, to accomodate it, :)

Loop through command table, insert the ready-to-send commands into an array, withoput $UC and context.  Do a table.sort and send the sorted array's elements to the connecting user. Wohoo! :P

(Easier way: submenus. :P)
Everything could have been anything else and it would have just as much meaning.

Dessamator

QuoteOriginally posted by bastya_elvtars
QuoteOriginally posted by Dessamator
hmmm indeed, ur right but as i said it cant be done with the current zrightlicker, u have to change its layout and functions, to accomodate it, :)

Loop through command table, insert the ready-to-send commands into an array, withoput $UC and context.  Do a table.sort and send the sorted array's elements to the connecting user. Wohoo! :P

(Easier way: submenus. :P)
RC, already has submenus, and furthermore, what u just said is theory, show us the practical use of it, with a simple example,
mr
QuoteEmperor bastya_elvtars
,
because i too have my theories about it, hehe, havent used them either , :)
Ignorance is Bliss.

Tw?sT?d-d?v

#7
so would something like this work bastya_elvtars ..

aMenu = "RULES"
bMenu = "HELP"

function NewUserConnected(curUser)
	if curUser.bUserCommand then
		curUser:SendData("$UserCommand 1 3 "..aMenu.."\\Rules$<%[mynick]> !rules|")
		curUser:SendData("$UserCommand 1 3 "..bMenu.."\\Help$<%[mynick]> !help|")

Dessamator

#8
-- RightClicker for RoboCopv10.01d
-- Added  ALPHABETICAL ORDER by Dessamator (request/idea by (uk)jay) --hints by plop and or bastya
-- Some small fixes by jiten
-- Made by Optimus & TiMeTrAVelleR
-- Optimized and fixed some stuff
-- Best is not to use it for normal users takes to much bandwidth

sMenu = "RC"

SendTo = { --> 1=on/0=off
[0] = 1,   -- Masters
[1] = 1,   -- Operators
[2] = 1,   -- Vips
[3] = 0,   -- Regs
[4] = 1,   -- Moderator
[5] = 1,   -- NetFounder
[-1] = 0,  -- Users
}

dofile("tbl/scriptlevel.tbl")
dofile("tbl/inbuildlevel.tbl")

-- End Editable Settings --

[COLOR=red]
-- Sorting the table in function main, hint idea by plop
function Main()
a = {}
	for n,z in InbuildCmds do table.insert(a, z) end
	for n,z in ScriptCmds do table.insert(a, z) end
table.sort(a)

end


GetRightClick = function(user)
	for cmd,level in InbuildLevel do
		for cmd1,level1 in ScriptLevel do
			if InbuildLevel[cmd][user.iProfile] == 1 or ScriptLevel[cmd1][user.iProfile] == 1 then 
				if InbuildCmds[cmd] or ScriptCmds[cmd1] then
					HasRightClick = true
				end
			end
		end
	end
	if HasRightClick then
		for i=1,table.getn(a) do user:SendData(a[i]")	end
		--user:SendData(table2[cmd]")
		HasRightClick = false
	end
end

NewUserConnected = function(user)
	if SendTo[user.iProfile] == 1 then
		if user.bUserCommand then
			user:SendData("$UserCommand 0 3 |")
			GetRightClick(user, ScriptLevel, ScriptCmds)  customCMDs(user)  --GetRightClick(user, InbuildLevel, InbuildCmds)
			user:SendData(" Enhanced Right Click Support for [RoboCop] is available!")
		end
	end
end
[/COLOR] 

OpConnected=NewUserConnected

ScriptCmds = {
["kick"]="$UserCommand 1 3 "..sMenu.."\\KICK/BAN\\Kick user$<%[mynick]> !kick %[nick] %[line:Reason]",
["ban"]="$UserCommand 1 3 "..sMenu.."\\KICK/BAN\\Ban user$<%[mynick]> !ban %[nick] %[line:Reason]",
}
InbuildCmds = {
["banip"]="$UserCommand 1 3 "..sMenu.."\\INBUILD\\Banip user$<%[mynick]> !banip %[line:Ipnumber]",
["unban"]="$UserCommand 1 3 "..sMenu.."\\INBUILD\\Unban user$<%[mynick]> !unban %[nick] %[line:nick/ip]",
}
customCMDs = function(user) --// You can put your custome commands here
	--user:SendData("$UserCommand 1 3 zCUSTOM\\Test$<%[mynick]> !test||")	-- Example line
end

Done !
btw, this is just an example the only thing i changed was the function in red.
Ignorance is Bliss.

Star

If i change the script as Dessamator instructed. All users get all commands. What's wrong?

Thanks //StarChild

Dessamator

all users ????, only if u defined it in this table :
SendTo = { --> 1=on/0=off
[0] = 1,   -- Masters
[1] = 1,   -- Operators
[2] = 1,   -- Vips
[3] = 0,   -- Regs
[4] = 1,   -- Moderator
[5] = 1,   -- NetFounder
[-1] = 0,  -- Users
}


but ill check the code and debug it (if it needs debugging)
Ignorance is Bliss.

plop

#11
QuoteOriginally posted by Star
If i change the script as Dessamator instructed. All users get all commands. What's wrong?
he forgot 2 check the userlevels for the command before sending them.

beside that there is a nasty bug in this script.
using 2 end pipes can trigger bcdc based clients 2 start a kind of flood.
it keeps sending 1 of the user commands over and over.
unlike the old ptokax, ppk changed SendData so it adds the end pipe itself.
sending 2 from the script means that ptokax adds 1 more which make 3.

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Dessamator

QuoteOriginally posted by plop
QuoteOriginally posted by Star
If i change the script as Dessamator instructed. All users get all commands. What's wrong?
he forgot 2 check the userlevels for the command before sending them.

beside that there is a nasty bug in this script.
using 2 end pipes can trigger bcdc based clients 2 start a kind of flood.
it keeps sending 1 of the user commands over and over.
unlike the old ptokax, ppk changed SendData so it adds the end pipe itself.
sending 2 from the script means that ptokax adds 1 more which make 3.

plop
indeed, ur right (once again) second error corrected, first error, hmm still have to think about it
Ignorance is Bliss.

Star

Hi Dessamator,
Well. If I say it like this then. If I login as reg in my hub, I get all robos commands in the rightclick. Even them i don't have access to. Du u understand what I mean now?

Thanks //StarChild

Dessamator

yap i understood it, and ive fixed it, just have to fix a memory related bug, and ill post it
Ignorance is Bliss.

Dessamator

#15
-- RightClicker for RoboCopv10.01d
-- Added  ALPHABETICAL ORDER by Dessamator (request/idea by (uk)jay) --hints by plop and or bastya
-- Some small fixes by jiten
-- Made by Optimus & TiMeTrAVelleR
-- Optimized and fixed some stuff
-- Best is not to use it for normal users takes to much bandwidth

sMenu = "RC"

SendTo = { --> 1=on/0=off
[0] = 1,   -- Masters
[1] = 1,   -- Operators
[2] = 1,   -- Vips
[3] = 0,   -- Regs
[4] = 1,   -- Moderator
[5] = 1,   -- NetFounder
[-1] = 0,  -- Users
}

dofile("tbl/scriptlevel.tbl")
dofile("tbl/inbuildlevel.tbl")

-- End Editable Settings --

[COLOR=red]
GetRightClick = function(user, table1, table2)

	for cmd,level in table1 do
		if table1[cmd][user.iProfile] == 1 then
			if table2[cmd] then
				table.insert(a,table2[cmd])
			end	
		end
	end
end

NewUserConnected = function(user)
	if SendTo[user.iProfile] == 1 then
		if user.bUserCommand then
			
			a={}
			user:SendData("$UserCommand 0 3 |")
			GetRightClick(user, ScriptLevel, ScriptCmds) GetRightClick(user, InbuildLevel, InbuildCmds) customCMDs(user)
			table.sort(a)	
			for i=1,table.getn(a) do user:SendData(a[i].."|")end
			user:SendData(" Enhanced Right Click Support for [RoboCop] is available!")
			a=nil
			collectgarbage();io.flush();
		end
	end
end
[/COLOR] 

OpConnected=NewUserConnected

ScriptCmds = {
["kick"]="$UserCommand 1 3 "..sMenu.."\\KICK/BAN\\Kick user$<%[mynick]> !kick %[nick] %[line:Reason]",
["ban"]="$UserCommand 1 3 "..sMenu.."\\KICK/BAN\\Ban user$<%[mynick]> !ban %[nick] %[line:Reason]",
}
InbuildCmds = {
["banip"]="$UserCommand 1 3 "..sMenu.."\\INBUILD\\Banip user$<%[mynick]> !banip %[line:Ipnumber]",
["unban"]="$UserCommand 1 3 "..sMenu.."\\INBUILD\\Unban user$<%[mynick]> !unban %[nick] %[line:nick/ip]",
}
customCMDs = function(user) --// You can put your custome commands here
	--user:SendData("$UserCommand 1 3 zCUSTOM\\Test$<%[mynick]> !test||")	-- Example line
end

Done !, P.S.: The Custom Cmds, arent in a table, if u add them they will appear "out of order"
Ignorance is Bliss.

plop

hint:
ScriptCmds = {
	["kick"] = {
		sCom = "$UserCommand 1 3 "..sMenu.."\\KICK/BAN\\Kick user$<%[mynick]> !kick %[nick] %[line:Reason]",
		tLevels = {
			[0]=1,
			[1]=1,
		}
	},
	["ban"] = {
	   sCom = "$UserCommand 1 3 "..sMenu.."\\KICK/BAN\\Ban user$<%[mynick]> !ban %[nick] %[line:Reason]",
	   tLevels = {
			[0]=1,
			[1]=1,
		}
	},
	---etc...
}

plop
http://www.plop.nl lua scripts/howto\'s.
http://www.thegoldenangel.net
http://www.vikingshub.com
http://www.lua.org

>>----> he who fights hatred with hatred, drives the spreading of hatred <----<<

Star

Nice job Dessamator! Works perfect now.

Thanks
/Star

Dessamator

ur welcome start

and plop, still im working on it, ( trying )
Ignorance is Bliss.

SMF spam blocked by CleanTalk