
-----------------------------------
Das
Fri Jan 18, 2008 11:33 pm

&quot;For&quot; Logic Error
-----------------------------------
I have a for repetition struture that repeats twice.  It contains many if structures inside.  However, sometimes a part of the 2nd loop does not occur.  What is the problem?  By the way, I know that esif exists.  I just forgot at streamlining isn't supposed to take extra effort.

Obviously, it's a game.

 for cardUse:1..2
        
        if cardSelect(cardUse)="Shine" then
            randint (dmg,30,40)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "You use Shine!"
            put "Inflicted ",dmg," damage!"
        end if
    
        if cardSelect(cardUse)="Freeze" then
            randint (dmg,30,40)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "You use Freeze!"
            put "Inflicted ",dmg," damage!"
        end if
        
        if cardSelect(cardUse)="Sear" then
            randint (dmg,45,57)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "You use Sear!"
            put "Inflicted ",dmg," damage!"
        end if
        
        if cardSelect(cardUse)="Repair" then
            randint (dmg,33,51)
            hp:=hp+dmg
            put " "
            put "You use Repair!"
            put "Healed ",dmg," health!"
        end if
        
        if cardSelect(cardUse)="Punch" then
            randint (dmg,23,30)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "Punched!"
            put "Inflicted ",dmg," damage!"
        end if
        
        if cardSelect(cardUse)="Shock" then
            randint (dmg,18,24)
            ehp:=ehp-dmg-baseDmg
            eStat:=true
            put " "
            put "You use Shock!"
            put "Inflicted ",dmg," damage!"
            put "Paralyzed the enemy!"
        end if
        
        if cardSelect(cardUse)="Atk+" then
            baseDmg:=baseDmg+5
            put " "
            put "You use Attack Up!"
            put "Attack Power increased!"
        end if
              
        if cardSelect(cardUse)="Typhoon" then
            randint (dmg,23,30)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "You use Typhoon!"
            put "Inflicted ",dmg," damage!"
        end if
        
        
        if cardSelect(cardUse)="Blaze" then
            randint (dmg,12,15)
            randint (hit,2,4)
            for strike:1..hit
                ehp:=ehp-dmg*hit-baseDmg
            end for
            put " "
            put "You use Blaze!"
            put "Inflicted ",dmg," damage with ",hit," hits!"
        end if
        
        
        if cardSelect(cardUse)="Medicine" then
            randint (dmg,46,64)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "You use Medicine!"
            put "Healed ",dmg," health!"
        end if
        
        
        if cardSelect(cardUse)="Static" then
            randint (dmg,25,31)
            randint (hit,1,2)
            ehp:=ehp-dmg-baseDmg
            put " "
            put "You use Static!"
            put "Inflicted ",dmg," damage!"
            if hit=2 then
                eStat:=true
                put "Paralyzed the enemy!"
            end if
        end if
        
        if cardSelect(cardUse)="Magnum Quake" then
            randint (dmg,1,46)
            ehp:=ehp-dmg-baseDmg
            hp:=hp-dmg div 3
            put " "
            put "You use Magnum Quake!"
            put "Inflicted ",dmg," damage!"
            put "You took ",dmg div 3," damage!"      
        end if
        
        if cardSelect(cardUse)="Sol Beam" then
            ehp:=ehp-35-baseDmg
            put " "
            put "You use Sol Beam!"
            put "Inflicted ",dmg," damage!"
        end if
       
       if cardSelect(cardUse)="Drain" then
            randint (dmg,25,36)
            ehp:=ehp-dmg-baseDmg
            hp:=hp+dmg
            put " "
            put "You use Drain!"
            put "Inflicted ",dmg," damage!"
            put "Stole ",dmg," HP!"
        end if
        
        if cardSelect(cardUse)="Dark Sacrifice" then
            randint(dmg,70,85)
            ehp:=ehp-dmg
            hp:=hp-(dmg div 2)
            put "You use Dark Sacrifice!"
            put "You take ",dmg div 2," damage!"
            put "Inflicted ",dmg," damage!"
                  
        end if
        
        put " "
        
    end for

-----------------------------------
Saad
Sat Jan 19, 2008 12:08 am

RE:&quot;For&quot; Logic Error
-----------------------------------
Which part doesn't occur?, If you mean the second iteration then your wrong, the second times occurs, its probably that none of the if statements are true
