Message Board
Message Board > Fenix / Bennu / Gemix / DIV > Button already pressed check strangely does not work O.o |
December 17, 2006, 14:53 | |
Quiest
now with more happynes 142 posts |
Here is what I do: I call a process with _x from another process. In that new process, another one should be started by pressing _x again. I do: Code: process one() begin loop if(key(_x)) two(); return; end; frame; end; end; process two(); private pressed=true; begin loop if(!key(_x))pressed=false;end; if(key(_x) and !pressed) three(); return; end; frame; end; end; the pressed should keep it from starting the three() right away, it should make it wait till the _x key is released and pressed again. But it does not work, atleast for me o.O It takes 1 or two seconds and then starts three() and I keep _x pressed since one(). I have no idea why... please help me! ____________ Roundhousekick to the face, baby! |
# |
December 17, 2006, 15:16 | |
Eckolin
Quite Whiskered 388 posts |
That code runs fine here.
____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
December 17, 2006, 15:24 | |
Quiest
now with more happynes 142 posts |
Yes, I noticed, that simplified version does work... So it must be someting else in my code (cant imagine what). ____________ Roundhousekick to the face, baby! |
# |
December 17, 2006, 15:51 | |
Quiest
now with more happynes 142 posts |
Okay I tracked it down. It was because there is a call of set_mode in process two. I have to change the bitmode from 16 to 8 and then call set_mode again. Does anyone know why it happens? ____________ Roundhousekick to the face, baby! |
# |
December 17, 2006, 15:59 | |
Rincewind
programmer 1546 posts |
Could you give a code example of where it goes wrong?
____________ Personal website: http://www.loijson.com |
# |
December 17, 2006, 20:30 | |
Sandman
F3n!x0r 1194 posts |
I'd say set_mode() resets all the keys and thus also the _x key, making it unpressed. Then (after a frame) the program continues and notices you are pressing _x again, so bam it executes three(). You could try putting the following exactly at the beginning of two(): Code: while(key(_x)) frame; end If you don't want the process to wait, maybe this works, when put after all the set_mode()-stuff and before the loop: Code: frame;
____________ BennuWiki Yes, my avatar has grey borders in IE (so get a decent browser) ROOFLEZ ROOFLEZ |
# |
December 18, 2006, 00:16 | |
Quiest
now with more happynes 142 posts |
It ignores the while(key(_x))frame;end; at the start of two() as well. Already tried that before posting. And nice idea with frame ^^ sadly, it takes 14 frames until it "recovers"... I`m working around this now by letting process one wait for releasing the key before calling two() but I hate that solution... think I have to make the menu 8bit or the minigames 16bit then so I dont need the damn set_mode [Edited on December 18, 2006 by Quiest] ____________ Roundhousekick to the face, baby! |
# |
December 18, 2006, 04:18 | |
Dennis
どこかにいる 2092 posts |
stupid idea: set scan_code = _x after set_mode or something? ____________ Kwakkel |
# |
December 18, 2006, 10:09 | |
Quiest
now with more happynes 142 posts |
Nope, no worky work. Besides that, I`m using keymappings (__X) cause its the X Button on the GP2X. ____________ Roundhousekick to the face, baby! |
# |
Message Board > Fenix / Bennu / Gemix / DIV > Button already pressed check strangely does not work O.o