OldBotBuilder
USA
Asked
— Edited
Resolved by JustinRatliff!
I am trying to write an Array of ControlCommand scripts but I get an error message when I Run it. What is the correct format for this kind of entry?
Thank you.
Hello @OldBotBuilder,
I believe the Array is looking for a $value to store, rather than a ControlCommand.
Are you looking to have a quick way to switch between ControlCommand() movements quickly?
Could you describe what your end goal is? Likely if we get an idea of what you'd like to achieve a few of us can offer a couple different scenarios on how to get there.
For the future, you may want to mark this kind of thread as "Needing Assistance" as you'll likely have many people offering scripting help due to the fact that they may get ez-credit for answering the question.
You can't assign a procedure to a variable. Variables can store data, not commands. A variable can store things like numbers or strings. Variables cannot store another command.
@Jeremie,
Yes, I want to switch between ControlCommand() movements quickly to give my 'Segway' robot random movements. I was going to select these movements with a 'GetRandom(Min,Max)' index into an array of movement commands.
My Custom Movement Panel has the normal 4 movements but I have added 4 more commands, 'spin left', 'spin right', 'backward left', and 'backward right'.
I did mark this thread as Needing Assistance.Why not use the 'GetRandom(Min,Max)' 0-6 then use IF/Then logic for the movement commands. IF GetRandom = 0 then forward.
@JustinRatliff,
I think you have the solution. I'll try it. Thanks
Interesting that this thread didn't have the red exclamation mark beside the title so I assumed it wasn't an "Assistance needed" thread, my apologies.
Nice going Jeremie, you broke the Internet!
j/k
P.S. BotBuilder, let me know if that works or if you need a better code example.
@JustinRatliff,
Worked exactly as I wanted. I should have looked for the obvious instead of the "elegant" solution.
Here is the script:
Thanks!
Just a though, you could also use the personality generator for this type of random action.
Just a thought.
The personality generator is still a mystery to me. Have you used it Luis? I guess I never think about it because I have not seen many examples of how to use it.