Capture User Input

Whomever

srb2 noob
Is there a way to set keybinds for functions, or special ways to activate certain functions? Like for example I wanted to press K to use the P_NukeEnemies function, how would I accomplish that - or any other miscellaneous way to detect when the user intends to use that function?
Thanks!
 
Is there a way to set keybinds for functions, or special ways to activate certain functions? Like for example I wanted to press K to use the P_NukeEnemies function, how would I accomplish that - or any other miscellaneous way to detect when the user intends to use that function?
Thanks!

No. You can't. At least SRB2 Wiki helps you how these functions work.
 
SRB2's Lua does not have direct keypress detection functionality.
The closest you have is the availability of custom buttons 1 through 3, or creating custom commands the which you can bind to keys in the console.
 
SRB2's Lua does not have direct keypress detection functionality.
The closest you have is the availability of custom buttons 1 through 3, or creating custom commands the which you can bind to keys in the console.

What are the extents of creating custom commands for the console?
But thanks for letting me know about the buttons 1 to 3, how would I hook those?
 
What are the extents of creating custom commands for the console?
I don't know of any extents myself.
You can override existing commands, but you can't override CVars.
And you can't assign commands to keys - The player has to do it, or you can hijack it by having the script executing the bind command in console, which you can but probably shouldn't do.

But thanks for letting me know about the buttons 1 to 3, how would I hook those?
You can't hook onto buttons.
However, the game provides a way to check player input through player.cmd. The buttons field within holds 16 bits, and each bit corresponds to a button. The bit will be 1 if the corresponding button is being held, or 0 otherwise.
 
Last edited:

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top