Page 1 of 1
Ruby - How can I flush variables when FL start?
Posted: Fri Oct 31, 2014 2:46 pm
by Nowhk
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!
Re: Ruby - How can I flush variables when FL start?
Posted: Fri Oct 31, 2014 3:23 pm
by tulamide
Use "Is Playing" prim to keep track of the host's state. Every time it stops, (re-)set your variables.
Re: Ruby - How can I flush variables when FL start?
Posted: Fri Oct 31, 2014 3:27 pm
by Nowhk
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).

Re: Ruby - How can I flush variables when FL start?
Posted: Fri Oct 31, 2014 3:46 pm
by tulamide
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.
Re: Ruby - How can I flush variables when FL start?
Posted: Fri Oct 31, 2014 4:12 pm
by Nowhk
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!
Re: Ruby - How can I flush variables when FL start?
Posted: Fri Oct 31, 2014 11:19 pm
by tulamide
Well done! You're welcome

Re: Ruby - How can I flush variables when FL start?
Posted: Sat Nov 01, 2014 3:48 pm
by Perfect Human Interface
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.
Re: Ruby - How can I flush variables when FL start?
Posted: Mon Nov 03, 2014 9:24 am
by Nowhk
Wee Perfect Human, you are also here

How are you?
Thanks for the precisation, makes things pretty clear!
