Category | Scripting |
Created | 13.12.2021 20:01 |
Antonis L (antonis78) | 13.12.2021 20:01 |
---|---|
Hello. Im trying to access fill level information of attached vehicles but i can figure out how to. In fs 19 i was using self:getFillLevelInformation. In fs22 is a little bit different. Can anyone help me with this? |
Bilbo Beutlin (BBeutlin) | 14.12.2021 00:14 |
---|---|
The function FillUnit:getFillLevelInformation() is still present. But certainly self:getFillLevelInformation() needs a valid fillUnit for 'self'. |
Antonis L (antonis78) | 14.12.2021 00:37 |
---|---|
Thank you Bilbo for the responce. i have a part of the code below. function screenFunctions:balerLoadBar() self:getFillLevelInformation() local fillLevelInformations = {} local fillRatio = 0.0 local specLoadLevel = 0 for _,fillLevelInformation in pairs(fillLevelInformations) do local fillRatio = fillLevelInformation.fillLevel / fillLevelInformation.capacity if self.previousFillRatio == 0.0 then self.previousFillRatio = fillRatio end local currentLoadLevel = math.min((fillRatio - self.previousFillRatio) * 450) self.loadLevel = self.loadLevel + (currentLoadLevel - self.loadLevel) / 40 end if balerLoadBar ~= nil then specLoadLevel = self.loadLevel end return specLoadLevel end; the error i have is dataS/scripts/vehicles/specializations/FillUnit.lua(2233) : attempt to index local 'display' (a nil value) |
Bilbo Beutlin (BBeutlin) | 14.12.2021 01:05 |
---|---|
Rookie, uh? *g* no offense meant - everybody has done his first steps. The function getFillLevelInformation() returns a table (pointer). So you need at least a declaration alike ----- local fillLevelInfo = {} fillLevelInfo = thisFillUnit:getFillLevelInformation() ----- Then you can examine the table. |
Antonis L (antonis78) | 14.12.2021 01:19 |
---|---|
Yea! Rookie!! But with lot of ideas! LOL By thisFillUnit: you mean the name of the function ? |
Bilbo Beutlin (BBeutlin) | 14.12.2021 01:46 |
---|---|
No. The example 'thisFillUnit' is meant: you must specify a dedicated fillUnit. Browse a little in the GDN Documentation LUADOC/script/specializations/FillUnit to see how it works. Most things are still valid in FS22. |
Antonis L (antonis78) | 14.12.2021 02:00 |
---|---|
Thank you very much. I got an idea.I will try it to make it work. Best regards |
LOWEL97 | 03.07.2022 11:36 |
---|---|
Hi Antonis! Can you share the solution of your problem? |
LOWEL97 | 03.07.2022 12:07 |
---|---|
Hi Antonis! Can you share the solution of your problem? |
Note: Log in to post. Create a new account here.