More crazy Tokamak bombs :(
Blitz3D Forums/Blitz3D Userlibs/More crazy Tokamak bombs :(
| ||
To disable Tokamak from running (Tokamak pause) I've set about deactivating every TOK object with this code...If KeyDown(57) ; Key Space TOK_active=0 ; Stop For n=1 To NUM_ACTORS TOKRB_Active actors(n)\TOK_obj,False Next EndIf If I enable the Stop command, so the code is stopped in debug before executing, I can exit debug and it works fine on 50 Tok objects. But if I leave out the Stop command, the program crashes out with a 'Memory Access Violation' and the Debug shows n=10. Why would execution after stopping work, where normal execution hangs at number ten? |
| ||
This seem very weird... What happens if you place a small delay instead of a stop? |
| ||
Usually when I see things like this happening, it means buffer overrun of some sort or another. |
| ||
A delay of 50 msecs cures things, and it seems it's a case of reading the Space key quickly afterwards - the delay stops the space being registered too quickly. It seems like pressing the space bar too quickly, the TOKRB_Active command trips over itself. Surely this can't be the case, as the rest of the program including reading the keyboard won't occur until the TOKRB_Active is finished? I can find a workaround thanks all, but I'd like to know what this happens if anyone has any ideas :) |