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 / Need help, just started

Author
Message
Blaft
13
Years of Service
User Offline
Joined: 8th Feb 2013
Location:
Posted: 8th Feb 2013 08:19
Okay, so I have been watching videos all day on tutorials for DBPro, and so far I think this program is great. There is a lot of potential, especially for me. One problem I am encountering though, which y'all will probably laugh at me for is the if statement.

Well I am making a basic game right now, a text based game in which you will be required to solve problems, and riddles, and will be able to choose the next scenario( kind of like those old "choose your destiny" books we read as kids.)

I have been working on it for about 2 minutes and found a problem. Instead of explaining myself I will just post the code and my error. The error I am experiencing is that it prints the results for both of the answers, yes and no. If you say no, or anything else, including yes it will print the option for yes. Here is what I've got:



Thanks for the help guys, sorry I'm such a noob
Alduce
23
Years of Service
User Offline
Joined: 26th Oct 2002
Location: Rama spaceship
Posted: 8th Feb 2013 11:51
Hi!



Blaft
13
Years of Service
User Offline
Joined: 8th Feb 2013
Location:
Posted: 8th Feb 2013 21:51
Thank you so much Alduce, this helped me a lot =] Now I just need to learn how to make it ignore case so I can have "yes" or "Yes" or any other variation, if you could help me that would be great, but I am bound to find out sometime today anyways =] Cheers
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 8th Feb 2013 23:57
Quote: "if a$="yes""


Without the quotes your variable 'yes' becomes an integer, so basically you are looking for a matching value of yes which will likely default to '0' hence why you were getting the first statement printed and not the second, as you were trying to compare a string, as Alduce has made mention, you need to add $ to the variable to tell DBPro that it should contain a string... there are many ways to set a variable, you need to look into these

Might I recommend some of Daniel TGC's videos on YouTube 'DCForemanUK' and on the forum look for TDK Tutorials [either TDKs or TDK's I dunno] and also some very handy books to get are the Hands On DBPro books, which can be found on the store...

Good Luck and Welcome to the forums!

Blaft
13
Years of Service
User Offline
Joined: 8th Feb 2013
Location:
Posted: 9th Feb 2013 00:17
Thanks MrValentine, I have looked into this and learned a lot today, and thanks for the reference and welcoming!
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 9th Feb 2013 00:34
Anytime

HWT
21
Years of Service
User Offline
Joined: 1st Apr 2005
Location: Earth
Posted: 9th Feb 2013 01:07
Never apologise for being a noob! We've all been there (I'm *still* there in some aspects). And the only stupid question is the one not asked.

Best of luck to you!

Hello World Tommorrow
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 9th Feb 2013 19:30
Quote: "Now I just need to learn how to make it ignore case so I can have "yes" or "Yes""


You can use the LOWER$ and UPPER$ commands to make a string all lower case or all upper case.



one of these days I'll come up with a better signature

Login to post a reply

Server time is: 2026-07-07 02:39:12
Your offset time is: 2026-07-07 02:39:12