sperrgebiet/FS19_VehicleExplorer

'getIsControlled' (a nil value) (Version: 0.9.3.4)

Opened this issue · 4 comments

I have gotten this error again that I mention in issue #11 , this time with a couple more errors. Not sure what is causing it but getting it when trying to "tab" to next vehicle.

Copied below from issue #11 .....................
I lost the ability to "tab" through most vehicles and the vehicle sort list had gotten messed up, some of the tractors were missing from the list.
After quitting the game and reloading all was fine again.
I haven't been able to reproduce this error since so maybe not much importance.
Here's the error I was getting every time I'd try to "tab" to next vehicle.

2019-03-01 22:52 Error: Running LUA method 'update'.
2019-03-01 22:52 C:/Users/James/Documents/My Games/FarmingSimulator2019/mods/FS19_VehicleExplorer/VehicleSort.lua:1780: attempt to call method 'getIsControlled' (a nil value)

log.txt

Getting similar with below Error:
2019-03-09 22:11 Error: Running LUA method 'update'.' '2019-03-09 22:11 G:/Farming Simulator Instances/FS19 Instances/Fenton Forest/FS19_VehicleExplorer/VehicleSort.lua:1817: attempt to call method 'getIsControlled' (a nil value)

Followed by when you try to open the Vehicle list:
2019-03-09 22:12 Error: Running LUA method 'draw'.
2019-03-09 22:12 G:/Farming Simulator Instances/FS19 Instances/Fenton Forest/FS19_VehicleExplorer/VehicleSort.lua:1225: attempt to index a nil value

Error: Running LUA method 'update'.
2019-03-20 01:41 C:/Users/Frank/Documents/My Games/FarmingSimulator2019/mods/VehicleExplorer/VehicleSort.lua:1817: attempt to index a nil value
2019-03-20 01:41 Error: Running LUA method 'update'.
2019-03-20 01:41 C:/Users/Frank/Documents/My Games/FarmingSimulator2019/mods/VehicleExplorer/VehicleSort.lua:1817: attempt to index a nil value

Same here,
2019-03-24 20:04 C:/Users/GARY/Documents/My Games/FarmingSimulator2019/mods/FS19_VehicleExplorer/VehicleSort.lua:1817: attempt to call method 'getIsControlled' (a nil value)
2019-03-24 20:04 Error: Running LUA method 'update'.

Had been working fine until the new Giants update !

Issue persists in 9.3.6
...My Games/FarmingSimulator2019/mods/ZZZ_FS19_VehicleExplorer936/VehicleSort.lua:1818: attempt to call method 'getIsControlled' (a nil value)

As a workaround I have tested edit to VehicleSort.lua and after an hour of using mod appears to not encounter the issue.
change line 1818
while g_currentMission.vehicles[(VehicleSort.Sorted[nextId])]:getIsControlled() or VehicleSort:isParked(VehicleSort.Sorted[nextId]) do
to
while VehicleSort:isParked(VehicleSort.Sorted[nextId]) do

@sperrgebiet I'm not sure the purpose of checking getIsControlled at this point (I believe it's use may have changed in v1.3.0.1 too as they dropped it from documentation) so I did not want to merge a commit.