Qbasicnews.com
May 26, 2020, 05:28:29 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: input text adventure room desc. from text file  (Read 1294 times)
wordsareme
New Member

Posts: 2



« on: April 25, 2005, 08:53:36 PM »

Hello.  I would like some help with displaying room descriptions for my text adventure game taken from a text file.  I am using a sequential file and inputing the string with: input #.  Even if I put quotes around my description (inside my text file), I can't get the description to print out neat and in paragraph style.  The only thing that I can think of at this point is using LINE INPUT # in a loop and print everything one line at a time until I get to a certain character in my text file, such as '}'.  What do you think?  Am I going at this the wrong way?  I know there has got to be an easier way to do this and make the room descriptions look good. I'd be happy if someone who has been where I am now could show me how they did it. Thank you in advance for your reply.

Regards,

K.S.
Logged
whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #1 on: April 25, 2005, 11:36:43 PM »

That is what I'd do. Except I'd use a a fewwordstogether instead of just one character IE:

Code:
CLS
OPEN "test.txt" FOR INPUT AS #1
DO
LINE INPUT #1, a$
IF a$ = "lineendthingy" THEN END ELSE PRINT a$
LOOP UNTIL EOF(1)
CLOSE

Quote from: "test.txt"
a
s
asdd
]
lineendthingy
asd231
asd
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
wordsareme
New Member

Posts: 2



« Reply #2 on: April 26, 2005, 02:34:48 AM »

That pretty much clears it up.  Thank you for the information whitetiger0990!  You know your stuff.  

Sincerely,

K.S.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!