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 / Code goes straight to CLI

Author
Message
Dier
12
Years of Service
User Offline
Joined: 19th Jan 2012
Location:
Posted: 19th Jan 2012 22:01


Any help? It just skips everything.
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 19th Jan 2012 23:17 Edited at: 19th Jan 2012 23:19
It works fine for me so I can't really help you there.

However, so this isn't a complete waste of a post, I've modified your code a little to make it a bit easier to read and to make your IF statements a little more streamlined.



Some general tips:

Use a bit of white space (i.e. blank lines) in your code to split it up a bit and use code indenting as this makes is more readable. I believe there's something in TDK's turtorials about this).

If you have a lot of "IF" statements one after the other like you have, you should look at using the "SELECT" "ENDSELECT" "CASE" "ENDCASE" commands (I believe they're faster). This will help if there are more than two responses to a questions. For instance, when ask if they want to accept a quest, various answers could be: "accept", "decline", "tell me more", "Can I think about it?". You might find the "SELECT" "ENDSELECT" makes the coding a little easier, there's also an option to have a default answer if the player doesn't give one of the listed responses, this will help with error trapping. At the moment if the player doesn't respond with "accept" or "decline"... heck, it's easier if I just show you:




Sorry I can help with you're original problem.
Dier
12
Years of Service
User Offline
Joined: 19th Jan 2012
Location:
Posted: 20th Jan 2012 04:22
Wow, that is super helpful. Thank you very much. Ill check out the "SELECT" and "CASE" commands.
Figured out the problem was the computer I was on.
Thank you.
-Dier
Dier
12
Years of Service
User Offline
Joined: 19th Jan 2012
Location:
Posted: 20th Jan 2012 04:32
Also, quick question, is there a way to say, if they input "Accept!" into the Responce$ it will ignore the "!"?
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 25th Jan 2012 22:12
There is a way of removing the exclamation mark. You want to have a look at the text commands, specifically the LEFT$() and RIGHT$().

What these do is give you the left or right character in a string:



This is a pretty crude example as I'm not an expert in using the string based commands or anything text based. For instance, if you wanted to search a string for certain keywords I wouldn't know how to do that.

If this was me, I would not have the player inputting text but just give them a number of options and then they pick the one they want. A little bit like what you have already.

Login to post a reply

Server time is: 2024-03-29 13:46:35
Your offset time is: 2024-03-29 13:46:35