Lua: How to get the draft id of the Ground?

Plug-in related stuff can be discussed here.

Moderator: Plugin Moderators

User avatar
Wekabu city
Inhabitant of a Conurbation
Reactions:
Posts: 497
Joined: Tue Aug 29, 2017 21:07
Location: Overseas Communal Bunker
Plugins: Show
Version: Beta
Phone model: Wiko Sunset 2

Platform

Plugin Creator

Lua: How to get the draft id of the Ground?

#1

Post by Wekabu city » Tue Jan 29, 2019 14:34

So I want to check the Ground Draft Id of x,y , but somehow it will always Not enter my if-clause (or iff how the documentation spells that) even though it is true (Well i think)

If (Tile.getGroundDraft(x,y).getId() == "$ground00") then
(Code)

So yeah, how to use it then? The Doc should be more clear
Member of the Theotown community for over 3 years!
==================================
I'm no longer checking what is going on, please PM me if you need anything from me. thanks <3
(Maybe I'll come back)

User avatar
Lobby
Developer
Reactions:
Posts: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Lua: How to get the draft id of the Ground?

#2

Post by Lobby » Wed Feb 06, 2019 14:11

Please provide your full code to exclude other issues.

From what I can see you have to use : instead of . in front of getId() since it's a method that will be called on an object. That might look strange but this is how Lua works :lua:

Code: Select all

if (Tile.getGroundDraft(x,y):getId() == "$ground00") then
...Have a nice stay

User avatar
Wekabu city
Inhabitant of a Conurbation
Reactions:
Posts: 497
Joined: Tue Aug 29, 2017 21:07
Location: Overseas Communal Bunker
Plugins: Show
Version: Beta
Phone model: Wiko Sunset 2

Platform

Plugin Creator

Re: Lua: How to get the draft id of the Ground?

#3

Post by Wekabu city » Wed May 01, 2019 14:27

Ended up that I used the wrong charset/encoding
Member of the Theotown community for over 3 years!
==================================
I'm no longer checking what is going on, please PM me if you need anything from me. thanks <3
(Maybe I'll come back)

User avatar
Lobby
Developer
Reactions:
Posts: 3373
Joined: Sun Oct 26, 2008 12:34
Plugins: Show
Version: Beta
Phone model: S7 edge

Platform

Re: Lua: How to get the draft id of the Ground?

#4

Post by Lobby » Wed May 01, 2019 16:20

:bc
Always use UTF8 if possible.
...Have a nice stay

Post Reply Previous topicNext topic

Return to “Plug-In Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests