11 posts
Posted 04 January 2017 - 11:34 AM
hi guys need help with this code.
the program crashes by rentering the game at line 37
startup :37: attemp to index ? ( a nil value )
but after reboot the program works
http://pastebin.com/27v395ph
Edited on 04 January 2017 - 10:39 AM
7083 posts
Location
Tasmania (AU)
Posted 04 January 2017 - 12:29 PM
On line 37 you attempt to index into DTData, T0, and T0.Tanks. The first is a table for sure, so either T0 or T0.Tanks must be nil.
Perhaps you should print out what T is so you can see its value immediately before the error…?
11 posts
Posted 04 January 2017 - 12:50 PM
ty for reply and
Can it be that with the singleplayer the computer continues where he has stopped? because he doesnt restart by entering the game
if im starting the program then,
local T0 = sensor.getTargetDetails(T) T0= data… T = 2,-2,-4
DTData["T"] = T0.Tanks[1]
local D0 = sensor.getTargetDetails(D) D0= data… D= 2,-2,2
DTData["D"] = D0.Tanks[1]
after logout and joining the game T0 = nil cause T= nil D0 same but on line 75 ive the function for T and D
Edited on 04 January 2017 - 12:46 PM
7083 posts
Location
Tasmania (AU)
Posted 05 January 2017 - 12:18 AM
On line 27 you set T to k, but only if a certain pair of conditions are being met. Presumably they aren't.
11 posts
Posted 05 January 2017 - 08:57 AM
arg ty so much… after entering the game the ccsensor recievs the first data after 1-2secs so i need a delay by starting the program ty^^