Support

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?

For general discussion related FlowStone

Ruby - How can I flush variables when FL start?

Postby Nowhk » Fri Oct 31, 2014 2:46 pm

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!
Nowhk
 
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Ruby - How can I flush variables when FL start?

Postby tulamide » Fri Oct 31, 2014 3:23 pm

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?

Postby Nowhk » Fri Oct 31, 2014 3:27 pm

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). :oops:
Nowhk
 
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm

Re: Ruby - How can I flush variables when FL start?

Postby tulamide » Fri Oct 31, 2014 3:46 pm

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). :oops:

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?

Postby Nowhk » Fri Oct 31, 2014 4:12 pm

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). :oops:

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?

Postby tulamide » Fri Oct 31, 2014 11:19 pm

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?

Postby Perfect Human Interface » Sat Nov 01, 2014 3:48 pm

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?

Postby Nowhk » Mon Nov 03, 2014 9:24 am

Wee Perfect Human, you are also here :) How are you?
Thanks for the precisation, makes things pretty clear! 8-)
Nowhk
 
Posts: 275
Joined: Mon Oct 27, 2014 6:45 pm


Return to General

Who is online

Users browsing this forum: No registered users and 58 guests