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 Discussion / Need help with creating a choice for text answers.

Author
Message
madcatz7
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 20th Jul 2004 00:44 Edited at: 20th Jul 2004 00:45
I'm going to try and explain this as simple as possible...

I got darkBASIC about a week ago and trying to get used to it by creating some simple text conversations. I want to make a twist though, I am going to make a Choice you can pick from. Heres an example:

print " A: Good " ; choicea$
print "---"
print " B: Fine " ; choicec$
print "---"
print " C: Bad " ; choiced$
print "---"
Print " Please select a choice... (eg: type 'A' for good)"

Sorry for not useing the courcfe code feature.
anyway, my question is, How would I code the answers for the questions?

Like, If i type in 'A' how would I code the answer for that?

Heres the entire Source incase you need it:


Thanks for the help.

Edit: I guess it didnt post the entire source, Ill post it if anyone requests it then.
Lzdude69
21
Years of Service
User Offline
Joined: 21st May 2004
Location: Indiana
Posted: 20th Jul 2004 00:57
Do it like this:



Thats how I would do it.

When I die...I want to be buried upside down...So thy critics can kiss my a$$...Oh yeah, Im not dying...
madcatz7
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 20th Jul 2004 01:08
Ahh, i just tried it, works perfectly, thank you.
AsriCE
22
Years of Service
User Offline
Joined: 10th Jan 2003
Location: Brunei
Posted: 20th Jul 2004 01:11
Hi,

You got it all correct already. But say, if you want a response from the user, you have to use "Input" rather than "Print".

- The "Print" command just puts your text up on the screen.
- Whereas the "Input" command, requires the end-user to respond before it can proceed to the code. Notice you had to put a "String-Variable" after the input command?

Quote: "Input "Enter Your Name>" ; name$"

Like in your code above. You need to key in something first, before it can proceed to the:
Quote: "Print "Hello " ; name$"


Got it?

So, if you want to know the user's response, then you can use the "Input" command and use the "If-Then" commands to respond back to the user's choice. Like as follows:



But bear in mind that strings are case sensitive. Hope that helps.

AsriCE Crew,
- Adi

There's only one hope.
madcatz7
20
Years of Service
User Offline
Joined: 9th Jul 2004
Location:
Posted: 20th Jul 2004 01:40
hmm i see, thank you

Login to post a reply

Server time is: 2025-05-25 01:33:02
Your offset time is: 2025-05-25 01:33:02