City.getView() With Elevated Terrain
Moderator: Plugin Moderators
- KINGTUT10101
- 1,000,000 inhabitants
- Reactions:
- Posts: 2123
- Joined: Thu Jul 07, 2016 22:50
- Location: 'Merica
- Plugins: Show
- Version: Beta
- Contact:
City.getView() With Elevated Terrain
I noticed that City.getView() does not account for tiles on elevated terrain. It will only see tiles on level zero. Is there any way around this limitation?
All of my plug-ins, maps and more:
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
-
- Inhabitant of a Megacity
- Reactions:
- Posts: 186
- Joined: Thu Jan 30, 2020 16:56
- Plugins: Show
Re: City.getView() With Elevated Terrain
Code: Select all Reset
function script:draw() local x, y = City.getView() if Tile.isValid(x, y) then x = x + Tile.getTerrainHeight (x, y) y = y - Tile.getTerrainHeight (x, y) end Drawing.setTile(x, y) Drawing.drawTileFrame(Icon.TOOLMARK + 16 + 1) end
Interactive Lua editor
Code: Select all Reset
function script:update() local x, y, scale = City.getView() if Tile.isValid(x, y) then x = x + Tile.getTerrainHeight (x, y) y = y - Tile.getTerrainHeight (x, y) end Drawing.drawText('X:'..x..',Y:'..y..',S:'..s) end
Interactive Lua editor
Last edited by Jeremiah Stephens on Mon Apr 05, 2021 9:54, edited 1 time in total.
Check out my TheoTown YouTube videos: https://www.youtube.com/playlist?list=P ... wCvFdgyiTk
http://discord.gg/hA5EVazhCC
Code: Select all
c = 0
if TheoTown.addUndoButton != None:
TheoTown.addUndoButton()
c += 1
else:
c -= 1
print(c)
- KINGTUT10101
- 1,000,000 inhabitants
- Reactions:
- Posts: 2123
- Joined: Thu Jul 07, 2016 22:50
- Location: 'Merica
- Plugins: Show
- Version: Beta
- Contact:
Re: City.getView() With Elevated Terrain
I'll try this out. Thank you for the help. I must not have seen that command when I searched through the Lua Docs a few months ago.
All of my plug-ins, maps and more:
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
- KINGTUT10101
- 1,000,000 inhabitants
- Reactions:
- Posts: 2123
- Joined: Thu Jul 07, 2016 22:50
- Location: 'Merica
- Plugins: Show
- Version: Beta
- Contact:
Re: City.getView() With Elevated Terrain
IS there a way to get this working with script:update?
All of my plug-ins, maps and more:
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
- KINGTUT10101
- 1,000,000 inhabitants
- Reactions:
- Posts: 2123
- Joined: Thu Jul 07, 2016 22:50
- Location: 'Merica
- Plugins: Show
- Version: Beta
- Contact:
Re: City.getView() With Elevated Terrain
Thank you for trying to help again. However, I'm not sure if this is the right approach. Stuff like this can happen:
Do you have any ideas for how we could overcome this issue?All of my plug-ins, maps and more:
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101
https://sites.google.com/view/retrocity ... authuser=0
YouTube channel:
https://youtube.com/c/kingtut-101