Asked — Edited

Help With Combining Scripts

Hello all, I've just put together a script which makes makes my robot do a little panic dance when I say "danger" (thanks Hazbot for the sample - I used it for some inspiration) If you have a look at the video below he moves his arms, turns his head and does a little jiggle.
The problem is I had to open 3 script windows and add each movement into each one to make it work. What I want to be able to do is stick all of the script into one window.
When I tried this the movements didn't happen altogether but separatly.

In the first script window I put the following:

ControlCommand("danger", ScriptStart) ControlCommand("danger2", ScriptStart) ControlCommand("danger3", ScriptStart)

Say("tomy danger")

This made all of the "danger" scripts activate together.

Now I'm a total novice at doing all of this and I'm really just bumbling my way through at the moment so any help (or samples) would be appreciated.

Also, all the commands in the script are just repeated over and over to get the movement, is there any way that you can repeat an action say 4 times, so you don't have these humongously long scripts?

Thanks all.


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

Australia
#1  

Not sure on how to fix that..I'm a novice too. Love your Danger routine...I always enjoyed the Robot in "Lost in Space" T.V show of the 60's especially when he went into DANGER mode very similar to the way your Tomy does it..Great stuff;; Check out EZ-Cloud for examples that you can pick at and experiment with,, excellent video....Cheers

Hazbot

PRO
Synthiam
#2  

For script examples use the file->examples in ARC

As for what you're trying to do.... Require either a delay, or chain scripts together. The command is "scriptStart" that you are sending. That means "start script":) so once the script is started, it keeps executing. :)

#3  

DJ - Would it be possible to add parameters to the ControlCommand - ScriptStart to wait for the script to end. Something like : ControlCommand( "Blink", ScriptStart, wait, # secs) where wait could be 0 = no-wait or 1 = wait and # secs the number of seconds to wait for script to end ?

Belgium
#4  

Cool man ! Funny too ! Good work, show us more asap. I'm curious.

Greetz,

PhG

Canada
#5  

Can you post your scripts?

You should be able to put all the commands into one script and tweak with "Sleep" commands for delays.

It would be vary basic like this:

Voice Command: "Tomy Danger"

Executes Script: "DangerDance"

DangerDance Script

Dance Script (Repeats 4 Times)

Stops Random Script and/or any other scripts not required

ControlCommand("TomyRandom", ScriptStop)

Dance Sequence - 1

ServoRandom (D14,40,70) Sleep(500) Release(D14) Sleep(500)

Call Blink script

ControlCommand("Tomy-Blink", ScriptStart) Sleep(500)

Dance Sequence - 2

ServoRandom (D14,40,70) Sleep(500) Release(D14) Sleep(500)

Call Blink script

ControlCommand("Tomy-Blink", ScriptStart) Sleep(500)

Dance Sequence - 3

ServoRandom (D14,40,70) Sleep(500) Release(D14) Sleep(500)

Call Blink script

ControlCommand("Tomy-Blink", ScriptStart)

Dance Sequence - 4

ServoRandom (D14,40,70) Sleep(500) Release(D14) Sleep(500)

Call Blink script

ControlCommand("Tomy-Blink", ScriptStart)

Script finished. Reset head/arms/eyes/audio back to neutral

ControlCommand("TomyInit", ScriptStart)
Sleep(500)

Restart random script

ControlCommand("TomyRandom", ScriptStart)

I use the ControlCommand ScriptStart and ScriptStop quite a bit for various functions. Typically If I'm starting a special voice command, I will stop all random scripts, random audio, stop all movement, then execute the special script I want. Once the script is complete I reinitialize and return head/arms/eyes back to a neutral position and re-start my random script.

If I do call another script from within a script it is normally setup to just run once. I call it again if required. Using sleep and sleeprandom to mix things up.

Building upon this, if you use the wiggly arm movements for something else, I'd make it a seperate script. Call it the 4 times required for your dance routine. Nothing wrong with having multiple scripts.

Hope this helps. Linking scripts is easy and fun. I try to find the best way to minimize the amount of scripts required. Trying to teach myself C++/C# to go to the next level.

Any questions just ask.

Canada
#6  

You could also do this:

Voice Command: "Tomy Danger"

Executes Script: "DangerDanceRun"

DangerDanceRun Script

Runs DangerDance Script (Repeats 4 Times)

Stops Random Script and/or any other scripts not required

ControlCommand("TomyRandom", ScriptStop)

Dance Sequence - 1

ControlCommand("DangerDance", ScriptStart) Sleep(4000)

Dance Sequence - 2

ControlCommand("DangerDance", ScriptStart) Sleep(4000)

Dance Sequence - 3

ControlCommand("DangerDance", ScriptStart) Sleep(4000)

Dance Sequence - 4

ControlCommand("DangerDance", ScriptStart) Sleep(4000)

Script finished. Reset head/arms/eyes/audio back to neutral

ControlCommand("TomyInit", ScriptStart) Sleep(500)

Restart random script

ControlCommand("TomyRandom", ScriptStart)

Your DangerDance script would contain the dance routine.

DangerDance Script

Dance Sequence

ServoRandom (D14,40,70) Sleep(500) Release(D14) Sleep(500)

Call Blink script

ControlCommand("Tomy-Blink", ScriptStart) Sleep(500) ServoRandom (D13,40,70) Sleep(500) Release(D13) Sleep(500)

The secret is to tinker and play with the sleep command for timing.

#7  

Hi All, Thanks Lumpy for all of your suggestions. I have posted the script in the EZ cloud / Examples / Robot in Danger. I'm going to have a play later tonight and see where I can improve it. I especially like your idea of keeping them separate so you can use them in different routines - makes total sense.

cheers.

Australia
#8  

This is great stuff. Thanks for your effort lumpy and Lonesoulsurfer - I am in perfect agreement with you on keeping separate routines as Lumpy has done. If we can build up scripts in routine blocks and post them to the cloud we will have a powerful data base on things we can get our robots to do. We can also share how scripts are combined to achieve different outcomes.

Cheers

PRO
Synthiam
#9  

There is a new command that looks like this...


ControlCommand("ScriptWindows", ScriptStartWait)

This new ControlCommand() will wait until the specified script has completed before continueing. You can find examples of it being used in the File->Examples folder within ARC.