Community Forum

Get current grain level

Forum Overview >> Farming Simulator 2009

CategoryFarming Simulator 2009
Created11.09.2010 15:17


Anton Fredriksson (Unknown) 11.09.2010 15:19
i want to get the the fillLevel of the treasher so i can print it out



hope you understand what i mean

please help me :)

Tobias F (JD6930) 12.09.2010 18:43
self.fillLevel

Greetz

Anton Fredriksson (Unknown) 13.09.2010 19:35
thanks going to try i it now

Anton Fredriksson (Unknown) 13.09.2010 19:56
cant make it work

when i add this line of code to the threaser

renderText(0,0.65,0.05,self.fillLevel);


it render a big D instead of the fillLevel

Tobias F (JD6930) 14.09.2010 16:40
oh sorry, self.grainTankFillLevel is the correct variable ;)

Anton Fredriksson (Unknown) 14.09.2010 17:38
i dont get it to work. i dont know what im doing wrong

i put this line in the update(dt) function

renderText(0,0.65,0.05,self.fillLevel);

but when im going to buy the threaser i get this error

"unexpected system exception occured"

Stefan Geiger - GIANTS Software 15.09.2010 13:53
As Tobias mentioned, the variable is called grainTankFillLevel and not fillLevel.

So you should use:
renderText(0,0.65,0.05,self.grainTankFillLevel);

Anton Fredriksson (Unknown) 15.09.2010 17:44
i tryed that but still getting "unexpected system exception occured"



Stefan Geiger - GIANTS Software 20.09.2010 09:27
Ups, there is another error ;)

You can only render strings with renderText, but self.grainTankFillLevel is a number. Thus you first need to convert that to a string.
You can use this code:
renderText(0,0.65,0.05, tostring(self.grainTankFillLevel));


Or you can use string.format to do some more advanced converting. For example limiting the number of decimal places.


Note: Log in to post. Create a new account here.