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 / Need a little code help please

Author
Message
Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 24th Dec 2012 19:27
I know I can work this code out using if-else but I want to use select case. What I want is for the player to select a direction with a capitol or lower case letter, NESW or nesw. I have played around with case and I guess it only takes one literal I tried an or like this CASE "N" or CASE "n". Is there a way to do this or do I have to make double case statements for each direction? I tried to nest a case inside a case and it did not work.

Here is the code



Thanks and Merry Christmas to all!
Dragonslayer
Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 24th Dec 2012 19:56 Edited at: 24th Dec 2012 20:01
convert all input to one case via upper$ or lower$ before entering the select then just check that



Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 24th Dec 2012 20:37
Thanks that worked! I have not really studied those commands yet. I am going to read up on them now.
Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 24th Dec 2012 21:27
This is what I have. Good movement code. If anyone sees a problem or a better way to do it please let me know. Here is the code

Ortu
DBPro Master
16
Years of Service
User Offline
Joined: 21st Nov 2007
Location: Austin, TX
Posted: 24th Dec 2012 21:42
Looks solid, one thing to note though is that using input command will essentially pause the program until the user responds, an input system using the entry$ buffer is more complicated but would allow the game to continue running background processes and logic while it waits for the player to do something. May be overkill for your project if it's all text based, but could be usefull to look into in general.

Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 24th Dec 2012 22:20
Sounds a little beyond me right now. I will look it up and learn about it. I am just doing a little text thing now to learn how to work out some routines and learn how to use the commands properly.
sayerbloke
11
Years of Service
User Offline
Joined: 1st Dec 2012
Location:
Posted: 25th Dec 2012 06:59
All seems to work well enough . Depending on how exactly this code will fit in with other procedures, you could re-arrange it a little to change when you call the Print line. It's the same code each time so you could move it, like so:



Same result, but saves a few lines of code .

Merry Christmas to you too!
Dragon slayer
17
Years of Service
User Offline
Joined: 3rd Nov 2006
Location: Bourbonnais Illinois
Posted: 25th Dec 2012 18:25
Did not even realize that Thanks!

Merry Christmas

Login to post a reply

Server time is: 2024-03-28 09:35:23
Your offset time is: 2024-03-28 09:35:23