Page 1 of 1

Need help with CubeScript

PostPosted: 23 Dec 2012, 10:24
by lamefun
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?

Re: Need help with CubeScript

PostPosted: 25 Dec 2012, 05:46
by S.E.S
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.

Re: Need help with CubeScript

PostPosted: 31 Dec 2012, 06:41
by srbs
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"
    ]
]