You must be logged in to do that.

HookButton

HookButton
void HookButton(int button, string function)

Documentation

Each time the key, set by the standard button numbers, is pressed the function is called. Note this is once and only per button press, it is not called repeatedly if the button is held. It needs to be released then pressed again to trigger another function call. As with all hook functions, it requires the string of a function name that requires no passed values, and any return value is ignored. To remove the hook, call pass "" as the function name. The button numbers to pass are similar to those passed to Unpress, with some limitations:
Numerical ValueButton Hooked
0All buttons (no effect)
1b1
2b2
3b3
4b4
5up (no effect)
6down (no effect)
7left (no effect)
8right (no effect)

Example Usage

// Put this in system.vc and it will actually compile and run...
void autoexec()
{
	// Hooks the up key to the function
	HookButton(1, "ButtonDown_Enter");
	while (!b3) { UpdateControls(); }
	exit("And you said you would change...");
}

void ButtonDown_Enter() // If up arrow is pressed
{
	// Display a little message box
	MessageBox("One enter button pressed");
}
Talkback

There are no talkbacks on this documentation page yet. Post the first?

Post a new comment?

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.