This could work:
sync off
`RANDOMIZE TIMER()
health = 1000
opphealth = 1000
type class
ranger as string
swordsman as string
theif as string
endtype
type stat
health as integer
str as integer
dex as integer
acc as integer
endtype
dim class(3) as class
dim stat(3) as stat
class(1).ranger = "Ranger"
stat(1).str = 4
stat(1).dex = 7
stat(1).acc = 12
class(2).swordsman = "Swordsman"
stat(2).str = 12
stat(2).dex = 6
stat(2).acc = 4
class(3).theif = "Theif"
stat(3).str = 3
stat(3).dex = 12
stat(3).acc = 6
dim oppclass(3) as class
dim oppstat(3) as stat
class(1).ranger = "Ranger"
stat(1).str = 4
stat(1).dex = 7
stat(1).acc = 12
class(2).swordsman = "Swordsman"
stat(2).str = 12
stat(2).dex = 6
stat(2).acc = 4
class(3).theif = "Theif"
stat(3).str = 3
stat(3).dex = 12
stat(3).acc = 6
print ""
print "What class do you want?"
print "1.) Ranger"
print "2.) Swordsman"
print "3.) Theif"
input "", classc
if classc = 1 then plyrclass$ = class(1).ranger
if classc = 2 then plyrclass$ = class(2).swordsman
if classc = 3 then plyrclass$ = class(3).theif
print "Who would you like to battle?"
print "1.) Ranger"
print "2.) Swordsman"
print "3.) Theif"
input "", oppclass
if oppclass = 1 then oppclass$ = oppclass(1).ranger
if oppclass = 2 then oppclass$ = oppclass(2).swordsman
if oppclass = 3 then oppclass$ = oppclass(3).theif
cls
turnrandom = rnd(9)
if turnrandom=<5
playerturn = 1
endif
if turnrandom>5
oppturn = 1
endif
do
if keystate(57) = 1 and keypress = 0
keypress = 1
if playerturn = 1
tohit = (rnd(5)+ 1) + (stat(class).acc) * (stat(class).str)
opphealth = opphealth - tohit
if opphealth =< 0 then cls : print "end" : wait key : end
playerturn = 0 : oppturn = 1
endif
if oppturn = 1
oppTohit = (rnd(5) + 1) + (stat(oppclass).acc) * (stat(oppclass).str)
health = health - oppTohit
if health =< 0 then cls : print "end" : wait key : end
oppturn = 0 : playerturn = 1
endif
endif
if keystate(57) = 0 then keypress = 0
cls
text 0,0, "health: "+str$(health)
text 0,20, "opphealth: "+str$(opphealth)
sync
loop
Where there is a will, there is a way.
I often edit my posts, that`s who i am