please comment if you know

BUTTONX=1 --write in the button's X position in tiles
BUTTONY=1 --write in the button's Y position in tiles
COST=1000 --write in the amount of money to open the door
DOORNAME="door1" --write in the entity's name IN QUOTES (" - quote)
addhook("use","buydoor")
function buydoor(id)
if (player(id,"tilex")==BUTTONX and player(id,"tiley")==BUTTONY and player(id,"money")>=COST) then
parse("trigger "..DOORNAME)
parse("setmoney "..id.." "..(player(id,"money")-COST))
else
msg2(id,"You don't have enough money!")
end
end