Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Loading no working so good
#1
I'm trying to make a program that loads a monsters stats. it is almost working...almost.

I hard-coded the stats in and it worked fine, but when i try to load the stats it doesn't work.

Code:
Dim enemyname(10) as string
Dim enemystats(10,10,10,10,10,10,10,10) as unsigned integer
Dim monster as integer
Dim amountofmonsters as integer

open "lv1.lv" for input as #1

input #1, amountofmonsters

for unused1 = 1 to amountofmonster
    input #1, enemyname(unused1)
for unused2 = 1 to 8
    input #1, enemystats(unused1,0,0,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,0,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,unused1,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,unused1,unused1)
next
next

/\/\
The loader part

Code:
10
rat
50
10
15
2
2
3
20
20
bat
50
10
15
2
2
3
20
20
cat
50
10
15
2
2
3
20
20
fat
50
10
15
2
2
3
20
20
gat
50
10
15
2
2
3
20
20
hat
50
10
15
2
2
3
20
20
qat
50
10
15
2
2
3
20
20
tat
50
10
15
2
2
3
20
20
oat
50
10
15
2
2
3
20
20
pat
50
10
15
2
2
3
20
20

/\/\
lv1.lv
url=http://www.sloganizer.net/en/][Image: style4,TheDarkJay.png][/url]
Reply
#2
Hi TheDarkJay,

I see that you have two loop variables, unused1 and unused2 but in your code, you only use unused1

Code:
Dim enemyname(10) as string
Dim enemystats(10,10,10,10,10,10,10,10) as unsigned integer
Dim monster as integer
Dim amountofmonsters as integer

open "lv1.lv" for input as #1

input #1, amountofmonsters

for unused1 = 1 to amountofmonster
    input #1, enemyname(unused1)
for unused2 = 1 to 8
    input #1, enemystats(unused1,0,0,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,0,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,unused1,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,unused1,unused1)
next
next

I'm thinking you don't need the inner loop hence your loop should look like this:

Code:
for unused1 = 1 to amountofmonster
    input #1, enemyname(unused1)
    input #1, enemystats(unused1,0,0,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,0,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,0,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,0,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,0,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,0,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,unused1,0)
    input #1, enemystats(unused1,unused1,unused1,unused1,unused1,unused1,unused1,unused1)
next

This should load your 10 enemies and their respective stats.

if it still doesn't work trying using LINE INPUT #2 instead of just INPUT #2

hope this helps.
hen they say it can't be done, THAT's when they call me ;-).

[Image: kaffee.gif]
[Image: mystikshadows.png]

need hosting: http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Reply
#3
Still no good, hmm...maybe it has something to do with how i load it for battle

Code:
monster = int (rnd * amountofmonsters) + 1

ename = enemyname(monster)
ehealth = enemystats(monster,0,0,0,0,0,0,0)
eminattack = enemystats(monster,monster,0,0,0,0,0,0)
emaxattack = enemystats(monster,monster,monster,0,0,0,0,0)
edefence = enemystats(monster,monster,monster,monster,0,0,0,0)
emgdefence = enemystats(monster,monster,monster,monster,monster,0,0,0)
espeed = enemystats(monster,monster,monster,monster,monster,monster,0,0)
goldwon = enemystats(monster,monster,monster,monster,monster,monster,monster,0)
expearned = enemystats(monster,monster,monster,monster,monster,monster,monster,monster)

checks...nope nothing to do with that.

How come

Code:
enemyname(1) = "rat"
enemystats(1,0,0,0,0,0,0,0) = 5
enemystats(1,1,0,0,0,0,0,0) = 10
enemystats(1,1,1,0,0,0,0,0) = 15
enemystats(1,1,1,1,0,0,0,0) = 2
enemystats(1,1,1,1,1,0,0,0) = 2
enemystats(1,1,1,1,1,1,0,0) = 3
enemystats(1,1,1,1,1,1,1,0) = 20
enemystats(1,1,1,1,1,1,1,1) = 20

works but loading it doesn't?
url=http://www.sloganizer.net/en/][Image: style4,TheDarkJay.png][/url]
Reply
#4
Nevermind, i missed the s of the amountofmonsters, well you did and i didn't notice.
url=http://www.sloganizer.net/en/][Image: style4,TheDarkJay.png][/url]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)