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

undefined method `*' for nil:NilClass

For general discussion related FlowStone

undefined method `*' for nil:NilClass

Postby tor » Tue Jan 22, 2013 3:15 am

So what am I doin wrong here?
Code: Select all
rectbounds3=[@width*0.5-@ledw*0.5,@hight*0.5-@ledh*0.5,@ledw,@ledh]
fade3=LinearGradientBrush.new rectbounds3,@c3,@c4,45,true
v.drawRoundRect fade3,rectbounds3,@round

NoMethodError: undefined method `*' for nil:NilClass
tor
 
Posts: 114
Joined: Fri Sep 24, 2010 5:54 pm

Re: undefined method `*' for nil:NilClass

Postby tor » Tue Jan 22, 2013 5:02 am

I found if I move the mulitpliers in front of the @ floats like this: 0.5*@hight-0.5*@ledh
I get this error instead: TypeError: (in method 'draw'): nil cant be coerced into Float
Button.fsm
(1.75 KiB) Downloaded 956 times

And after some googling I learned that in this case it is most likely that @ledh and @ledw is nil. Question is why?
When I edit the values in the green floats outside the code that feed theese two values the error disappears while i write a new value. But the moment i press enter to set the value, the error is back.
tor
 
Posts: 114
Joined: Fri Sep 24, 2010 5:54 pm

Re: undefined method `*' for nil:NilClass

Postby trogluddite » Tue Jan 22, 2013 10:02 am

tor wrote:@hight

should be
Code: Select all
@height

I do this 50 times a day! If you don't spell a variable right, it counts as undeclared and returns 'nil'.
All schematics/modules I post are free for all to use - but a credit is always polite!
Don't stagnate, mutate to create!
User avatar
trogluddite
 
Posts: 1730
Joined: Fri Oct 22, 2010 12:46 am
Location: Yorkshire, UK

Re: undefined method `*' for nil:NilClass

Postby tor » Tue Jan 22, 2013 7:06 pm

dang... I just could not see it. Checked it over and over and over :?

THANK YOU TROG :)

This is probably going to be one of my biggest challenges with a language like Ruby, getting the spelling right.
tor
 
Posts: 114
Joined: Fri Sep 24, 2010 5:54 pm


Return to General

Who is online

Users browsing this forum: No registered users and 67 guests