ActionMap Concatenation
by Mark Owen · 01/23/2004 (10:59 am) · 6 comments
Download Code File
Before making the following changes, make backup copies of sim\engine\actionmap.* and fps\client\scripts\client.cs in the case you want to undo the changes.
In engine\sim\actionmap.h change the line
to read:
Replace your existing engine\sim\actionmap.cc file with the one attached to this resource then do a Build of the engine (a complete rebuild is NOT required).
Add the following script function to fps\client\scripts\client.cs:
Example of script to concatenate one map onto another and activate the result:
Example of script to deactivate the temporary map and restore the previous map:
Before making the following changes, make backup copies of sim\engine\actionmap.* and fps\client\scripts\client.cs in the case you want to undo the changes.
In engine\sim\actionmap.h change the line
void dumpActionMap(const char* fileName, const bool append) const;
to read:
void dumpActionMap(const char* fileName, const bool append, const bool tempmap) const;
Replace your existing engine\sim\actionmap.cc file with the one attached to this resource then do a Build of the engine (a complete rebuild is NOT required).
Add the following script function to fps\client\scripts\client.cs:
function clientCmdCatActionMap(%a,%b)
{ // create a file called tempMap.cs
// containing the contents of the actionMaps
// %a and %b
%a.save("~/client/tempMap.cs",false,true);
%b.save("~/client/tempMap.cs",true,true);
// compile the combined map and load it for use
exec("~/client/tempMap.cs");
}Example of script to concatenate one map onto another and activate the result:
// deactivate current map (in this case moveMap) CommandToClient(%client, "PopActionMap", moveMap); // concatenate myMap onto moveMap as TempMap CommandToClient(%client, "CatActionMap", moveMap, myMap); // activate the resulting TempMap CommandToClient(%client, "PushActionMap", TempMap);
Example of script to deactivate the temporary map and restore the previous map:
// deactivate TempMap CommandToClient(%client, "PopActionMap", TempMap); // reactivate previous map (in this case moveMap) CommandToClient(%client, "PushActionMap", moveMap);
About the author
#2
01/27/2004 (7:05 am)
Alex... you are indeed correct.
#3
01/28/2004 (9:51 am)
Link doesn't appear to work yet.
#4
01/28/2004 (10:02 am)
For some reason, yesterday, the links to these resources, stopped working. I've re-uploaded/linked the file.
#5
I was just wondering the other day, how I could decouple the editor controls from the in game controls. This seems to be a good answer.
05/08/2004 (11:54 pm)
Thanks Mark,I was just wondering the other day, how I could decouple the editor controls from the in game controls. This seems to be a good answer.
#6
12/06/2005 (5:36 am)
Not to make you feel bad but you can do this through script wihout any head code changes. We have a system in our game where the action map is changed depinding on the vehicle you're in. 
Torque Owner Alex \"bathala\" Rufon
I havent tested this but from what I understand from the code ... this will be usefull if you have two sets of command maps. For example you have a set of commands for moving around when your character is on foot and another when your driving a vehicle. So what this does is temporarily create a command map where both command set will be active.
Did I get it right?
Alex