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.

Newcomers DBPro Corner / Help with "print"

Author
Message
Lemon Phat
13
Years of Service
User Offline
Joined: 20th May 2011
Location: Minnesota
Posted: 24th May 2011 21:44
Hopefully this is basic...

ANYWAYS! I was recently emailing baxslash about some coding help, and I GREATLY appreciate his help! It was EXTREMELY HELPFUL!

This is my problem...
I need to Print 20 different factson the screen, But im not sure how to change it from the text that he has it as.. to "fact"

It currently says.. " you've got fruit number "X" (whatever fruit you just collected)"

here is the code, and tips?

for t = 1 to NumberOfFruits : rem If I hit one of the little fruits
if Object collision(1,t + NumberOfFruits)>0
play sound 4
MyScore = MyScore + 1000 : rem How many points each little fruit is worth
` delete object t + NumberOfFruits
exclude object on t + NumberOfFruits

REM ADDED BY BAXSLASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
mess$ = "You got fruit number "+str$(t)+"!!"
displaytime = timer()+3000
REM ADDED BY BAXSLASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Kezzla
16
Years of Service
User Offline
Joined: 21st Aug 2008
Location: Where beer does flow and men chunder
Posted: 25th May 2011 08:44
not sure what you mean by changing the "text" to "fact"
you can print the text in the variable mess$ with the following


if it has to be somewhere specific then you could use the

command

if you want a unique fact you can make your own string variable and assign text to it. eg


if you want 20 facts you may want to look at using an array for ease of printing numerous commands eg



be sure to look at the help files in dbpro and the many great tutorials in the sticky threads at the top of the newcomers corner.

hope this helps
kezzla

Sometimes I like to use words out of contents
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 25th May 2011 10:52
I have an amended version for you here:

Try using the code above instead of the message code I gave you...

Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 14th Jul 2011 22:18
Hi ppl, soz I am interrupting this thread, but I don't like to make another thread- master of the scrapyard award not 4 me^^. This may be the right place for my question:

nor "text" nor "print" writes anything on my program, and I have no idea why. I feel there is a simple answer...

here is the code- a little edited multisync example:



Join The dark Side! We have cookies
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 15th Jul 2011 01:37
@ Kiaurutis
Quote: "I don't like to make another thread- master of the scrapyard award not 4 me^^."

Hahaha, that image is just a joke, you don't really achieve "master of the scrapyard".

I think you want sync on not off and add in a sync rate of 60 like this
sync on : sync rate 60

And then, in your first while loop (while not logged) at the end of that put in the command 'sync'.

Try this, I don't have dark data or dark.net (I don't know which one) so this is untested.


Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 15th Jul 2011 12:36
nope, this makes only worse: I have to move my window with a mouse so that "input" text updates, and nor print or text statements appear...

It is Multisync 1.4.1 dll by Benjamin, not an official add-on.

What about scrapyard- I know its a joke, and I joke too, but there is no need to make hundreds of one-sentence-answer threads. It gets harder to find answer when there are lots of threads.
BTW it would be cool that there is an "master of (s)crapyard" award

Join The dark Side! We have cookies
Hodgey
15
Years of Service
User Offline
Joined: 10th Oct 2009
Location: Australia
Posted: 15th Jul 2011 14:14
Quote: "nope, this makes only worse: I have to move my window with a mouse so that "input" text updates, and nor print or text statements appear..."

Ah yes I remember having the same problem with the input function a while back. Unfortunately I came to the conclusion that you can only have either 'input' or text/print commands. One way around this is to write your own input function via the entry$() command.
Have a look at this:

You should be able to turn this into a function. Good luck

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 15th Jul 2011 14:45
...here's a version I'm using at the moment. Just call the "init" function before your game loop and "text_entry" during the loop when you want input.


Hope that helps!

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 15th Jul 2011 18:05
Quote: "nope, this makes only worse: I have to move my window with a mouse so that "input" text updates, and nor print or text statements appear..."


It's because Darkbasic stays on the INPUT command till the user hits enter so there's no way to SYNC the screen while getting text via INPUT. The only good way to get text is with the ENTRY$() command like Hodgey and Baxslash suggested. Doing it that way gives you the ability to create your own prompt as well (like a blinking cursor) and control the speed at which the text appears/disappears.

Kiaurutis
13
Years of Service
User Offline
Joined: 19th Jan 2011
Location: Lithuania
Posted: 16th Jul 2011 16:21
hell yeah!! It is working as it should be now

Here is a little snippet to read 2 strings in a row using baxslash's functions :y



Thx for help

PS it should be mentioned in DBP manuals commands reference that INPUT stops program until enter pressed

Join The dark Side! We have cookies
2Beastmode4u
13
Years of Service
User Offline
Joined: 14th Feb 2011
Location: Loading...
Posted: 17th Jul 2011 03:54 Edited at: 17th Jul 2011 03:57
Your doing that Carbonade thing too? Lol. Wait, that Edutainment right? Let me see it when you finish this.

What I did for the 20 facts was make a test before the game having the facts. If they passed, they could play the game.

See attached.

God help me, Please.

Come on down to my site at Unleashed FPSCreators

Login to post a reply

Server time is: 2024-11-22 18:27:33
Your offset time is: 2024-11-22 18:27:33