Here is what I came up with:
HALOBAT
Code: :Lbl 1
:ClrDraw
:Text(0,25,"BATTLE!
:Text(15,25,"1. FIGHT
:Text(25,25,"2. HIDE
:0→E:0→F:0→G:0→H:0→I:0→J:0→R
:Repeat E
:getKey→E
:End
:If E≠92 and E≠93:Goto 1
:If E=93:Then
:randInt(1,20→R
:If R≤{L3}(10:Then
:Text(45,25,"ESCAPED!
:Pause
:0→E:0→F:0→G:0→H:0→I:0→R
:ClrDraw:Return:End
:If R>{L3}(10:Then
:Text(45,25,"CAN'T ESCAPE!
:Pause
:ClrDraw
:92→E:End:End
:Lbl 2
:0→F:0→G:0→H:0→I:0→R
:If E=92:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(25,25,"1. HUMAN
:Text(35,25,"2. COVENANT
:Repeat F
:getKey→F
:End:End
:If F≠92 and F≠93:Goto 2
:If F=92:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(15,5,"1. MAGNUM ",{L2}(6),"/",{L2}(7
:Text(25,5,"2. ASSAULT RIFLE ",{L2}(8),"/",{L2}(9
:Text(35,5,"3. SHOTGUN ",{L2}(16),"/",{L2}(17
:Text(45,5,"4. SNIPER RIFLE ",{L2}(18),"/",{L2}(19
:Text(55,5,"5. FRAG GRENADE ",{L2}(3
:Text(55,72,"BACK
:0→H
:Repeat G
:getKey→G
:End:End
:If F=92 and G≠92 and G≠93 and G≠94 and G≠82 and G≠83:Goto 2
:If F=93:Then
:ClrDraw
:Text(0,25,"CHOOSE WEAPON
:Text(15,5,"PLASMA PISTOL ",{L2}(24),"/",{L2}(25
:Text(25,5,"PLASMA RIFLE ",{L2}(26),"/",{L2}(27
:Text(35,5,"NEEDLER ",{L2}(28),"/",{L2}(29
:Text(45,5,"ENERGY SWORD ",{L2}(38),"/",{L2}(39
:Text(55,5,"PLASMA GRENADE ",{L2}(4
:Text(55,72,"BACK
:0→G
:Repeat H
:getKey→H
:End:End
:If F=93 and H≠92 and H≠93 and H≠94 and H≠82 and H≠83:Goto 2
:If G=92:Then
:{L1}(1→{L2}(48
:{L1}(2→{L2}(49
:{L2}(6)-{L1}(3→{L2}(6
:{L2}(6→{L2}(50
:{L2}(7→{L2}(51
:"MAGNUM→Str1:End
:If G=93:Then
:{L1}(4→{L2}(48
:{L1}(5→{L2}(49
:{L2}(8)-{L1}(6→{L2}(8
:{L2}(8→{L2}(50
:{L2}(9→{L2}(51
:"ASSAULT RIFLE→Str1:End
:If G=94:Then
:{L1}(16→{L2}(48
:{L1}(17→{L2}(49
:{L2}(16)-{L1}(18→{L2}(16
:{L2}(16→{L2}(50
:{L2}(17→{L2}(51
:"SHOTGUN→Str1:End
:If G=82:Then
:{L1}(19→{L2}(48
:{L1}(20→{L2}(49
:{L2}(18)-{L1}(21→{L2}(18
:{L2}(18→{L2}(50
:{L2}(19→{L2}(51
:"SNIPER RIFLE→Str1:End
:If G=83:Then
:{L1}(52→{L2}(48
:{L1}(53→{L2}(49
:{L2}(3)-{L1}(54→{L2}(3
:{L2}(3→{L2}(50
:4→{L2}(51
:"FRAG GRENADE→Str1:End
:If H=92:Then
:{L1}(28→{L2}(48
:{L1}(29→{L2}(49
:{L2}(24)-{L1}(30→{L2}(24
:{L2}(24→{L2}(50
:{L2}(25→{L2}(51
:"PLASMA PISTOL→Str1:End
:If H=93:Then
:{L1}(31→{L2}(48
:{L1}(32→{L2}(49
:{L2}(26)-{L1}(33→{L2}(26
:{L2}(26→{L2}(50
:{L2}(27→{L2}(51
:"PLASMA RIFLE→Str1:End
:If H=94:Then
:{L1}(34→{L2}(48
:{L1}(35→{L2}(49
:{L2}(28)-{L1}(36→{L2}(28
:{L2}(28→{L2}(50
:{L2}(29→{L2}(51
:"NEEDLER→Str1:End
:If H=82:Then
:{L1}(49→{L2}(48
:{L1}(50→{L2}(49
:{L2}(38)-{L1}(51→{L2}(38
:{L2}(38→{L2}(50
:{L2}(39→{L2}(51
:"ENERGY SWORD→Str1:End
:If H=83:Then
:{L1}(55→{L2}(48
:{L1}(56→{L2}(49
:{L2}(4)-{L1}(57→{L2}(4
:{L2}(4→{L2}(50
:4→{L2}(51
:"PLASMA GRENADE→Str1:End
:prgmHALOBAT2
HALOBAT2
Code: :ClrDraw
:1→J:0→I
:randInt(1,100→θ
:If θ>{L2}(49:Then
:Text(15,25,Str2," MISSED!
:Pause
:End
:If θ≤{L2}(49:Then
:Text(15,25,Str2," HIT!
:Pause
:{L3}(2)-{L2}(48→{L3}(2
:If 0≥{L3}(2:Then
:{L3}(1)+{L3}(2→{L3}(1
:0→{L3}(2
:Text(25,25,Str3," HAS NO SHIELDS!
:Pause
:End
:If 0≥{L3}(1:Then
:0→J
:Text(35,25,Str3," DIED!
:Pause
:End
:If J=0:Then
:randInt(1,20→θ
:If θ≤{L3}(6:Then
:Text(45,25,Str3," DROPPED WEAPON
:Pause
:randInt({L3}(7),{L3}(8))→θ
:If θ>{L2}(50:θ→{L2}(50
:If {L2}(50)>{L2}(51:{L2}(51→{L2}(50
:End:End:End
:If J=1:Then
:ClrDraw
:randInt(1,100→θ
:If θ>{L3}(4:Then
:Text(15,25,Str3," MISSED!
:Pause
:End
:If θ≤{L3}(4:Then
:Text(15,25,Str3," HIT!
:Pause
:{L2}(2)-{L3}(5→{L2}(2
:If 0≥{L2}(2:Then
:{L2}(1)-abs({L2}(2→{L2}(1
:Text(25,25,Str2," HAS NO SHIELDS!
:Pause :End
:If 0≥{L2}(1:Then
:ClrDraw
:Text(35,25,Str2," DIED!
:Pause
:End:End:End
:If 0<{L2}(1 and 0<{L3}(1:prgmHALOBAT
:"If 0<{L2}(1 and 0≥{L3}(1
:If 0≥{L2}(1:Then
:
:Stop
:End
I have a few problems with this code, though (and yes, I made sure I had an appropriate number of then/while/repeat vs. ends ).
- First off, when I run the HALOBAT program, it doesn't run the HALOBAT2 program when it is done with loading the weapon information.
- Second, I get an "Invalid Dim" after the user and the enemy attack; the Goto takes me to the end of the code in HALOBAT2 where I tell it to run HALOBAT again if both guys are above 0 HP (is right on the colon before the "prgm" command).
How do I fix these problems (and, consequently, what is causing them - so I don't make the mistakes again )?