PtokaX forum

PtokaX => Support => Topic started by: mandix on 02 June, 2004, 00:55:37

Title: Custum Menu, RoboCop 8a
Post by: mandix on 02 June, 2004, 00:55:37
i am makeing a custom right click menu
but i got a error that i cant solve, can u help me ?!?

ANYONE, ?? plz ??

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

sMenu = "RC"

assert(dofile("tbl/checklevel.tbl"),"tbl/checklevel.tbl not found")

function OpConnected(user)
if (SendTo[user.iProfile]==1) then
GetRightClickComs(user)
customCMDs(user)
user:SendData("Enhanced Right Click Support is available!")
end
end

function NewUserConnected(user)
if (SendTo[user.iProfile]==1) then
GetRightClickComs(user)
customCMDs(user)
user:SendData("Enhanced Right Click Support is available!")
end
end

function GetRightClickComs(user)
TCopy={}
for cmd,_ in LevelCheck do
if LevelCheck[cmd][user.iProfile] == 1 then
for value,command in RightClick do
if cmd == value then
tinsert(TCopy,{value,command})
end end end end

sort(TCopy,function(a,b) return (a[1] < b[1]) end)
for t = 1, getn(TCopy) do
if TCopy[t] then user:SendData(TCopy[t][2])
end end TCopy={} collectgarbage() flush()
end

function customCMDs(user)

user:SendData("$UserCommand 1 3 User Commands\\FaQ$<%[mynick]> !faq||",
user:SendData("$UserCommand 1 3 User Commands\\Rules$<%[mynick]> !rules||",
user:SendData("$UserCommand 1 3 User Commands\\Network$<%[mynick]> !network||",
user:SendData("$UserCommand 1 3 User Commands\\Bandit\\Off$<%[mynick]> b.stop||",
user:SendData("$UserCommand 1 3 User Commands\\Bandit\\On$<%[mynick]> b.start||",
user:SendData("$UserCommand 1 3 User Commands\\My Info\\My IP$<%[mynick]> !myip||",
user:SendData("$UserCommand 1 3 User Commands\\My Info\\My Info$<%[mynick]> !myinfo||",
end      -- line 55

RightClick = { -- op commands here }



error :

Syntax error: expected;
  last token read: `end' at line 55 in string "SendTo = {
..."
Title:
Post by: Herodes on 02 June, 2004, 01:53:35
in fact you shhould have closed the pairs "the paretnheseis" this is what u need ...
From this :user:SendData("$UserCommand 1 3 User Commands\\FaQ$<%[mynick]> !faq||",
To this :user:SendData("$UserCommand 1 3 User Commands\\FaQ$<%[mynick]> !faq||")
notice the sneaky ")" missing ? :D, Also you need to delete the commas at the end of ur string there as you can see ..


Also don't forget to visit this (http://dcplusplus.sourceforge.net/wiki/index.php/UserCommand%20command)
expirement what small changes to the string like ex:

1 1 for HubName Tab only or
1 2 for Userlist rightclick ...

instead of 1 3 (that is for both)  that there is at u code there ..

[*edit*]Maybe u'll find this example handy also ...

user:SendData("$UserCommand 1 2 The Register\\New Reg$<%[mynick]> !reg %[nick] %[line:password?] reg||")
Lets take this .... the first part I explained ... ( 1 1 (hubnam tag, 1 2, userlist nick,  1 3 userlist+ hubtag name ... n' so on..)

As you can see the the next part  says what u wanna "say" really...

$<%[mynick]> !reg %[nick] %[line:password?] reg

!reg is expected from us so this cmd works ...

 is  %[nick] -- the selected user nick ...(who ever is behind the cursor on right click)
Whenever u need a riclicker cmd to act on a user in the list ,it is better to be introduced with a 1 2  (type and context numbers)

Then we move on to %[line:password] this one is nice....
I simply asks for a Line to put in there ... like " Nice Weather, but I'd rather lua a lil..."

Then you encounter ' reg ' along the line ...
that is of course the last component in the syntax of the command so we end it with the   ||   part...

Don't forget to close the " " 's and the ( )'s  that have been opened ...

Just this to make a few general thinks clear ...
I hope I helped ...
Title:
Post by: bastya_elvtars on 02 June, 2004, 02:07:02
And don't forget to post your script when finished. :P
Title:
Post by: IsoD on 05 June, 2004, 22:35:49
So where do I define thet who can see that command ? ex. that only masters cuold see REG commands and so on.... just downloaded this.....

Very thankful of your help !