[SOLVED] Ruby component problem

For general discussion related FlowStone
Post Reply
Dave_Scream
Posts: 8
Joined: Mon Oct 07, 2013 6:49 pm

[SOLVED] Ruby component problem

Post by Dave_Scream »

Hello.
I have problem with a Ruby component.
My problem in 1 screenshot:
Image
and there is info from manual:
Image

so why error?


Also.

input compare with name not work.
Image
Image
"if (i=0)" - work,
"if (i=="freq")" not working.

this is a working code, because in FL Studio version it works good. But in standalone it throw errors. But I read manual for standalone version and it have section for clearEvents...

whole code

Code: Select all

#--------------------------------------------------------------
#--------------------------------------------------------------
def init
   @ntick = 0
   @counter = 0
   @main_freq = 0
   @ticking = false
   @min_delay = 0.2

   #input "state", true, time+1
end
#--------------------------------------------------------------
def freq_setup
   if @freq <= 0
      @main_freq = 0
   else
      _mfreq = @period.to_f / @freq.to_f
      if _mfreq < 0.1 then
         _mfreq = 0.1
      end
      @main_freq = _mfreq
   end
end
#--------------------------------------------------------------
def event i,v,t
   if (i=="freq" || i=="period" || i=="state")
      watch "f", "lol"
      clearEvents
      freq_setup()
      watch "mfreq", @main_freq
      if @state && @main_freq > 0
         @ticking = true
         input 100,nil,(t+@main_freq)
      else
         @ticking = false
      end
   end
   case i
   when 100 #main_timer
      if @state
         watch "main_timer", t
         input 100,nil,t+@main_freq
         
         rnd = @min_delay + rand((@main_freq.to_f-@min_delay)*100.0)/100.0
         watch "rnd", rnd
         input 101,nil,(t+rnd)
      else
         @ticking = false
      end
   when 101 #event
      output "out"
      
      output "led", true
      input 102,nil,t+0.1
      
      @counter = @counter + 1
      output "counter", @counter
   when 102 #led off
      output "led", false
   end
end
Last edited by Dave_Scream on Mon Oct 07, 2013 8:24 pm, edited 1 time in total.
Dave_Scream
Posts: 8
Joined: Mon Oct 07, 2013 6:49 pm

Re: Ruby component problem

Post by Dave_Scream »

Allright. FL Studio have version 3.0.2

My standalone version is 3.0.0


3.0.0 is not support clearEvents and connector labels.


version history for 3.0.2:
- New connector referencing in the Ruby component allows you to use an index or a label name to refer to a connector
- New clearEvents method that removes all pending events posted for the Ruby component from which it is called
User avatar
trogluddite
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: [SOLVED] Ruby component problem

Post by trogluddite »

Something we'll have to watch out for this - FL is one step behind, and the updates are much more often than they used to be.
Would be good if we try to remember to say "Built with version XXX", when posting schematic files.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
Post Reply