If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
NEW REGISTRATIONS - please contact us if you wish to register on the forum
Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright
Ruby - How can I flush variables when FL start?
8 posts
• Page 1 of 1
Ruby - How can I flush variables when FL start?
I'm coding a Ruby script that store some variables (an Hash) during FL playing.
If I stop and restart FL, I see that those variables are not cleaned.
How can I clean variables/data ever time I start (or stop?) FL?
Thank you!
If I stop and restart FL, I see that those variables are not cleaned.
How can I clean variables/data ever time I start (or stop?) FL?
Thank you!
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: Ruby - How can I flush variables when FL start?
Use "Is Playing" prim to keep track of the host's state. Every time it stops, (re-)set your variables.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby - How can I flush variables when FL start?
tulamide wrote:Use "Is Playing" prim
Uhm, what's "Is Playing" prim? Global variable? I don't understand what you mean (sorry, I'm new in Flowstone).
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: Ruby - How can I flush variables when FL start?
Nowhk wrote:tulamide wrote:Use "Is Playing" prim
Uhm, what's "Is Playing" prim? Global variable? I don't understand what you mean (sorry, I'm new in Flowstone).
If new, you should definately spend some time reading the user guide, and always keep the reference at hand. A prim is a primitive, a functional object Flowstone offers. You will find it in your toolbox. The "Is Playing" prim tells you the current state of the host (playing/stopped). Output is a false or a Ruby value. Connect that with your Ruby editor (look at the user guide, section Ruby, about how to setup variables from inputs). It will trigger the event method each time the value changes. So put your comparing code into the event method.
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby - How can I flush variables when FL start?
tulamide wrote:Nowhk wrote:tulamide wrote:Use "Is Playing" prim
Uhm, what's "Is Playing" prim? Global variable? I don't understand what you mean (sorry, I'm new in Flowstone).
If new, you should definately spend some time reading the user guide, and always keep the reference at hand. A prim is a primitive, a functional object Flowstone offers. You will find it in your toolbox. The "Is Playing" prim tells you the current state of the host (playing/stopped). Output is a false or a Ruby value. Connect that with your Ruby editor (look at the user guide, section Ruby, about how to setup variables from inputs). It will trigger the event method each time the value changes. So put your comparing code into the event method.
Oh... didn't know that toolbox object were called "prim". I always called them "module"
Now I see what you mean. Linked to Ruby input, and managed events. Works like a charm!
Thank you!
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
Re: Ruby - How can I flush variables when FL start?
Well done! You're welcome
"There lies the dog buried" (German saying translated literally)
- tulamide
- Posts: 2714
- Joined: Sat Jun 21, 2014 2:48 pm
- Location: Germany
Re: Ruby - How can I flush variables when FL start?
Nowhk wrote:didn't know that toolbox object were called "prim". I always called them "module"
A "module" is a block that contains other elements, the things you can double-click on to go inside. "Primitives" you cannot go inside, because they're base-level components. Your toolbox will contain both modules and primitives.
- Perfect Human Interface
- Posts: 643
- Joined: Sun Mar 10, 2013 7:32 pm
Re: Ruby - How can I flush variables when FL start?
Wee Perfect Human, you are also here How are you?
Thanks for the precisation, makes things pretty clear!
Thanks for the precisation, makes things pretty clear!
- Nowhk
- Posts: 275
- Joined: Mon Oct 27, 2014 6:45 pm
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 71 guests