Reading external files

Please use this Board for QBasic related requests ( file research, programming, etc.)

Moderators: Administrator, Global Moderator

Post Reply
Ghost Creations
Newbie
Posts: 1
Joined: Thu Jul 21, 2022 2:01 pm

Reading external files

Post by Ghost Creations »

I want to make a program that will read other files for the source.
ie.

Spells.txt
INV:
Invisibility will allow you to become invisible for a certain period of
time. Enemies can not hit you during your invisibility.

WRI:
The write spell allows you to copy a spell onto a scroll.
Any class may read a scroll, and execute the spell, provided they
have enough ions.
Casting format: CAST [spell name to copy]

Potions.txt
Type 0 - Strength
-------------------------
Force
Silver
Hell
Might
Ocean

Type 1 - Intellegence
-------------------------
Wit
Black
Potion of Lords
Spell
Meta

Monsters.txt
Record Number: 0
Monster Name : Equinox
Way of talking: scream
Battle phrase: Die
Level: 1
Attack phrase: jumps up and claws
Attack Damage: 4
Percent of attacking: 10
Monsters spell: None
Percent bonus to first item: 0
---------------------------------------------------
Record Number: 1
Monster Name : Endorian
Way of talking: yell
Battle phrase: Get away
Level: 1
Attack phrase: jumps up and claws
Attack Damage: 0
Percent of attacking: 999
Monsters spell: None
Percent bonus to first item: 0
---------------------------------------------------

Items.txt
Item record: 0
Item Name: Broken-Weapon
Item damage: 1
Item special: 0
Item Type: 0
Item Stat: 100
Item Value: 0
Repair charge: 0
Wieght: 40
---------------------------------------------------
Item record: 1
Item Name: Broken-Armour
Item damage: 0
Item special: 0
Item Type: 2
Item Stat: 100
Item Value: 0
Repair charge: 0
Wieght: 30
---------------------------------------------------
Peter Swinkels
Jr. Member
Posts: 16
Joined: Fri Sep 17, 2021 12:08 pm
Location: The Netherlands
Contact:

Re: Reading external files

Post by Peter Swinkels »

Are you trying to create a game in qb?

Your question is very broad, could you be more specific?

When it comes to file i/o in qb look up the following in the help:
OPEN statement
EOF function
LINE INPUT # statement

Those should get you started.
Post Reply