Forum

> > CS2D > Scripts > Menu and the escape key
Forums overviewCS2D overview Scripts overviewLog in to reply

English Menu and the escape key

8 replies
To the start Previous 1 Next To the start

old Menu and the escape key

Blighted Song
User Off Offline

Quote
Hi guys just a quick one this time,

with menus what is the listener for the escape key?

I cant find any docummentation on the matter. . .

old Re: Menu and the escape key

archmage
User Off Offline

Quote
I think if you use the menu hook it will set button to 0.
1
menu_hook(id, menu, button)

In the time you posted this and waited for an answer you could have tested it yourself.

old Re: Menu and the escape key

Blighted Song
User Off Offline

Quote
Perhaps, which is a bit annoying because I need a script to execute, regardless of the player choosing an option. It does the same thing no matter what they choose.

old Re: Menu and the escape key

archmage
User Off Offline

Quote
Then there is but one option. I do not think it is a good one though.

Edit:
nvm it won't work either.

Also why do you need a menu to do the same thing for each button pressed?

old Re: Menu and the escape key

Blighted Song
User Off Offline

Quote
Its more of a place holder, it sits on the left hand of the screen while I show stuff on the right, it only has one button to bring the player back to the main menu.

Problem is if the player doesnt press the button the stuff on the right won't go away, so I use the menu to determin when I should remove the images and text.

EDIT:

it does the same thing if you hit cancel or the exit button, but I need it to also do the script if you close the menu, that way every thing works.

Infact if the player doesnt do that script it screws everyone else's images aswell.

old Re: Menu and the escape key

archmage
User Off Offline

Quote
I think that this is your only fix atm
1
2
3
4
5
6
addhook("always", "func")
function func()
	for i = 1, 32 do
		show_menu(i)
	end
end

Maybe binds, but I think binds will only work for the server.

old Re: Menu and the escape key

DC
Admin Off Offline

Quote
there are many ways how a menu can be closed (for example also by opening another menu - which can be an event that is not even sent to the server).

there is currently no save way to keep track of the menu state as server.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview