06-30-2006, 09:38 AM
Hey guys. Sorry the topic's not that descriptive, but it's a small problem that's probably easily fixable but my underdeveloped brain refuses to find an answer.
I'm up in Oregon now on our yearly pilgrimage and for the month up here I'm stuck with a 28800 bps connection, which is why I'm stuck with QB45.
Anyway, I've been trying to rewrite a tiny RPG battle system I made a while back, and this time I'm using TYPES instead of seperate arrays. Well, the problem is this: At the Main Menu, I want to list the player and his HP, and, if he has any party members, their names and their HP. However, I'm having a problem getting them to show up. Here's the code I'm having trouble with:
The declaration, "n", hold's the character's name, and each party array's "hp" declaration holds 50. Unfortunatly, when I run the program, instead of just displaying the player's name and HP, like it's supposed to do, it does this (_ = space):
What's going on here? I thought I wrote the code correctly. I don't recall ever having this problem before. Is there something wrong with the laptop I'm using, or is there just a stupid little mistake I made somewhere that I'm not seeing?
If you want to see the whole code so far, for any reason, here it is:
I'm up in Oregon now on our yearly pilgrimage and for the month up here I'm stuck with a 28800 bps connection, which is why I'm stuck with QB45.
Anyway, I've been trying to rewrite a tiny RPG battle system I made a while back, and this time I'm using TYPES instead of seperate arrays. Well, the problem is this: At the Main Menu, I want to list the player and his HP, and, if he has any party members, their names and their HP. However, I'm having a problem getting them to show up. Here's the code I'm having trouble with:
Code:
FOR j = 1 TO 5
IF party(j).n <> "" THEN PRINT UCASE$(party(j).n) + ":"; party(j).hp; "HP"
NEXT j
The declaration, "n", hold's the character's name, and each party array's "hp" declaration holds 50. Unfortunatly, when I run the program, instead of just displaying the player's name and HP, like it's supposed to do, it does this (_ = space):
Quote:<MAIN MENU>
YOU: 50 HP
________________:___50 HP
________________:___50 HP
________________:___50 HP
________________:___50 HP
________________:___50 HP
What's going on here? I thought I wrote the code correctly. I don't recall ever having this problem before. Is there something wrong with the laptop I'm using, or is there just a stupid little mistake I made somewhere that I'm not seeing?
If you want to see the whole code so far, for any reason, here it is:
Code:
'REVAMPED PARTY AND BATTLE SYSTEM
'By Boxtop
DECLARE SUB InitEngine ()
TYPE pim
n AS STRING * 100
hp AS INTEGER
chance AS INTEGER
END TYPE
DIM SHARED party(5) AS pim
DIM SHARED npcs$(100)
DIM SHARED l$(100)
DIM SHARED ttlloc AS INTEGER
DIM SHARED ttlnpc AS INTEGER
DIM SHARED npcask AS INTEGER
DIM SHARED monster AS INTEGER
DIM SHARED plyrHP AS INTEGER
RANDOMIZE TIMER
InitEngine
CLS
PRINT "REMADE PARTY AND BATTLE SYSTEM"
PRINT "BY BOXTOP"
PRINT
1
rndloc% = INT(RND * ttlloc) + 1
CLS
PRINT "<MAIN MENU>"
PRINT
PRINT "PARTY ROSTER:"
PRINT "YOU:"; plyrHP; "HP"
IF party(1).n <> "" THEN
FOR j = 1 TO 5
IF party(j).n <> "" THEN PRINT UCASE$(party(j).n) + ":"; party(j).hp; "HP"
NEXT j
END IF
PRINT
PRINT "You and your party are currently " + l$(rndloc%) + "."
SUB InitEngine
OPEN "npc.dat" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, ttlnpc
IF ttlnpc > 100 THEN PRINT "ERROR: FILE npc.dat HAS TOO MANY ENTRIES ( > 100)": END
FOR npcrt = 1 TO ttlnpc
INPUT #1, npcs$(npcrt)
NEXT npcrt
LOOP
CLOSE #1
OPEN "loc.dat" FOR INPUT AS #1
DO WHILE NOT EOF(1)
INPUT #1, ttlloc
IF ttlloc > 100 THEN PRINT "ERROR: FILE loc.dat HAS TOO MANY ENTRIES ( > 100)": END
FOR lcrt = 1 TO ttlloc
INPUT #1, l$(lcrt)
NEXT lcrt
LOOP
CLOSE #1
plyrHP = 50
npcask = INT(RND * 3) + 1
monster = INT(RND * 6) + 1
FOR i = 1 TO 5
party(i).hp = 50
NEXT i
END SUB