Quintin Stone
13th Apr 2000, 10:27 AM
I've been trying to track down what the best way is to create new key binds and commands.
Now for a mutator, it's a relatively simple process to create a new mutator. When a player types "mutate <something>" at the console, the "<something>" is passed to a function in all mutators being used in the current game, and they can see if that text matches anything preprogrammed into the mutator. By binding this to a key, a player can access new commands for a mutator.
Problem is, we're doing a game type mod, and I don't want to include a base mutator if we don't have to. The bigger problem is that this doesn't really work with keys that we want to be *held* down. In Quake2, if you bound a key to +fooey, it would send "+fooey" to the server when the key was pressed and then the client would automatically send "-fooey" when the key was released. You could detect this in the server code and set flags when the button was pressed and clear the flag when the button was released.
So the question I'm trying to find out is "How can we code a new command that is continuous as long as the button is held down, like 'fire' or 'crouch'?" I've done a bit of investigating on my own, but haven't had much success. It looks like there are a few unused button-detecting flags included in the Pawn code that could be used for this purpose but I haven't been able to figure out how to actually use them. Does anyone have any hints on the subject?
Now for a mutator, it's a relatively simple process to create a new mutator. When a player types "mutate <something>" at the console, the "<something>" is passed to a function in all mutators being used in the current game, and they can see if that text matches anything preprogrammed into the mutator. By binding this to a key, a player can access new commands for a mutator.
Problem is, we're doing a game type mod, and I don't want to include a base mutator if we don't have to. The bigger problem is that this doesn't really work with keys that we want to be *held* down. In Quake2, if you bound a key to +fooey, it would send "+fooey" to the server when the key was pressed and then the client would automatically send "-fooey" when the key was released. You could detect this in the server code and set flags when the button was pressed and clear the flag when the button was released.
So the question I'm trying to find out is "How can we code a new command that is continuous as long as the button is held down, like 'fire' or 'crouch'?" I've done a bit of investigating on my own, but haven't had much success. It looks like there are a few unused button-detecting flags included in the Pawn code that could be used for this purpose but I haven't been able to figure out how to actually use them. Does anyone have any hints on the subject?