Forum

> > CS2D > Scripts > "Table" example
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch "Table" example

22 Antworten
Seite
Zum Anfang Vorherige 1 2 Nächste Zum Anfang

alt Re: "Table" example

EP
User Off Offline

Zitieren
Oh sorry @user EndDead: , I made a typo in a function name

1
2
3
4
5
6
7
8
9
10
11
12
EXAMPLE = {
     {43, 23, 24}, -- TileX, TileY, Item ID
     {13, 43, 45} -- TileX, TileY, Item ID
}
addhook("use","_use")
function _use(id,x,y)
     for k,v in pairs(EXAMPLE) do
          if x == v[1] and y == v[2] then
               parse("equip "..id.." "..v[3])
          end
     end
end

alt Re: "Table" example

EndDead
User Off Offline

Zitieren
@user EP: I already noticed the mistake and it still didnt work. (And gave you that console error wrongly [It was still true, cause of your typo] , i messed up when i re-wrote the script)
I guess the script gets the postion X and Y not the Tile X and Tile Y.
I'm fixing that with something like...
1
local x,y=player(id,"tilex"),player(id,"tiley")
Then im giving my results again.

Edit:
Finally, got it to work. Now goin to learn more things. Thanks all!

Final Example >


PS: again, I may not use this method in any script, just an example to learn new things.
2× editiert, zuletzt 28.12.12 20:19:49
Zum Anfang Vorherige 1 2 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht