Stormworks: Build and Rescue

Stormworks: Build and Rescue

CaptainRay Mar 26, 2020 @ 11:18pm
Attempt to call a NIL VALUE? (Field GetNumber)
So I have been trying to make a working map with a GPS Tracker for a BUOY I am making. I have added a GPS Sensor and already set up all the RADIO RX stuff. I have a seperate sort of station where the map will be displayed. Its a completely different vehicle. I set up the GPS Sensor map x & y coords to be converted to a composite value so I can feed it into a script. I went ahead and typed this code:

tsbWarning = input.getBool(1) windDirection = input.getNumber(1) windSpeed = input.getNumber(2) temp1 = input.getNumber(3) humidity1 = input.getNumber(4) rain1 = input.getNumber(5) altimeter1 = input.getNumber(6) mapX = input.getNumber(7) mapY = input.getNUmber(8)

and

w = screen.getWidth() -- Get the screen's width and height h = screen.getHeight() screen.drawMap(mapX, mapY, 8)

and yes all the functions are their as well.

But anyways when I go to test to see if the map displays properly it shows the "11: Attempt to call a Nil Value (Field GETNUMBER)" I have the Buoy spawned, I have the station spawned. The GPS Sensor has power and all outputs and inputs are connected. What am I doing wrong?
Originally posted by DaMarkiM:
well, most nil value problems end up being typos.

its hard to say without seeing your code, but have you tried printing the mapx/mapy on screen to check the data you are getting? if the correct gps data is read it should draw the map correctly on that spot.
also did you check the battery level on the buoy? you actually loose range as the battery looses charge
< >
Showing 1-3 of 3 comments
CaptainRay Mar 26, 2020 @ 11:37pm 
Well I figured out why it was saying nil value and I fixed the error, it was because of a typo.
But now the map is showing an area where the buoy isn't even at...
The author of this thread has indicated that this post answers the original topic.
DaMarkiM Mar 30, 2020 @ 9:24pm 
well, most nil value problems end up being typos.

its hard to say without seeing your code, but have you tried printing the mapx/mapy on screen to check the data you are getting? if the correct gps data is read it should draw the map correctly on that spot.
also did you check the battery level on the buoy? you actually loose range as the battery looses charge
CaptainRay Mar 31, 2020 @ 12:07pm 
The buoy is solar powered. But yes it turned out to be a typo with one of the variables. Thanks m8.
< >
Showing 1-3 of 3 comments
Per page: 1530 50

Date Posted: Mar 26, 2020 @ 11:18pm
Posts: 3