English Tiles value by mouse

5 replies
Goto Page
To the start Previous 1 Next To the start
17.06.18 06:01:59 am
Up
minos
User
Offline Off
Hello guys, is there anyway to know the tile id only by pointing the mouse on the tile and write !tile then it appears a message will says the tile id is 8 for example.
l
17.06.18 06:12:05 am
Up
Cure Pikachu
User
Offline Off
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("say","_say")
function _say(id,txt)
     if txt == "!tile" then
          -- Think this only works when you are alive
          if player(id,"health") > 0 then
               reqcld(id,2)
          end
          return 1
     end
end

addhook("clientdata","_c")
function _c(id,mode,d1,d2)
     if mode == 2 then
          local x, y = math.floor(d1/32), math.floor(d2/32)
          msg2(id,"tile id of position "..x.."|"..y.." is "..tile(x,y,"frame"))
     end
end

Something like this, am not expecting this to work.
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
17.06.18 06:50:19 am
Up
Rainoth
Moderator
Offline Off
Code:
1
2
3
4
5
6
7
addhook("say","_say")
function _say(id,txt)
     if txt == "!tile" then
          msg2(id,"tile id of position "..player(id,"mousemapx")/32 .."|"..player(id,"mousemapy")/32 .." is "..tile(player(id,"mousemapx")/32,player(id,"mousemapy")/32,"frame"))
          return 1
     end
end

@user Cure Pikachu: The future is now, old man
17.06.18 06:57:05 am
Up
minos
User
Offline Off
thank you guys it works
l
17.06.18 08:42:22 am
Up
Cure Pikachu
User
Offline Off
@user Rainoth: Yeah that will actually work a lot better
(Does it auto-cast float numbers if it does happen?)
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
17.06.18 09:16:32 am
Up
Rainoth
Moderator
Offline Off
@user Cure Pikachu: Wouldn't make sense for it to do it by itself and I didn't floor them in the code since I was pretty much copy-pasting your code. With that said, I don't think it matters any in this case since the user "typecasts" it to integers in his brain
To the start Previous 1 Next To the start