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!!!!
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.
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 !!
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
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, :)
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)
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 , :)
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|")
-- 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.
If i change the script as Dessamator instructed. All users get all commands. What's wrong?
Thanks //StarChild
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)
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
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
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
yap i understood it, and ive fixed it, just have to fix a memory related bug, and ill post it
-- 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"
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
Nice job Dessamator! Works perfect now.
Thanks
/Star
ur welcome start
and plop, still im working on it, ( trying )