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 Counter

For general discussion related FlowStone

Ruby Counter

Postby JB_AU » Thu Jun 12, 2014 6:23 am

Is there some definitive book on Ruby that works wholly with Flowstone?

Code: Select all
def event i,v
   if !defined? @count
      @count = 127
   end
   if @in0 == True
   @count = @count + 1
   end
   if @in1 == True
   @count = @count - 1
   end   
   output @count
end


Where am i going wrong?
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Ruby Counter

Postby Nubeat7 » Thu Jun 12, 2014 8:03 am

Code: Select all
def event i,v
   if @count == nil
      @count = 127
   end
   if i==@in0
   @count = @count + 1
   end
   if i==@in1
   @count = @count - 1
   end   
   output @count
end

this should work.. you can use triggers for @in0 and @in1

btw after its nothing to do with dsp it should be posted in the general section..
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna

Re: Ruby Counter

Postby billv » Fri Jun 13, 2014 6:48 am

billv
 
Posts: 1157
Joined: Tue Aug 31, 2010 3:34 pm
Location: Australia

Re: Ruby Counter

Postby JB_AU » Fri Jun 13, 2014 10:12 am

Didn't find a Ruby section, this seemed a logical spot, will do.

Billv, thanks mate! That's infattically & exactly what i wanted to do, cheers mate.
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm


Return to General

Who is online

Users browsing this forum: No registered users and 76 guests