How To

how to test if the user has debug mode on

3

espero_dev 2023-08-21 07:51

I don’t know how to test it without modding it I could make a dll to make a static version of it where I can access if debug mode is 0 or 1 but that will be buggy in a way because when you say run this then your able to run the game that sounds a lil like a virus any suggestions about doing this with out really modding it


was8bit 2023-08-21 10:52

Without TRACE, you can test your variables by using NUMBER to show the value of a variable in real time... also to test WHERE your code is being ran you can use PLAY to create a unique sound to let you know when and where your code is executing...

However, sometimes there are situations where you cannot use these to test your code, so TRACE is an easy way to quickly turn on or off your testing without having to worry about some of those issues...

Generally, players will NOT play a game in DEBUG mode... so there is no need to worry about that...

There are many times you want to check on thing then another thing, but not both things at the same time...

An easy way to temporarily to remove a check that you may want to use later is to add REM in front of a check... so

TRACE XPOS,YPOS,SETNUM

can be easily turned off temporarily with

REM TRACE XPOS,YPOS,SETNUM

then easily turned back on by deleting the REM

TRACE XPOS,YPOS,SETNUM

... and it is perfectly OK to leave the TRACE statements in your code, as it helps programmers better understand how to code, and players will never bother reading the code anyway, and wont run the game in DEBUG mode anyway :)


SP4CEBAR 2023-08-21 16:36

if debug mode makes a performance impact that makes VBL happen sooner in your program, then you can detect that (it does mean that your program has to run at 100% CPU)


was8bit 2023-08-22 10:10

One other thought... to prevent a user from easily seeing debug data is to make each debug conditional...

IF DBON=1 THEN TRACE CHECKVAR

then near the top of your code..

DBON=0
Turns all debug statements off, so even if a user turns on debug mode, your code has disabled all debug statements...

Then when you need the debug data
DBON=1
Will let you see all your debug data again ;)


Log in to reply.