Hey there,,
I used the search function but didn't find anything useful about this,,
For example of what i want:
1
On use button x==1715 and y==369 then menu(id,"Buy,blah|1$")
Pretty simple but am still learning some new things in lua.
Sorry for wasting time and for anything done wrong,
Thanks in advance 1
2
3
4
5
6
7
addhook('usebutton', 'AA_usebutton')
function AA_usebutton(id, x, y)
	if x == tilex and y == tiley then
		menu(id, 'title, button1, button2, etc')
	end
end
@ Alistaire: why do you always use AA_ in the function, just saying nothing wrong with it.
1
2
3
4
5
6
addhook("usebutton","menuuse")
function menuuse(id,x,y)
	if x == tilex and y == tiley then
		menu(id,"Buy,blah|1$")
	end
end
Avo User Offline
Also possible with "use" hook.
EDIT: Jynxxx I wanted to ask the same. Avo has written
Also possible with "use" hook.
EDIT:
Jynxxx I wanted to ask the same.
If you use the 'use' hook it's possible that the button is disabled but you still open a menu which was never meant to open at that moment.
----
Jynxxx has written
@
Alistaire: why do you always use AA_ in the function, just saying nothing wrong with it.
1. In the console you know exactly which script uses which hook.
2. You call the function same as the hook so that you don't get things like a 'saycommands' function and an 'adminsay' function' where you have to find out if they use the same hook etc.
3. It stuck, just like the way I only use apastrophes in my scripts. There's not one quotation mark where I could've put an apastrophe in my current version of the Gore Extension (where every function and value has GE_ before it)
4. Functions and values will NEVER conflict with my other scripts if they don't have double hooks.
5. You can easily blend scripts together by replacing the AA_ and BB_ to whatever script you want, like CC_. GE_ = GoreExtension_, MM_ = MedievalMod, etc etc etc. thanks for the help, Gonna try later today or tommorw, its night and im going out, Thanks again for the help No problems Avo User Offline
@ Alistaire: I don't get it completely, but wow, nice idea somehow dosnt work? i tried:
1
2
3
4
5
6
7
addhook('usebutton', 'AA_usebutton')
function AA_usebutton(id, x, y)
if x == 1715 and y == 369 then
menu(id,"[my menu here]")
end
end
is there any wrong? >.>
I tried JeT's too,,
i also used the tile pos thingy,, Avo User Offline
Map with tile 1715... wow EndDead has written
somehow dosnt work? i tried:
1
2
3
4
5
6
7
addhook('usebutton', 'AA_usebutton')
function AA_usebutton(id, x, y)
if x == 1715 and y == 369 then
menu(id,"[my menu here]")
end
end
is there any wrong? >.>
I tried JeT's too,,
i also used the tile pos thingy,,
1715 is an x position. You need a tile position, just copy the position from the button entity. Avo User Offline
As Alistaire said, lighting system doesn't work on maps bigger than 100x100 tiles, from your script I see your map is... bigger. Admin/mod comment
What is this post about? Avo has written
As
Alistaire said, lighting system doesn't work on maps bigger than 100x100 tiles, from your script I see your map is... bigger.
What the actual fuck do you think this thread is about. Avo User Offline
Irony, nothing more. Alistaire you helped him, so there is no problem. EndDead has written
somehow dosnt work? i tried:
1
2
3
4
5
6
7
addhook('usebutton', 'AA_usebutton')
function AA_usebutton(id, x, y)
if x == 1715 and y == 369 then
menu(id,"[my menu here]")
end
end
is there any wrong? >.>
I tried JeT's too,,
i also used the tile pos thingy,,
Are you sure the positions are tile positions? Sometimes the usebutton hook breaks down for reasons unknown. If nothing works, try this:
1
2
3
4
5
6
7
addhook("use","usebuttonworkaround")
function usebuttonworkaround(id)
	local x,y=player(id,"tilex"),player(id,"tiley")
	if x==1715 and y==369 then
		menu(id,"Buy,blah|$1")
	end
end
Oh i founded whats my wrong, i went to the editor and higlighted the button and the pos was 51 11 (maybe) and i changed it, Now it works. Thanks for the help.
Close this thread if you want, its needless now.. i think