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 / Yes, No questions

Author
Message
THE EVIL MOG
21
Years of Service
User Offline
Joined: 5th Apr 2003
Location:
Posted: 10th Apr 2003 04:05
I am making a text adventure and need to know how to make questions with specific answers and a creature choice system.
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 10th Apr 2003 04:11
Well, you would start with....

input "What is the capital of England?";cap$

if lower$(cap$)="london" then print "Correct!"
else
Print "Wrong!"

This is asking the user to input after the text phrase, and save their input as a string (cap$) Then, we change the string into lower case by using lower$ to make sure we can check our answer better, and if the answer is correct, then print Correct. If it is anything other than London, print WRONG.

Hope this helps!

RPGamer

Current Project: Eternal Destiny
Tech Demo - Colan Island: Currently 716 Lines
Obear
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location:
Posted: 12th Apr 2003 03:29 Edited at: 12th Apr 2003 03:38
Not sure what your asking exactly but for a text adventure the easiers way would be to start with the initial screen and then have ain input and depending on the imput depends on were you go from there

Psudocode...

various variables
sword = false
axe = false
gun = false

function start
print on screen "You are in a house upstairs its a nice house blah blah blah, exits lead downstairs, North is the bathroom, east is the master bedroom.

if sword = flase the print "there is a sword here"

Input "Tell me what to do";answer$
If answer$ = "north" goto bathroom
If answer$ = "east" goto masterbedroom
If answer$ = "downstairs" goto Hall
If answer$ = "get sword" or "pick up sword" then sword = true
.
.
.
fuction bathroom
print on screen "You are in the bath room, there is a bath etc etc etc
exits lead south"

input "tell me what to do";answer$
If answer$ = "south" then goto start
If etc etc etc

function materbedroom
print on screen "You in the master bedroom blah blah blah exits lead blah blah"

Input "tell me what to do";answer$
If answer$ = etc etc etc

fuction downstairs
print o screen "you are downstairs etcv etc etc"

input "tell me what to do";answer$
if etc etc etc

...........
Basicly have a start point and from there get input from the player and dependin on what they type depends on which part of the progrma the code will jump to, you can have varibles to hold values of items etc so that if sword = true and you type later "kill monster with sword" you can code a result with if statemensts

eg

IF answer$ = "kill mosnter with sword" and sword = false print on screen "You cant you dont have the sword" else do the battle bit

its not the most economical way of codeing this type of thing but it wil work and its a simple way of doing it, i dont know what your codeing caperbilitys are you question seemed to ask about the basic idea.

You can have at the styart another input selection for characters

ie

print on screen "Choose your character"
Print "Ork"
Print "Wizard"
Print "human"

input "Choose a character";char$

Then as with the loactions you can assigne various values to each character you may with to impliment later in the game such as

IF char$ = "Wizard" then magic = 10 stamina = 5 strength = 4
If char$ = "Ork" then magic = 0 stanina = 8 strenth = 10

So you can build up various values for each charater and later in the game if a battle is going on and the user types in "attack elf with sword"

the elf can have values of strength and when you deduct hit point off from the elf they can reflect the vlaues in stregth

ie Elf stamina = elf stamina - stregth

the elfs stamina gets deducted from it the value of strength wich will vary depending on which character you choose.

Ok i hope this gives you a few pointers if nothing else

REMEMBER the code above is psudocode, its not a real reprisentation of dark basic codeing, its just a coded outline of how to takle this

Ive been away from DB for a while whilst a collage studying Visual Basic, and i cant remember the exact sytax for everything.

I know its confuseing a little but its late here and im off to bed

if yuou wanted to be real good there are more effective ways of doing this, for instance to code values for characters you could use the DATA command

ie

DATA ORK,0,8,10
DATA WIZARD,10,5,4

etc etc

lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 12th Apr 2003 04:22
Your code did not work for me rpg gamer maybe cos i'm using dbp here is some that does work with dbp though!

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp

http://www.apollo-design.com
Obear
21
Years of Service
User Offline
Joined: 13th Oct 2002
Location:
Posted: 12th Apr 2003 13:08
The code wont work at all, its psydocode, meaning its just a code type way of fleshing out various routeens. You need to look at it and use the reletive DB or DBP commands, the above code could applie to any basic programing language like Visual Basic.

example of psydocode

varibles
declar some variables

main loop
print the name
print the address
get input from user as to his age
print his ages
goto the other routean
end main loop

other routean
pring some stuff
do other stuff

......
This is even vaguer but it gives you the IDEA on how to layout the actual code

I made the above code a little in more depth so the example was hopefully more clear

lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 12th Apr 2003 16:37
no i meant rpg gamers code did not work for me!

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp

http://www.apollo-design.com
John H
Retired Moderator
21
Years of Service
User Offline
Joined: 14th Oct 2002
Location: Burlington, VT
Posted: 12th Apr 2003 17:12
Just an idea of how to do it.....

Current Project: Eternal Destiny
Tech Demo - Colan Island: Currently 716 Lines
lcfcfan
21
Years of Service
User Offline
Joined: 19th Feb 2003
Location: North East, UK
Posted: 12th Apr 2003 20:41
well done on becoming a mod RPGamer

2ghz, ati radeon mobility 32mb DDR, 30gb, 256mb DDR ram, Win Xp

http://www.apollo-design.com

Login to post a reply

Server time is: 2024-09-20 03:44:33
Your offset time is: 2024-09-20 03:44:33