I'm doing this:
X is down = Set variable Action1 to 1
To made a key press i do:
Action1 = 1
Trigger Once -> Do an action
And works correct. The problem is when the action is for skip a layout from another that when i press X to Skip instead of skip 1 layout skip a lots of them, so for that the "Trigger Once" not works because do one for layout.
How i solve that?
Maybe try having the 'press X' action group disabled on the next layout and wait for 1.0 sec (or w.e) before activating it on the next layout?
I'm actually use something similar, a "wait for signal" that works.
But there is another way more "elegant/easy" to avoid that?
A plugin to simulate any key press will be great, not only the default ones in the behavior of movements, wiht that all this problems dissapears.
just set your Action1 variable back to 0 in the block of code that calls the action, then perform the action. You don't need the trigger once and it wont run again on the next layout. You don't need the wait this way ether.
I tried that already and not worked.
Keyboard X is down = Set variable Action1 to 1
Else = Set variable Action1 to 0
If in the layout i put:
-> Set Action1 = 0
-> Go to layout "X"
Still not works, pass various layouts :S . ¿Or i'm doing some wrong?
Actually only work if i have a condition that do:
Action 1= 1 -> Signal "skip"
And to skips layouts i put that when action1 is 1 -> Wait for signal "skip".
matriax is there a reason you are using "Key Is Down" rather than "On Key Pressed" ?
on key pressed will only fire once when you press the X key.
Key is down will fire many ticks in a row, even if you think you only briefly pressed the key. (what seems like one press to you is like 10 to the computer since it is running 60 times a second.)
Every tick that the X key is still down will set the Action1 variable to 1 again, and that will cause the Action to get called again (so that could skip several layouts).
Use "On Key Pressed" if you can (unless there is a good reason why you need to let the user hold down the X key).
AllanR Because with "On Key Pressed" if you hold the X for some attack the action1 will be 0 instead 1.
I mean, with the keyboard events you can set if is "on press" or "key is down". But how you replicate this two states using "On Key Pressed"?
Or imagine i use other key for jump that depending that how much time you hold the jump is more high, you can't achieve this with "on key press" only with "key is down".
So, for that reason i use "Key is down" plus Trigger once, to make one key press, and "key is down" alone to get the "hold" state.
The problem is that between the layout changes, the "trigger once" is executed on each layout instead remember that the action was did in the other layout.
As i said i had fixed using the "wait for signal" that works perfect, but i don't know if that will generate other problems so better if you or somebody can tellme a more easy/elegant solution .
Sometimes you just have to use 'hack' solutions until you find a more elegant one. We have a couple of those types of solutions running our game atm too, lol.
Develop games in your browser. Powerful, performant & highly capable.
matriax yeah, I understand the need to use Key Is Down for those kinds of functions. I just wasn't clear on why you would need to hold down a key while changing layouts... but I see there could be possible scenarios for that too.
in the testing I did yesterday, C2 does not realize a key is still down when it gets to the next layout (neither the "Key is down", or "On Key Released" events fired - and I would think that is a bug in C2 (but Ashley might say it is that way on purpose, or too difficult to change now to make it worth fixing). So, you might want to consider filing a bug report and see what he says...
I see, thanks to all for the info.
So, there is anything i'm missing that why is not possible simulate any key press actually with the keyboard plugin in the same way that some behaviours like 8directions movements or the Platform one do?
Adding to the keyboard plugin the option to simulate any key press will make all much easier, why is not done already? , or in the same Plaform/8direction behaviour, why not allow simulate other any key press ¿?