Game Development Community

Engine Mod: ActionMap Key combos

by Kevin James · in Torque Game Builder · 10/25/2012 (10:17 am) · 3 replies

Hey all,

I'm wanting to be able to detect key combinations, to include hitting the same key 2 or 3 times in a row.

I'm thinking that this is probably one of the most simple engine modifications to do and would be a good place to start modding the TGB engine.

I would def. be curious about people's opinions on the benefits of a scripting solution for key combos vs. an engine mod for including key combos as an action mappable thing.

About the author

Computer security, digital forensics, and platform jumper enthusiast. shells.myw3b.net/~syreal/


#1
10/25/2012 (1:43 pm)
Well for single button mashing I think a scripted counter would be sufficient.

But Torque engine modding sounds pretty good too. What would be cool is if you have a modified bind command function that would work like this.
moveMap.bind(keyboard,"a", "stuff();"); //Single button press.
moveMap.bind(keyboard,"a a a", 500, "stuff();"); //Press 'a' button three times in a row calls the function. The dynamic variable after that is the amount of milliseconds before it resets the sequence.
moveMap.bind(keyboard,"a s d f", 250, "stuff();"); //Pressing the keys 'a' 's' 'd' and 'f' in that order calls the function.

That would encompass a lot of awesome. But one thing that might be something to add is precedence valuing. For example, pressing the a button three times would only call the combo function and ignore the single press function.
Would this idea need something more I'm missing?
#2
10/25/2012 (6:08 pm)
No, that's exactly what I was thinking.

Brainstorming: maybe the keys would need to be pressed in a certain rhythm, within a given error allowance, but that doesn't seem useful for most games.

Think I'ma start looking at the engine source
#3
10/26/2012 (12:34 pm)
So after looking at the engine source, the createKeyEvent function looks most promising. The command will probably end up looking like:

moveMap.bind(keyboard, "combo a a", "stuff();");
moveMap.bind(keyboard, "combo left right", "stuff();");

Passing in extra values to bind would probably be difficult ... mostly because there's no API or documentation on engine modding that I know of.