Bug found? How to fix it?

For general discussion related FlowStone
Post Reply
MarvinMeller
Posts: 3
Joined: Thu Nov 07, 2013 5:46 pm

Bug found? How to fix it?

Post by MarvinMeller »

I dont know why this happens all the time but when Im programming in FlowStone-Ruby it happens that I get this error:

NoMethodError: (in method 'event') undefined method '/' for nil:NilClass

And yes the var is a Number: lty = @ins[16] / 2 - Input 16 is a float. If I reconnect the ruby-comp and paste the EXACTLY same code I dont get the error again :?:


Hope my english is not too bad :P greetings, Marvin
Attachments
mains.fsm
Thats the File with the error
(2.55 KiB) Downloaded 875 times
User avatar
MyCo
Posts: 718
Joined: Tue Jul 13, 2010 12:33 pm
Location: Germany
Contact:

Re: Bug found? How to fix it?

Post by MyCo »

It happens probably because the array @ins is not fully initialized, when the event comes in.

BTW: you don't need all the "xyz = @ins[n]"... when your connectors are named, you can directly access them with their name, eg. @ltx, @lty, @rtx,... also you should think about the triggers that call the event procedure. Right now you execute all the code in event, when any of the input changes. Since you've got a high frequency trigger connected to this, you probably don't want this, and only execute that code, when the trigger comes in. So you can wrap everything in event like this:

Code: Select all

def event i,v,t
  if i == "trigger"
    ...
  end
end
MarvinMeller
Posts: 3
Joined: Thu Nov 07, 2013 5:46 pm

Re: Bug found? How to fix it?

Post by MarvinMeller »

Ok Ill change some things but I need all the stuff in the event... (XBox360 Controller).
But how can I initial @ins correctly?

PS: thanks for the fast answer but wasnt at home :P
Post Reply