Custum Menu, RoboCop 8a
 

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

Custum Menu, RoboCop 8a

Started by mandix, 02 June, 2004, 00:55:37

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mandix

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 = {
..."

Herodes

#1
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
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 ...

bastya_elvtars

And don't forget to post your script when finished. :P
Everything could have been anything else and it would have just as much meaning.

IsoD

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 !
You born and you die. YOU  decide what happens in between....

Catch me in action from Dannyluola -= [FIN]Empire Hubs =-

SMF spam blocked by CleanTalk