Home » Renegade Discussions » Mod Forum » big new engine feature added to scripts 2.1, Keyboard Hooks
big new engine feature added to scripts 2.1, Keyboard Hooks [message #134444] |
Wed, 26 January 2005 01:57 |
|
I have jsut completed adding the new keyboard hooks feature to scripts.dll 2.1 as well as the first scripts that will use it (the Jetpack scripts)
How it works is this:
Firstly, there is code that runs on the client.
At startup, the client reads a file called keys.cfg from the data folder (the name and/or location may change).
This file contains lines of the form Jetpack=Y_Key or Deploy=U_Key
The first part can be any string you like and is the "logical key" name which is used later when the script registers the hook.
The second part is one of the standard renegade key names (a full guide/list and possibly a GUI application or custom renegade dialog for editing the config file will be included with 2.1 when its released).
The code takes each line and adds it to a data structure containing key entries.
Each entry contains the logical key name, the number corresponding to the physical key (there is a function in renegade to do the conversion which I have hooked and am using) and the current "key value" (i.e. the value returned from the renegade input code)
Then, it installs a hook into the renegade input processing. This hook iterates through the key list created when the config file was read in.
for each key, it asks the input system for the "state" of the physical key involved.
some extra code is then invoked to make sure that keypresses are only triggered once (I can make it recognize multiple keypresses if a use comes up where recognizing repeat keypresses/key is held down arrises but for now it was easier to make it only recognize one keypress at a time)
After this, if the result was that the key was pressed (and it was in the released state last time the input check ran), a message is sent to the server part of the code.
This contains the logical key name that has been depressed along with the player ID of the player who pressed the key.
A script notifies the server code that it wants to process a given key by handing it 4 things:
The address of the hook procedure
The logical key it is interested in
The player ID it is interested in (obtained e.g. from a GameObject via Get_Player_ID)
and a piece of data that can be whatever you want.
The same data will be given back to the hook procedure when it is called.
There is also a process to unregister a hook when you have finished (e.g. when the infantry unit with JFW_Jetpack on it dies or buys a new character)
When the keypress message is recieved by the server, it loops through all the registered hooks.
If it finds a hook where the player ID and logical key name match with the ones sent from the client, the hook is called (passing in the data that was passed in when the hook was reigstered).
Then, the hook can do whatever you want it to do.
So far, the hook has been used for the Jetpack script which is to go on the jumpjet infantry for Reborn, it can also be used for the soviet cosmonaut infantry in RA2Ven if required and in fact anything else where you want infantry that can "fly" (including if you wanted spellcasting infantry that could levitate).
It is also planned to be used for the underground digging logic (Subterranian APC/flame tank) and the deploying vehicle logic (e.g. tick tank and lots of other stuff in many games)
Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
|
|
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: jonwil on Wed, 26 January 2005 01:57
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: glyde51 on Wed, 26 January 2005 06:50
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: Sir Kane on Wed, 26 January 2005 09:18
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: jonwil on Wed, 26 January 2005 15:53
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: Blazea58 on Thu, 27 January 2005 07:37
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: Spice on Thu, 27 January 2005 13:59
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: WNxCABAL on Thu, 27 January 2005 14:05
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: WNxCABAL on Mon, 31 January 2005 14:14
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: icedog90 on Wed, 02 February 2005 14:17
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: WNxCABAL on Wed, 02 February 2005 17:11
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: WNxCABAL on Wed, 02 February 2005 17:17
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: Blazer on Wed, 02 February 2005 20:51
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: Blazer on Thu, 03 February 2005 00:43
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: revenuke on Thu, 03 February 2005 06:31
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
By: WNxCABAL on Thu, 03 February 2005 08:24
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
|
|
big new engine feature added to scripts 2.1, Keyboard Hooks
|
Goto Forum:
Current Time: Mon Nov 11 08:35:17 MST 2024
Total time taken to generate the page: 0.01188 seconds
|