Asked — Edited
Resolved Resolved by DJ Sures!

Calling A Script From Another Script And Return To The Next Line

Hey eveyone. I have been off working on my summer projects, but been watching the form. So the winter is coming and its time to move back into the lab to play with my robots. I have to knock the rust off the little I know and reread everyone's notes.;)

I have build a little rover bot to run around and chase the cats. I am mostly using it for learning scripting.

My question is I would like to have one "script" is the main script and then all the other movements in sub scripts. I would like to nest a couple of scripts. I have looked at the "controlcommand" and what I can figure is that it will call the next script but how do I return from the script "controlcommand" called to the next line after the "controlcommand" line.

Thank you to everyone for the help.


ARC Pro

Upgrade to ARC Pro

Subscribe to ARC Pro, and your robot will become a canvas for your imagination, limited only by your creativity.

#1  

you could make the subscripts change variables that the main script can read so the when the subscript is done the main script knows to continue.

#2  

If it is in one script it won't continue with another will it?

United Kingdom
#4  

The script which calls the ControlCommand wont stop or pause with the ControlCommand, it'll start the sub script and continue to it's next line.

If you want to pause it you can do the variable method, where the script set to run in the ControlCommand sets a flag which the main script waits for change on;


WaitForChange($x)

At the end of the sub scripts have $x change it's value


$x = $x+1

Or you could do it based on timing with a Sleep;


Sleep(2000)

Or you could pause the main script with a Pause after the ControlCommand for the sub script and resume it at the end of the sub script. Main Script


# Main script commands
ControlCommand( "Script Manager", ScriptStart, "SubScript" )
Pause()
# More code

SubScript


# Some script commands
ControlCommand( "Script Manager", Resume, "MainScript" )

#5  

That's the command I was trying to find! any which way mine could work right?

United Kingdom
#6  

I haven't looked, I'll take a look and let you know when I get chance.

PRO
Synthiam
#7  

What's wrong with scriptStartWait?

United Kingdom
#8  

I never knew that command existed... but yes, a much better option:)