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.

DarkBASIC Professional Discussion / Printing within an If Statement Problem

Author
Message
coachsmithdhs
15
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 9th Nov 2010 20:01
For some reason nothing I print within the if statement is working. If you could please help me!
Here is the short bit of code:

Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 9th Nov 2010 21:45 Edited at: 9th Nov 2010 21:49
You're most likely forgetting
set cursor X, Y
before using print.

Or it could also be that the message displays appears and disappears so fast that you can't see it.

[edit] Oh, it's best not to use INPUT in a loop. If syncing is used, the input command will not be shown since SYNC isn't called while inputting characters.

Cheers!
Sven B

coachsmithdhs
15
Years of Service
User Offline
Joined: 12th Oct 2010
Location:
Posted: 9th Nov 2010 21:49
How do I freeze it on the screen so it doesn't display so fast where you can see it?
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 9th Nov 2010 21:51
Maybe you set your ink to the same colour as the background?

Also there's no point putting "wait key" after "input" really as it waits for input anyway, try taking that out...

Rich Dersheimer
AGK Developer
17
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 9th Nov 2010 23:45
What are all those backslashes in there for? If you want them to print, put them inside the quote marks.

Does your print statement work without the if test?

Or if the if test is something that cannot fail? Like if 1 = 1?

Does the sound play when the if test is true?

And why do you print the name$ before you input it?

Enquiring minds want to know!

Brk_oth
20
Years of Service
User Offline
Joined: 8th Aug 2005
Location: Australia
Posted: 10th Nov 2010 00:56 Edited at: 10th Nov 2010 13:03
I wouldnt think that would even compile... unless your using a different ide that uses backslash as a reserved symbol - such as for comments.
Anyway, try removing the backslashes.
Try this:

There are a few programming style errors, but lets deal with the original problem of printing not working.

So now we have removed the backslashes, you should find that it prints the text, but it only appears on the screen for a fraction of a second. To print the text to the screen like you would normally in a 2D environment, turn the backdrop off and on again before and after your printing.

Like this:



and here is just a short bit of code I whipped up that shows it working. (the box to collide with is right in front of you, so just push up to move to it)
(plus has a couple of style corrections)


No signature found...
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Nov 2010 09:47
That's odd, I didn't notice those backslashes were there before... that would stop it from printing if you have your IDE setup to use double backslashes for remarks.

Login to post a reply

Server time is: 2026-07-26 05:03:47
Your offset time is: 2026-07-26 05:03:47