Page 1 of 1

New User Menu scripting woes

Posted: 08 Nov 2016 20:35
by nbdy
Hello All,
I'm a new user and struggling with the Menu item. I have downloaded
and looked at quite a few projects searching for an example.
Have also read thru the pertinent parts of the manual.

My question is...

I have a simple menu with 2 items.
I want to send a different OSC command on selection of
each one of those 2 choices.

Thanks,
nbdy

Re: New User Menu scripting woes

Posted: 09 Nov 2016 01:26
by oldgearguy
you need to create a script that executes "on expression" selection.
selection is where the menu object stores your choice. 0 = first choice, 1 = second, etc.

so something like:

if (selection == 0) {
// do these things
} else if (selection == 1) {
// do these other things
}

Re: New User Menu scripting woes

Posted: 09 Nov 2016 17:46
by nbdy
Thanks oldgearguy

Re: New User Menu scripting woes

Posted: 09 Nov 2016 19:02
by nbdy
Thought I had this figured out but perhaps my syntax is incorrect.
The script is still all in red.

my script...
Execution: On Expression, selection

if (selection==0){
oscout (0,'/Server/showcontrol/fadein/')
} else if (selection == 1){
oscout (0,'/server/showcontrol/fadeout/')
}

What am I doing wrong?
Any help would be appreciated

nbdy

Re: New User Menu scripting woes

Posted: 09 Nov 2016 19:27
by Phil999
oscout needs three inputs, target, address, and args[]. You forgot the args[].

Re: New User Menu scripting woes

Posted: 09 Nov 2016 20:44
by nbdy
ya know Phill999 as I have been reading on the forums and the manual I have seen ARGS[]

what would my ARGS be in this case?

the OSC commands to make this work are as stated in the scout lines of my script.

in my project I have 2 separate CustomButtons that do what I am trying with the menu.
those buttons just send the osc commands

/Server/showcontrol/fadein/
/Server/showcontrol/fadeout/

I'm missing something here.

Thanks,
nbdy

Re: New User Menu scripting woes

Posted: 10 Nov 2016 11:43
by Phil999
I would try with values 0 and 1. That could work for a switch. But we cannot know, it depends on the receiving application.