Need help with CubeScript

Need help with CubeScript

Postby lamefun » 23 Dec 2012, 10:24

I want to make a (off, on, unknown)-state checkbox. The normal checkbox is 3-state (off, on1, on2) one, even if I do this:

{l Code}: {l Select All Code}
guicheckbox showradar 1 0 [ ... ]


My code:

{l Code}: {l Select All Code}
// name variable on off action
guicheckbox2 = [
    if (|| (= $$arg2 $arg3) (= $$arg2 $arg4))
        [guicheckbox "egg" @arg2 @arg3 @arg4 []]
        [guibutton "egg" [] "question"]
]


Usage:

{l Code}: {l Select All Code}
guicheckbox2 showradar 1 0


The problem is, when I try it on real menu, it says: "Unknown command [guicheckbox "egg" showradar 1 0 []". This command is perfectly valid and works when I paste it directly in the menu. What's wrong with my code?
Worship JavaScript!
Inconvenient truth is always a hate magnet.
User avatar
lamefun
 
Posts: 17
Joined: 27 Sep 2012, 20:00

Re: Need help with CubeScript

Postby S.E.S » 25 Dec 2012, 05:46

The working version:

{l Code}: {l Select All Code}
guicheckbox2 = [
    if (|| (= $$arg1 $arg2) (= $$arg1 $arg2)) [ guicheckbox "egg" $arg1 $arg2 $arg3 [] ] [ guibutton "egg" [] "question" ]
]


Errors:

Parameter "arg1" - an absence in code.

Incorrect assignment alternatives condition (if
{l Code}: {l Select All Code}
[ guibutton "egg" [] "question" ]
it is.
User avatar
S.E.S
 
Posts: 82
Joined: 08 Apr 2012, 11:43

Re: Need help with CubeScript

Postby srbs » 31 Dec 2012, 06:41

lamefun {l Wrote}:
{l Code}: {l Select All Code}
// name variable on off action
guicheckbox2 = [
    if (|| (= $$arg2 $arg3) (= $$arg2 $arg4))
        [guicheckbox "egg" @arg2 @arg3 @arg4 []]
        [guibutton "egg" [] "question"]
]


The problem is, when I try it on real menu, it says: "Unknown command [guicheckbox "egg" showradar 1 0 []". This command is perfectly valid and works when I paste it directly in the menu. What's wrong with my code?


The formatting on your code is off. Here is what it needs to be:
{l Code}: {l Select All Code}
// name variable on off action
guicheckbox2 = [
    if (|| (= $$arg2 $arg3) (= $$arg2 $arg4)) [
        guicheckbox "egg" @arg2 @arg3 @arg4 []
    ] [
        guibutton "egg" [] "question"
    ]
]
srbs
 
Posts: 94
Joined: 17 Mar 2011, 07:00

Who is online

Users browsing this forum: No registered users and 0 guests

cron