none
Sub Not Ending RRS feed

  • Question

  • My Problem is that, the sub dosent end, well it might end, but it just keeps going back to the beginning

    Here It Is:

    Sub battle
      While monhp > 0 Or hp > 0
        TextWindow.Clear()
    TextWindow.WriteLine("Your HP:" + hp + "                                  Monster HP:" + monhp)
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine("What Shall You Do...?")
    TextWindow.WriteLine("1. Attack                            2. Skill attack (Not Working)")
    ba = TextWindow.ReadNumber() ' ba = battle answer
    If ba = 1 Then
      If lvl > mondef Or  lvl = mondef Then
        dmg =Math.GetRandomNumber(wepattack + lvl / 2)
      endif
      If lvl < mondef then
      dmg = 0
    EndIf
    EndIf
    
    TextWindow.Clear()
    TextWindow.WriteLine("You Attack " + monname + " For " + dmg + " Damage")
    monhp = monhp - dmg
    TextWindow.WriteLine(monname + " Has " + monhp + "HP Left")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine(" ")
    TextWindow.WriteLine(" ")
    
    If monlvl > armordef Or monlvl = armordef Then
      mdmg =  Math.GetRandomNumber(monatt - armordef)
    Else
      mdmg = 0
    EndIf
    
    TextWindow.WriteLine("You Get Attacked For " + mdmg + " Damage")
    hp = hp - mdmg
    TextWindow.WriteLine("You Have " + hp + "HP Left")
    Program.Delay(3000)
    
    EndWhile
    
    If hp = 0 or hp < 0 then
    TextWindow.WriteLine("You Have Been Defeated, Nice Try!")
    TextWindow.Pause()
    endif
    If monhp = 0 or monhp < 0 then
    TextWindow.WriteLine("Congratulations You Have Won!")
    TextWindow.Pause()
    endif
    
    EndSub
    The Rest Of The Code Is At: SNB656
    Saturday, May 30, 2009 10:43 AM

Answers

  • Hi,
         I have the answer to your question and a few other suggestions as well. I hope you take them in the helpful spirit in which they were intended.

    Your While test at the start of the Sub should be,

    While monhp > 0 And hp > 0

    You have spelt Farmer as Framer in one instance.
    "Framer: You're The Criminal The King Has Been Looking For"

    You should change the TextColor to green before
    TextWindow.WriteLine(name + ": Maybe Not, But I Will Sure Try")

    and back to yellow before
    TextWindow.WriteLine("Dragu: Haha, I Told You Could never Defeat Me")

    You should also set the TextColor you require at the start of the battle() Sub.

    "Dosent" should be "Doesn't"

    formula's should be formulae (in English) or formulas (in American) but never formula's. The apostrophe represents omission or possession but this is just a plural.

    I don't personally like the all capitalisation of the speech, but if you wish to do that then "never" should be capitalised in
    ("Dragu: Haha, I Told You Could never Defeat Me").
    Saturday, May 30, 2009 12:06 PM

All replies

  • Hi,
         I have the answer to your question and a few other suggestions as well. I hope you take them in the helpful spirit in which they were intended.

    Your While test at the start of the Sub should be,

    While monhp > 0 And hp > 0

    You have spelt Farmer as Framer in one instance.
    "Framer: You're The Criminal The King Has Been Looking For"

    You should change the TextColor to green before
    TextWindow.WriteLine(name + ": Maybe Not, But I Will Sure Try")

    and back to yellow before
    TextWindow.WriteLine("Dragu: Haha, I Told You Could never Defeat Me")

    You should also set the TextColor you require at the start of the battle() Sub.

    "Dosent" should be "Doesn't"

    formula's should be formulae (in English) or formulas (in American) but never formula's. The apostrophe represents omission or possession but this is just a plural.

    I don't personally like the all capitalisation of the speech, but if you wish to do that then "never" should be capitalised in
    ("Dragu: Haha, I Told You Could never Defeat Me").
    Saturday, May 30, 2009 12:06 PM
  • Never Said The Games Was Done

    But thanks, I would've missed those for sure
    Saturday, May 30, 2009 1:09 PM