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 / Tutorial Man Presents: Beginner's Guide to Computing Text Adventure Games

Author
Message
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 25th Jan 2006 19:46 Edited at: 27th Jan 2006 01:54
Coding Our Text Adventure - Phase 1


What kind of text adventure is this?

It's a regular text adventure, most text adventures have no battle scenes. It's all about story telling like reading a book on the computer. If you want battle scenes and rpg elements I'm about to start a new tutorial on that soon.

Why the name change?
I don't know

What will our text adventure be?
A guy is trapped in a tower and he must escape.

Have you looked at the text section yet?
If you haven't please take a gander at it right now.

The Coding Begins

This code will be setting our text adventure up, we will declare some variables, and our rooms. 5 rooms for each direction, in tole we have 20 rooms no?

Map is included



Perpare for: Phase 2 - later today!!

Programming is fun with DarkBASIC!
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 25th Jan 2006 20:00 Edited at: 27th Jan 2006 01:55
User Input In DarkBASIC Classic


Okay the first part is done, you know what a string is, what input does, and so on. But now, how do you let the user press enter? Space? The A Key? The Any Key?(hehe joking)

You need a feedback loop, in order for this to work. Basically a feedback loop, is just a loop. You can use the do, loop for all your feedback needs!

Here's some code that allows basically, the user to press a few keys.



What just happened?

Do loop, does something until it is told to exit in this case it's not. We used the cls command at the beginning of our loop because if not it would continous print out our text without clearing the screen. It repeats until it's told to stop.

Comments, you can comment or make notes in your code by using the rem command, ` key, or remstart and remend.

eg:
Rem comment
`Comment
Remstart
comment
Remend

inkey$() allows you to type a text statement that specifies a key it's easier then scancode, idiot proof and alot better to use.
a is not the same as A in inkey$() remember that.

0s and 1s, 0s not true or false, 1 true. I could explain about back in the days of binary but that would bore or melt your brain to death.

If/then is a condition statement if a permater is met an action is performed.

eg
if myaction = 1 then action

if myaction = 1
permater
endif

if myaction = 1
permater met
else
thepermater is not met
endif

Perpare for: Data Management

Programming is fun with DarkBASIC!
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 25th Jan 2006 20:01 Edited at: 25th Jan 2006 20:18
Data Mangement


Do you like math? I don't so don't worry this math is very basic.

What the heck is variables?

Variables again as I mentioned it's hard to explain. But they are certain values that hold the values you want at a period in time. In DarkBASIC there is three types of them: floats, strings and integers.

Integers?

These are non-rational numbers that range from above 0 to below 0.

integer = 12212
or
2331231

Floats?

Floats are basically rational numbers they range from above 0 to below 0. They must have a # in front.

float# = 12.12
or
12.2

Arrays

Arrays are variables that keep the same name but have a different id, useful for some stuff.

Example:


Data

Data statements can be declared using the data command, there is no restrictions they can hold lots of values, strings and integers on the same line!

eg

data 1,"string",1.2,1,1,1,1,1
so on ..........

Perpare for: Customizing our text

Tutorial Man - The Teacher of Dark BASIC
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 25th Jan 2006 20:24 Edited at: 25th Jan 2006 20:25
Customizing Text?


You know your bored when your learning how to customize text

Changing the Color
You can use the ink rgb command! Rgb stands for red green blue. There is a maximum of 255, and minium of 0.

it follows this format

ink rgb(red,green,blue),transparentcy (not a color id given has some would think)

Any way to change the position of my text?

Using the set cursor command!

eg
set cursor x,y
Print "Hey look text went here ma!"

What's x & y?
X is right to left, y is up and down.

Is that why it's called 2dimensions?
Yes, two axis, two dimensions.

Is there another way then print
Yes only one more: text x,y,string$

More text customizing?
To see more ways of formatting text, see the help section on darkbasic under text.

Perpare for: Coding our text adventure stage 1 - tomorrow

Tutorial Man - The Teacher of Dark BASIC
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 26th Jan 2006 16:41
Coding Our Text Adventure - Phase 1


What kind of text adventure is this?

It's a regular text adventure, most text adventures have no battle scenes. It's all about story telling like reading a book on the computer. If you want battle scenes and rpg elements I'm about to start a new tutorial on that soon.

Why the name change?
I don't know

What will our text adventure be?
A guy is trapped in a tower and he must escape.

Have you looked at the text section yet?
If you haven't please take a gander at it right now.

The Coding Begins

This code will be setting our text adventure up, we will declare some variables, and our rooms. 5 rooms for each direction, in tole we have 20 rooms no?

Map is included



Perpare for: Phase 2 - later today!!

Programming is fun with DarkBASIC!

Attachments

Login to view attachments
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 26th Jan 2006 19:37
If no one's interested a mod might as well lock this thread.

Programming is fun with DarkBASIC!
Fox Dark Master
20
Years of Service
User Offline
Joined: 20th Jul 2004
Location: Portugal
Posted: 26th Jan 2006 19:50
y prefer to see this flood with posts?


KiTsUnE wOrKsHoP
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 26th Jan 2006 20:57
Sorry didn't understand you there.

Programming is fun with DarkBASIC!
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 26th Jan 2006 20:58
Okay I understand now I'll have more code and stuff tomorrow I need to work on my app first!

Programming is fun with DarkBASIC!
Fox Dark Master
20
Years of Service
User Offline
Joined: 20th Jul 2004
Location: Portugal
Posted: 27th Jan 2006 00:26 Edited at: 27th Jan 2006 00:27
I've notice some things that all tutorial stuff is to code first and explain later. Why don't you do both? explain while showing some code?

other thing... Identation(I don't know how it spells in english, sorry ^^') and correct order
for example, what looks bether?


or this one?



KiTsUnE wOrKsHoP
UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 27th Jan 2006 00:35
Yes, if you are creating a tutorial, you should introduce good habits, not bad ones(not indenting code) PLEASE FIX!!!!


Hippopotomonstrosesquippedaliophobia-Fear of long words
Computer Nerd
19
Years of Service
User Offline
Joined: 25th Jan 2005
Location: What do you care?
Posted: 27th Jan 2006 01:53
Yes UFO I know I should introduce indenting I don't do this myself, I will go back and fix! Text adventure game will be done tomorrow.

Programming is fun with DarkBASIC!

Login to post a reply

Server time is: 2024-11-27 05:51:19
Your offset time is: 2024-11-27 05:51:19