Text Adventures

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
Anfieldorange
Newbie
Posts: 6
Joined: Sat Aug 22, 2009 7:39 pm

Text Adventures

Post by Anfieldorange »

Hi all, I'm Kind of Stuck at the mo...

I really Want to make my own text adventure and i'd like it to be small and i written some Code but i Need some help on doing a Text Parser and How to program Room Definitions, Player Movement (E.g: N, W, S, E) and Inventory

Thanks,
AnfieldOrange
User avatar
coma8coma1
Veteran
Posts: 100
Joined: Sat Dec 08, 2007 5:29 pm
Location: Maryland, USA

Post by coma8coma1 »

i started making one ages ago, but it was crap. I could do much better now. if i can dig it up i'll post the code. i know it's around here because i just saw it recently. as long as you don't make fun of my code from like 15 years ago lol!

go ahead and explain more of what you want the end result to look and feel like so we know what you're going after
Anfieldorange
Newbie
Posts: 6
Joined: Sat Aug 22, 2009 7:39 pm

Post by Anfieldorange »

coma8coma1 wrote:i started making one ages ago, but it was crap. I could do much better now. if i can dig it up i'll post the code. i know it's around here because i just saw it recently. as long as you don't make fun of my code from like 15 years ago lol!

go ahead and explain more of what you want the end result to look and feel like so we know what you're going after
1.) I'd Like a Bar at the top That holds Game Name, Version, Rank and Score, Is that possible and if so is it hard? and if it was done how do i stop the text interfering with the banner and how do i make that rank change when the score hits a certain point

2.) Id Like the Commands and Room Info, Inventory to Start at the bottom, How do i do this?

thats all for now... :)
sorry for the long thing...

Thanks,
Anfieldorange
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

What banner?

Use Locate to position text or score numbers. What's the fuss about?

Look up POS and CSRLIN to read the current column and row positions of the Print cursor if you need to.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Anfieldorange
Newbie
Posts: 6
Joined: Sat Aug 22, 2009 7:39 pm

Post by Anfieldorange »

burger2227 wrote:What banner?

Use Locate to position text or score numbers. What's the fuss about?

Look up POS and CSRLIN to read the current column and row positions of the Print cursor if you need to.
like the Banner in Zork
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Show me your banner code. Sounds interesting, but don't know anything about Zork.

I assume you are using an ASCII text banner.

PS: I know what I said as it is directly above your response. There is no need to use quotes unless you are referring to a specific post that has other people's responses between them.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Anfieldorange
Newbie
Posts: 6
Joined: Sat Aug 22, 2009 7:39 pm

Post by Anfieldorange »

You must of misunderstood me...

I need help making a banner...
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

You will need to create the message and then use MID$ to make the letters scroll. This is not real easy to do, but you can play around with it.

You also need a slight TIMER delay to make it scroll smoothly.
Here is a link to a bottom instruction scroller at N54:

http://www.network54.com/Forum/182035/m ... e+INKEY%24

Let me know if you need more help!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
User avatar
coma8coma1
Veteran
Posts: 100
Joined: Sat Dec 08, 2007 5:29 pm
Location: Maryland, USA

Post by coma8coma1 »

I don't think AnOrange means to make it scroll.

I'm thinking you want an area at the top of the screen that simply updates to display certain information. Like Burger said, you'll need to use the LOCATE and PRINT commands to place the data onscreen.

Typically, you'd want to write a subroutine who's sole purpose is to update that data. Then, anytime you need to update the 'banner' you'd simply call that routine. It might first clear any existing data by placing the appropriate number of spaces using LOCATE, PRINT, and SPACE$. Next you'll print the data into the same places as needed, anythnig else you want to occur, then exit sub. You might even have a portion before the printing parts that updates game stats before displaying them.

The banner routine may be be a separate sub as i've described above, or it might be part of a larger routine which updates the entire screen, depending on how your game is supposed to be.
Anfieldorange
Newbie
Posts: 6
Joined: Sat Aug 22, 2009 7:39 pm

Post by Anfieldorange »

Hi all, thanks for the help, I'm going to do the title animation first as that will be the easiest, I need some help, how to I make a CircleAnimation that does not take up lots of CIRCLE Routines... i am starting the Program in screen 13...

...and I need to put Different Coloured circles to make a Big Circle, SO...
Here is a Example:

I have a Big Large Circle that will be (150, 95), 114, 2 And I need a yellow circle every Five Points (E.G: 150, 95 would become 150, 95, 109, 2) how would i do this with STEP, Or is there an easier way
User avatar
coma8coma1
Veteran
Posts: 100
Joined: Sat Dec 08, 2007 5:29 pm
Location: Maryland, USA

Get the GAME working first.

Post by coma8coma1 »

The title screen should be one of the LAST things you do. Not because it's easiest or anything, just because your number one priority should be designing and testing the game engine itself.

If the game is going to be modular with new levels being added, you might first start building a map editor which will let you make the level files and any supporting files that need to be loaded up. Once the editor is properly loading, saving and displaying each map, you can copy the loading and displaying portions of the code over and begin building the actual game now that you have a map(s) to load and test and the basic display engine running.

