Problem description: I really didn't know where this was so pose to go so if this is the wrong spot let me know but, i'm wanting to do have it so people have to hit like ( A,A,A(Action-Key) ) for one move then another example ( A,S,D,Q,E(Action-Key) ) so on so fourth what would be the best way for me to do this. and if you could maybe give a tiny example to give me the right path
You should check findtext() and copytext() procs. You can make var - Combo, and when you press any button you add some symbols to this var. and after every think you need is check this var by findtext and copytext.
Sorry for my poor english. |
Marek, I don't think he meant typing in a string then parsing it into commands, but rather direct commands being strung together and accomplishing a different task than individual button presses. In which case, I haven't checked out Ss4's library, but I'd just handle it something like.
list/buttonpresses = new/list() on <key> <time> = what <time> was after <time> buttonpresses = new/list() on <key> add <key> to buttonpresses depending on what's in buttonpresses, do different things. so a, would call attack(basic) a,a, would call attack(strong) etc. |
I've made posts on combo systems before, but here's the gist of what you need:
1) Each key you might use in a combo system should call a master routine that adds it to a combo. 2) In the master routine, you'll have a timeout. It resets every time a new command is added, but if it ever expires, the combo fires. If there's no complete combo, you simply fire the partials, always taking the longest possible sequence starting from the beginning. 3) The master routine keeps track of the current chain of un-fired commands. If the new key creates a chain that can't exist in any combo, (e.g., you have A-A and Q-W but no A-A-Q), then you take the longest combo you can starting at the beginning, fire that and remove it from the chain, and use what's left to start building a new combo. So in my example A-A-Q, the A-A would be fired and Q would be left. If you hit W right after that, you'd have the Q-W combo. Roughly it looks like this: // Use one of these for each player mob That's a fairly simple setup, but the gist should be clear. I added in some failsafes for situations like if you defined A-A and Q-W but forgot to do A, Q, or W on their own. |
http://www.byond.com/developer/Ss4toby/ButtonCombos