Stormworks: Build and Rescue

Stormworks: Build and Rescue

yungmono Jul 16, 2019 @ 1:16am
Lua map to screen help
I am currently building a microcontroller that is use as a minimap for my ship i want to enter a real world coordinate and the coordinate will projected on the screen. I go to 'Help' and found this:
pixelX, pixelY = map.mapToScreen(mapX, mapY, zoom, screenW, screenH, worldX, worldY)
Howver i don't know what to enter with the variable mapX, mapY and worldX, worldY.I don't know what is the difference between the word 'map' 'world' in lua means, if you know please tell me.
< >
Showing 1-7 of 7 comments
nOverxD Jul 16, 2019 @ 4:37am 
Search for MrNJersey on YouTube, a lot of detailed tuto ! It helped me a lot to get the logic on lua Stormworks.

There is a specific tuto for your map to screen.
Wynexdra © Jul 25, 2019 @ 2:45pm 
2
20 mins ago I had the same issue but no one had a specific solution. I just tinkered around for about 30 mins and figured out how it works.

When using "worldX, worldY = map.screenToMap" or "pixelX, pixelY = map.mapToScreen" you're effectively drawing a map that you can't see.

-'mapX' & 'mapY' are the coordinates that this invisible map is centred on; the same as the "screen.drawMap" function but 'x' & 'y' are now 'mapX & 'mapY'

-'zoom' is the zoom of the invisible map

-'screenW' & 'screenH' are the width and height of your screen

-'worldX' & 'worldY' are the in-game world coordinates that you want to convert into the pixel
locations 'pixelX' & 'pixelY'

-'pixelX & 'pixelY' are the pixel locations you want to turn into world coordinates (remember pixel
locations go from top left to bottom right)

Hope this helps, sorry if I went into too much detail, this is my first steam discussion comment. Remember you still need to use the "screen.drawMap" to see a map; the "map.screenToMap" and "mapToScreen" functions are just used to convert between world coords and pixel locations so you can do things such as tracking your GPS with a red dot while moving the map independently.


Last edited by Wynexdra ©; Jul 25, 2019 @ 3:44pm
TKTom Jul 25, 2019 @ 3:23pm 
Yeah, the above post describes the parameters accurately.

Essentially, what that command is doing is converting world co-ordinates into screen (in game monitor) co-ordinates. In order for it to be able to do this, you need to give it the parameters of the "map image" displayed on the screen, which is what those first 5 parameters are about.

As above, the "map image" itself needs to be created with another command.
Last edited by TKTom; Jul 25, 2019 @ 3:23pm
Wynexdra © Jul 25, 2019 @ 3:43pm 
That was so much more concise
Last edited by Wynexdra ©; Jul 25, 2019 @ 4:07pm
TKTom Jul 26, 2019 @ 2:54pm 
Originally posted by Wynexdra:
That was so much more concise

You gave all the useful information, I just added a bit of context. :)

BlockyBlockling Jan 24, 2021 @ 2:28am 
Originally posted by Wynexdra ©:
20 mins ago I had the same issue but no one had a specific solution. I just tinkered around for about 30 mins and figured out how it works.

When using "worldX, worldY = map.screenToMap" or "pixelX, pixelY = map.mapToScreen" you're effectively drawing a map that you can't see.

-'mapX' & 'mapY' are the coordinates that this invisible map is centred on; the same as the "screen.drawMap" function but 'x' & 'y' are now 'mapX & 'mapY'

-'zoom' is the zoom of the invisible map

-'screenW' & 'screenH' are the width and height of your screen

-'worldX' & 'worldY' are the in-game world coordinates that you want to convert into the pixel
locations 'pixelX' & 'pixelY'

-'pixelX & 'pixelY' are the pixel locations you want to turn into world coordinates (remember pixel
locations go from top left to bottom right)

Hope this helps, sorry if I went into too much detail, this is my first steam discussion comment. Remember you still need to use the "screen.drawMap" to see a map; the "map.screenToMap" and "mapToScreen" functions are just used to convert between world coords and pixel locations so you can do things such as tracking your GPS with a red dot while moving the map independently.

How to make an red dot while moving independently?
Can you say me if I need screenToMap for mapToScreen?
and which x or y I need in screen.drawCircleF
BlockyBlockling Feb 11, 2021 @ 3:05am 
I solved the Problem
< >
Showing 1-7 of 7 comments
Per page: 1530 50

Date Posted: Jul 16, 2019 @ 1:16am
Posts: 7