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 / Writing a text adventure...

Author
Message
foozle my moose
19
Years of Service
User Offline
Joined: 23rd Jun 2005
Location:
Posted: 24th Jun 2005 09:51
Instead of asking small questions in thinking I know what i'm doing as I did in my earlier posts, I should just ask how to accomplish my overall goals.

There are a few things I need help with:
*Coding an all-text inventory
*Making a single routine at the beginning (or end) of the
program, that includes different things to be checked before
jumping to a subroutine (room) so I don't have to copy it for
every room.

Also I have all the fundamental actions a user can perform, listed in a single array. These actions include "examine, open, move, etc." In my coding, a$ is always one of these actions. Sven B told me that to include a variable within the array, (for the user specified object)add + variable$ to the end of each item in my array. In my case, anything the user enters, that corresponds with an action is called b$. I need to know how to check what the user inputs for a$ as well as b$ before producing a result. An example of what im trying to say:

DIM actions$(3)
actions$(1)="Backhand"+ b$
actions$(2)="Punch"+ b$
actions$(3)="Kick"+ b$

if a$= actions$(2)
rem and
b$= "speedbag"
then Print "you deal the "b$" a massive blow!"

For the "speedbag" to be "punched", both inputs need to be checked before the result is printed. Is this how I code it?

If this sounds confusing let me know, i'll try to clear it up.
Thanks,
Jack
Mr Pointless
19
Years of Service
User Offline
Joined: 17th Oct 2004
Location: Stuck in the UK
Posted: 25th Jun 2005 05:20
Quote: "then Print "you deal the "b$" a massive blow!""


Just so you know, that should be
then Print "you deal the " + b$ + " a massive blow!"
or you could just put
then Print "you deal the speedbag a massive blow!"

Oh s***, there goes the planet.
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 25th Jun 2005 10:54 Edited at: 25th Jun 2005 10:54
Actually it should be
Print "You deal the ";b$;" a massive blow!"

I have problems with inventory too!

Working On Dark Dash A Remake of Boulder-Dash and
Qwest* a text RPG.
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 25th Jun 2005 10:55
if a$= actions$(2) should be if a$ = actions$(2) then b$ = "speedbag"

Working On Dark Dash A Remake of Boulder-Dash and
Qwest* a text RPG.
NanoBrain
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Portland, OR
Posted: 25th Jun 2005 11:18
Jono,

For DarkBasic Classic, Mr. Pointless had the syntax correct.


+NanoBrain+

Login to post a reply

Server time is: 2024-09-23 23:29:22
Your offset time is: 2024-09-23 23:29:22