Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Handy Debug Message Box

Author
Message
orv
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 12th Nov 2003 05:38
Ever wondered what the value of a variable was at a certain point in your code? This function (though not fancy) will display a value and wait for the user to either click the ok button or press the enter key.

I think if you've been using Dark Basic Pro for awhile and you run this demo, you will appreciate it's usefulness.

Not as easy as debugging in Visual Basic, but still alot better!


Please let me know what you think.

Cheers

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1 - DBPCompiler.exe=V1.05
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 12th Nov 2003 08:13
i like my method better because its simple....

Call the function as

Debug(0,0,"Debug text")

to comment out, just do a search/replace for debug(
and replace as `debug(
and done.

internet gaming group
orv
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 12th Nov 2003 15:38
waffle:
that's good... unless the program at that point is updating a bitmap other than the screen (bitmap 0), because the TEXT would write to that bitmap instead of the screen. tho it sounds like you're not doing that so.... you'd be fine!

i noticed you didn't have any kind of debouncing code when the user presses the spacebar, if you were checking values in a loop (building an array for example) you might hold down the space bar too long and miss seeing a value, you might want to check the SOURCE button below for a slight change to prevent debouncing:
(this means that the user has to press AND release the space key before the routine will continue.)

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1 - DBPCompiler.exe=V1.05
orv
21
Years of Service
User Offline
Joined: 9th Sep 2003
Location: Chicago, IL
Posted: 13th Nov 2003 04:20
arrrrrgh!

I tried my function in another program an it didn't work right!

I guess maybe I goofed!

back to the drawing board.

If you aim at nothing you'll hit it every time. 806mhz AMD Athlon Processor. 384MB memory.
Windows XP Home Edition. RADEON 9700 Pro graphics card. - editor.exe=1.0.6.1 - DBPCompiler.exe=V1.05
waffle
22
Years of Service
User Offline
Joined: 9th Sep 2002
Location: Western USA
Posted: 13th Nov 2003 11:28 Edited at: 13th Nov 2003 11:30
sorry, but I have it that way in the code base and my apps. I guess i just left that part out.

internet gaming group
guru of boredom
21
Years of Service
User Offline
Joined: 12th Oct 2003
Location: middle of no where
Posted: 16th Nov 2003 02:32
just puch escape and use the CLI!

we are not outnumbered! we are just in a target rich enviroment!
P4 2.4 ghz 120 GB 256 mb GeForce4
DrakeX
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location:
Posted: 16th Nov 2003 05:39
the CLI is next to useless. the variable watch crashes every time and typing any command in the CLI causes it to not be able to resume program execution (what use is that?). not to mention the program stepthru line numbers are messed up by #CONSTANT (which i use all the time).

stop looking at me!

Login to post a reply

Server time is: 2024-11-23 23:53:47
Your offset time is: 2024-11-23 23:53:47