I'm hoping or someone knowledgeable can help me troubleshoot this script. It's written in EZ-Script and was functioning a few months ago the last time I tried it, or so I believe. LOL.
The script is titled "Say Any Number." Its purpose is to monitor a global variable named $numberin
, which is set by another script and represents a number. The script then identifies this number and plays a corresponding sound file via an ARC sound card labeled "Numbers."
The initial script that calls "Say Any Number" is a timer script. I instruct the robot with a command like, "Set a timer for 1 hour, 2 minutes, and 30 seconds" (or just for 1 hour, 2 minutes, or 30 seconds). This primary script works flawlessly, managing to start the timer, run it, and stop it while correctly triggering the appropriate sound files from different ARC Sound cards.
The timer correctly sets the variable $numberin
, which is visible in the Variable Watcher.
The issue arises when the "Say Any Number" script attempts to read that variable and trigger the proper sound file. Unfortunately, the sound file does not play, and I encounter the following error:
Error on line 421: ControlCommand Error for 'Numbers' sending '"Track_" + $level8'. 'ControlCommand' with parameter "Track_" + $level8, is not supported for this control (Numbers)
The problematic line that produces the error varies depending on the type of timer I set. The issue seems to be related to the way the EZ command is formatted, particularly in calling a sound file from an ARC Sound Card using a variable. An example of the erroneous EZ command is shown below:
ControlCommand("Numbers", "Track_" + $level8)
The if-statement containing this command looks like this:
if ($level8 > 0)
$level8=(abs(substring($numberin,0,1)))+18
ControlCommand("Numbers", "Track_" + $level8)
sleep(700)
endif
Does anyone have suggestions on what modifications are necessary for this EZ-Script to interpret the variable correctly and play the appropriate sound track?
I can provide the entire script if needed, although it's 456 lines long.
Additionally, I'd like to eventually rewrite this in JavaScript. I've already translated all my other scripts from EZ-Script to JavaScript, and this is one of the last ones I need to convert.
Thanks for any suggestions.
Below is one approach to fixing this issue:
Issue Recap
The error: ControlCommand Error for Numbers sending Track_ + $level8 is not supported for this control (Numbers) indicates that the Numbers soundboard isn’t receiving the proper concatenated command string. Instead of getting something like Track_28 the control is getting the literal text Track_ + $level8 (or an improperly formed string). This usually comes down to how EZScript is handling string concatenation.
The Fix
In EZScript you must build your command string explicitly. For example, instead of writing:
ControlCommand(Numbers,Track_ + $level8)
you should form the command string in a variable and call ControlCommand with quotes. For example:
if($level8 > 0) { $cmd = "Track_" + $level8 ControlCommand("Numbers", $cmd) sleep(700) } endif
Here’s what this does: It explicitly builds a string by concatenating "Track_" (in quotes so it’s a literal string) with the value of $level8. It then calls ControlCommand with the control Numbers (also in quotes) and the fully formed command string. This should send a command such as Track_28 to the soundboard-exactly as expected by that control.
A Few Things to Check
Verify that $level8 actually holds the expected numeric value. You can check this in the Variable Watcher.
Make sure the control name Numbers is spelled correctly and that the Numbers soundboard skill is set up to accept commands like Track_xxx.
JavaScript Version
When converting over to JavaScript in ARC, the equivalent might look like this:
This JavaScript code similarly builds the command string and calls ControlCommand with proper string literals.
Summary
By ensuring that the string is concatenated properly (building a variable such as $cmd = "Track_" + $level8) and by enclosing your control name and literal parts in quotes, the soundboard control should receive the correct command. This adjustment resolves the error and allows your sound track to play as expected.
If you have further questions or need additional assistance, please let me know!
I am a customer support GPT-powered AI and still learning. If you have doubts about my response, please use the support documentation to verify my answer.