can't set parameter from script...

i hope this is just a syntax question. :slight_smile:

i need to set a Joystick chop’s source parameter from a script.

if i explicitly type the parameter string in quotes, the opparm works perfectly:

opparm $joyNodeName/Joystick source “2 - Controller (MadCatz GamePad)”

however, if i try to set the source using a variable, it doesn’t recognize the string in quotes,
giving errors for each part of the string:
Warning: Skipping unrecognized parameter “-”
Skipping unrecognized parameter “Controller”
Skipping unrecognized parameter “(MadCatz”
Skipping unrecognized parameter “GamePad)”"

below is what i’ve tried, (but always get the above errors):

set joyIn = tab("CurrentJoystickInputs",$i,0)

this pulls sequentially from the infoDat connected to a Joystick to determine what is currently plugged in

echo $joyIn : 2 - Controller (MadCatz GamePad)
echo "$joyIn" : “2 - Controller (MadCatz GamePad)”

set joyInQuotes = "$joyIn"

this adds quotes to the table entry, hoping it will be recognized as a string

echo $joyInQuotes : “2 - Controller (MadCatz GamePad)”

neither of the below opparms will work, even though the echos show the variable is being enclosed in string-defining quotes:
opparm $joyNodeName/Joystick source "$joyIn"
opparm $joyNodeName/Joystick source $joyInQuotes

is there a special way to set a string parameter?

thanks in advance for any help…
–kate

the problem in this case is that the spaces are parsed and touch thinks you are trying to fit multiple entries into 1 parameter.
its a slightly annoying problem since sometimes you want a string to be parsed as multiple arguments and other times you don’t. in these cases you don’t, so try

  opparm $joyNodeName/Joystick source (  `"'"+tab("CurrentJoystickInputs",0,0)+"'"` )

or
opparm $joyNodeName/Joystick source ( noevals(tab("CurrentJoystickInputs",0,0)) )

they both cause the evaluating quotes to return 1 argument.

Selina

Thanks Selena!

That worked.
–kate