Xqzzy Rcxmcq |
|
Joker |
Try placing the RETURN(); command at the following location: if ((have.key() || controller(key_joystick))) { set(menu_enabled); display(1, 0, "TEXT"); RETURN(); if ((have.key()) { stop.motion(ego); reset(disable_game_functions); clear.lines(1, 0, 0); new.room(2); } } That should do the trick. ;D |
Eigen |
This code here works and it's tested: ....... your room code here..... } if((have.key()|| controller(key_joystick))) { if(isset(f40)){ stop.motion(ego); reset(disable_game_functions); clear.lines(1, 0, 0); new.room(2); return(); }//else set(menu_enabled); display(1, 0, "TEXT"); set(f40); .....other code here.... It checks if it's the first time pressed key then displays TEXT and sets f40. If f40 is set and you press a key it goes to the room 2. -Eigen |
Joel | Does this mean that have.key always returns the same value during the same interpreter cycle? If so, that's probably something that should be added to the AGI Studio help file docs on have.key. |
sonneveld |
From NAGI's source code. at the start of each cycle: state.var[V19_KEYPRESSED] = 0; the have.key() eval (obviously haven't cleaned it up since the disassembly): u8 cmd_have_key() but from the code, it looks like for each cycle it checks if var19 is 0 or not. If it's zero then it waits for a key press (if a key isn't in buffer already) and stores the key. If the key reading routine passes a non-zero number or var19 is already set, it returns true. Shorter version: If it's found a key, it keeps on returning true and the same key in var19 until next cycle. - Nick |