Even if the level data is to be built and stored directly in the program itself, you still need to work on the game engine first. It will be the heart of your prject and deserves your full attention from the start. Furthermore, the "editor" could evolve into the actual game itself, allowing the player to choose from the title screen either to make a map or play one (this is how one of my projects called "Advent" would have been if it ever got off the ground).

This is by no means a 1-2-3 magic proceedure for making any kind of video game; it's just my recommendation coming from someone who's self-taught myself and struggled with game development enough to know that amateurs focus on the wrongs things. Trust me.. I've been there ;)

-coma8
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Here is a way to use DRAW to place circles in a circle. TurnAngle (TA) is used to rotate the draws:

Code: Select all

SCREEN 12
Qt$ = CHR$(34)
COLOR 15: LOCATE 11, 45: PRINT "PSET (175, 250), 6"
                 LOCATE 12, 45: PRINT "DRAW "; Qt$; "U100"; Qt$
                 LOCATE 13, 45: PRINT "CIRCLE STEP(0, 0), 5, 12"
                 LOCATE 14, 45: PRINT "DRAW "; Qt$; "P9,12"; Qt$
                             PSET (175, 250), 15
                             SLEEP 2
                             DRAW "C6 U100"
                             SLEEP 2
                             CIRCLE STEP(0, 0), 5, 12
                             SLEEP 2
                             DRAW "P9,12"
 COLOR 13: LOCATE 17, 35: PRINT "Press any Key to use Turn Angle!"
            DO: LOOP UNTIL INKEY$ = "": DO: LOOP UNTIL INKEY$ <> ""
                 LOCATE 17, 35: PRINT SPACE$(40)
 COLOR 15: LOCATE 9, 40: PRINT "FOR i = 0 TO 360 STEP 30"
                  LOCATE 10, 45: PRINT "angle$ = STR$(i)"
 LOCATE 12, 45: PRINT "DRAW "; Qt$; "TA"; Qt$; "+ angle$ + "; Qt$; "BU100"; Qt$
                             LOCATE 15, 40: PRINT "NEXT i"
                             FOR i = 0 TO 360 STEP 30
                                 angle$ = STR$(i)
                                 PSET (175, 250), 6
                                 DRAW "TA" + angle$ + "C0 U100"
                                 CIRCLE STEP(0, 0), 5, 12
                                 DRAW "P9, 12"
                                 SLEEP 1
                             NEXT
COLOR 13: LOCATE 16, 40: PRINT "Press any key for clock!"
           DO: LOOP UNTIL INKEY$ = "":DO: LOOP UNTIL INKEY$ <> ""
COLOR 15: LOCATE 16, 40: PRINT "DO: sec$ = RIGHT$(TIME$, 2)"
                 LOCATE 17, 45: PRINT "degree$ = STR$(VAL(sec$) * -6)"
                 LOCATE 18, 45: PRINT "PSET (175, 250), 9"
  LOCATE 19, 45: PRINT "DRAW "; Qt$; "TA"; Qt$; " + degree$ + "; Qt$; "U90"; Qt$
  LOCATE 20, 40: PRINT "DO: LOOP UNTIL RIGHT$(TIME$, 2) <> sec$"
  LOCATE 21, 45: PRINT "PSET (175, 250), 0"
  LOCATE 22, 45: PRINT "DRAW "; Qt$; "TA"; Qt$; " + degree$ + "; Qt$; "U90"; Qt$
   LOCATE 23, 40: PRINT "LOOP"

   COLOR 13: LOCATE 24, 30: PRINT "Hit Any Key to stop!"
                             DO: sec$ = RIGHT$(TIME$, 2)
                                 degree$ = STR$(VAL(sec$) * -6)
                                 PSET (175, 250), 9
                                 DRAW "TA" + degree$ + "U90"
                                 DO: LOOP UNTIL RIGHT$(TIME$, 2) <> sec$
                                 PSET (175, 250), 0
                                 DRAW "TA" + degree$ + "U90"
                             LOOP UNTIL INKEY$ <> ""

Code EDITED! I removed the Delay SUB call.
This code is directly from my QB demonstrator.
Last edited by burger2227 on Tue Aug 25, 2009 3:10 am, edited 3 times in total.
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Anfieldorange
Newbie
Posts: 6
Joined: Sat Aug 22, 2009 7:39 pm

Post by Anfieldorange »

thanks^

I've been thinking of making a 3D Logo, can QBASIC Run Video Files?

thanks for the code i'll try it later
angros47
Veteran
Posts: 79
Joined: Mon Sep 08, 2008 12:52 pm
Contact:

Post by angros47 »

As far as I recall, there is a way to load FLC videos on QB. If you save your video in FLC, with resolution of 320 X 200, you should be able to use it in QB
User avatar
KDAG
Coder
Posts: 22
Joined: Wed Sep 03, 2008 4:41 am
Location: California

Ha Ha

Post by KDAG »

Burger doesn't know what Zork is? Ha Ha Ha. Hi Burg, still monopolizing the qb sceen. Just joking. Just Hi! & lol
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

LOL, you look like the one monopolizing this forum! 8)

Where ya been? Programming in C?

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply