Hey everybody I finally got how to use DBP and I haven't been on in a while. I was working on this text adventure and I got a "Can't close nest at line (last line#)"
Rem Project: Text adventure
Rem Created: Tuesday, April 24, 2012
Rem ***** Main Source File *****
`starting variables
MaxHealth = 100
Health = 50
PoisonChance = 0
Item$ = "Fists"
Armor$ = "Leather Tunic"
Xp = 0
Gold = 5
Level = 1
Round = 0
PotionAmount = 1
Contestant = Rnd(90005)+995
Confusion$ = "Yes"
Poison$ = "No"
Gosub Monster
` enter name
Print "Enter Your Name"
`Input Name$
Name$ = "Bob The Great"
cls
Intro:
Old:
OldHealth = Health
OldItem$ = Item$
OldArmor$ = Armor$
OldGold = Gold
OldPotionAmount = PotionAmount
If Round = 0
Print " ''Welcome, " + Name$ + " you are contestant number " + Str$(Contestant) + " to try test your luck against the perilous dungeon ahead of you.''"
Print ""
Print ""
Print "Press Space"
Do
If SpaceKey() then exit
Loop
Round = 1
Gosub Monster
Health = Health + Regen
Endif
cls
If Round = 2
Xp = Xp + 14 + Health/10
Gold = Gold + 12 + Rnd(3)
OldGold = Gold
Gosub Level
Gosub Inventory
Print "After the wolf was killed a rusty gate cracked open..."
Print "The announcer's voice was not to be heard the only thing to be heard was the water dripping form the ceiling."
Print " "
Print " "
Print "Press Space to exit"
Gosub Drop
Do
If SpaceKey() then exit
Loop
Round = 3
Gosub Monster
Health = Health + Regen
Endif
If Round = 4
Xp = Xp + 20 + Health/10
Gosub Level
Gosub Inventory
Print "The green blob dissipated killing all of the moss on the way to the drain."
Print "It looks like you could create potions from this, and you found some gold near the drain."
Print "Later you found a set of fur armor in a crate."
Print " "
Print " "
Print "Press Space to exit"
Gosub Drop
Do
If SpaceKey() then exit
Loop
Round = 5
Gosub Monster
Health = Health + Regen
Endif
If Round = 6
Xp = Xp + 20 + Health/10
Health = Health + Regen
Gosub Level
Gosub Inventory
Print "After the last cave bat had fallen you try to decode the lock, which looks complex."
Print "If you could open the door you could proceed..."
Do
Ink Rgb(255,255,255),0
Box 200,200,400,400
Text 250,410,"The Mouse Tells All"
If mousey()>200 and Mousey() < 400 and mousex() > 200 And MouseX() < 400
Ink Rgb(205,205,205),0
If Mouseclick() = 1 and mousey()>250 and Mousey() < 350 and mousex() > 250 And MouseX() < 350 then exit
Endif
Box 250,250,350,350
Box 300,300,400,400
Box 200,200,300,300
Loop
cls
Round = 7
Endif
Ink Rgb(255,255,255),0
If Round = 7
Xp = Xp + 20 + Health/10
Gosub Level
Gosub Inventory
Print "You have done it! The Brick wall slowly slides apart."
Print "There is a rack of spears and swords which appear to be iron."
Print "There is a single door that is barred in front of you."
Print " "
Print " "
Print "Press Space to exit"
Gosub Drop
Do
If SpaceKey() then exit
Loop
Round = 8
Gosub Monster
Health = Health + Regen
ENDIF
`Good display
GoodDisplay:
cls
Gosub Subtitle
Print "Round " + Str$(Round)
Print ""
Print ""
`Gui Display
Print Name$
Gosub Level
Print "Xp " + Str$(Xp)
Print "Level " + Str$(Level)
Gosub Health
Print "Health " + Str$(Health) +" / "+ Str$(MaxHealth)
Gosub Item
Print Item$
Gosub Armor
Print Armor$
Print "Armor Protection " + Str$(ArmorPoints)
Gosub Attack
Print "Attack " + str$(Attack)
Print "Gold " + Str$(Gold)
Gosub Potion
Print "Potions " + Str$(PotionAmount)
Gosub Inventory
Print "Inventory " + Str$(Space) +" / "+ Str$(MaxSpace)
If Poison$ = "Yes" then Print "Poisoned"
Gosub Space
BadDisplay:
Print BadName$
If Confusion$ = "No" then Print "Level " + Str$(BadLevel) else Print "Levl?"
Gosub BadHealth
If Confusion$ = "No"
If BadHealth > 0 then Print "Health " + Str$(BadHealth) else Print "Dead"
Endif
If Confusion$ = "Yes" then Print "Heelath?"
Gosub BadArmor
If Confusion$ = "No" then Print "Armor Protection " + Str$(BadDefense) else Print Str$(Rnd(122312)) + "?"
If Confusion$ = "No" then Print BadItem$ else Print "Waht?"
If Confusion$ = "No" then Print BadArmor$ else Print "Blrry?"
Goto Battle
Battle:
Gosub Space
Defense$ = "No"
Print "Type in your action:"
Print " Attack"
Print " Defend"
Print " Potion"
Print " Dodge NOT FINISHED"
Action$ = "None"
Defend$ = "No"
Input Action$
If Action$ = "Attack" or Action$ = "attack"
Damage = (Attack - BadDefense)
If Attack - BadDefense < 0 then Damage = 1
BadHealth = Badhealth - Damage
BadDefense = 0
Goto BadBattle
Endif
If Action$ = "Defend" or Action$ = "defend"
Defend$ = "Yes"
Goto BadBattle
Endif
If Action$ = "Potion" or Action$ = "potion" and PotionAmount > 0
Confusion$ = "No"
Health = Health + PotionHeal
Poison$ = "No"
PotionAmount = PotionAmount - 1
Endif
`----------------------------
If Action$ = "Kill"
BadHealth = 0
Health = MaxHealth
Goto BadBattle
Endif
`----------------------------
BadBattle:
Gosub BadAttack
BadDefense$ = "No"
If BadHealth > 0
BadAction = Rnd(5)
If BadAction => 3
BadDamage = (BadAttack - Armorpoints)
If BadAttack - ArmorPoints < 0 then BadDamage = 1
Health = Health - BadDamage
If PoisonChance > 0
PoisonChoose = Rnd(10)
If PoisonChance > PoisonChoose then Poison$ = "Yes"
Endif
If Health < 0 then Goto Die
Goto GoodDisplay
Endif
If BadAction <= 2 then BadDefense = 2 + BadArmorPoints
endif
If BadHealth <= 0
Round = Round + 1
Goto intro
Endif
Goto Gooddisplay
Health:
If Health > MaxHealth then Health = MaxHealth
Regen = 45 + level*5
Maxhealth = 90 + level * 10
If Health < 30 + Level*5 then Confusion$ = "Yes"
If Health > 70 + Level*5 then Confusion$ = "No"
If Poison$ = "Yes" then Health = Health - (1 + Level/2)
Return
Level:
If Xp > 20 then Level = 2
If Xp > 50 then Level = 3
If Xp > 100 then Level = 4
If Xp > 175 then Level = 5
If Xp > 250 then Level = 6
If Xp > 360 then Level = 7
If Xp > 500 then Level = 8
If Xp > 1000 then Level = 9
If Xp > 2000 then Level = 10
Return
BadAttack:
PoisonChance = 0
If BadItem$ = "Claw" then Badattack = 5
If BadItem$ = "Poison" then Badattack = 2
If BadItem$ = "Talon" then Badattack = 6
If BadItem$ = "Iron Spear" then Badattack = 10
`---
If BadItem$ = "Poison" Then PoisonChance = 5
If BadItem$ = "Iron Spear" then PoisonChance = 1
Return
Attack:
If Item$ = "Fists" then attack = 3
If Item$ = "Wooden Dagger" then attack = 4
If Item$ = "Wooden Sword" then attack = 6
If Item$ = "Iron Sword and Shield" then attack = 7
If Item$ = "Iron Spear" then attack = 12
Attack = Attack + Level
Return
Item:
Return
Armor:
ArmorPoints = 0
If Armor$ = "Leather Tunic" Then Armorpoints = 2
If Armor$ = "Hide Armor" Then Armorpoints = 5
If Item$ = "Iron Sword and Shield" then ArmorPoints = Armorpoints + 3
If Defend$ = "Yes" then Armorpoints = ArmorPoints * 2
Return
BadArmor:
If BadArmor$ = "Broken Armor" then BadArmorPoints = 4
Return
Inventory:
MaxSpace = Level * 10
Space = 0
If Armor$ = "Leather Tunic" then Space = Space + 4
If Armor$ = "Hide Armor" then Space = Space + 5
If PotionAmount => 1 then Space = Space + PotionAmount
If Item$ = "Wooden Sword" then Space = Space + 3
BackDrop2:
Gosub Space
Print "Drops:"
Print "Press the number on the left of the drop to take"
Print " 1) Wooden Sword, Damage 6, Weight 3, Amount " + Str$(Drop1)
Print " 2) Wooden Dagger, Damage 4, Weight 1, Amount " + Str$(Drop2)
Print " 3) Potion, Amount " + Str$(Drop3)
Print "Press the number to take the loot"
Print "Press R to reset what you have"
Print "Note you can't get more stuff than you can carry..."
Print ""
Print "Inventory " + Str$(Space) +" / "+ Str$(MaxSpace)
Print "Level " + Str$(Level)
Print "Xp " + Str$(Xp)
Print Item$
Print Armor$
Print "Armor Protection " + Str$(ArmorPoints)
Print "Attack " + str$(Attack)
Print "Gold " + Str$(Gold)
Print "Potions " + Str$(PotionAmount)
Do
If Spacekey() Then exit
If Keystate(2)=1 and Drop1 > 0
Drop1 = Drop1 - 1
Item$ = "Wooden Sword"
Gosub Inventory
If Space > MaxSpace
Item$ = "Fists"
Drop1 = Drop1 + 1
Endif
If Drop2 = 0 then Drop2 = 1
Goto Reintro2
Endif
If Keystate(3)=1 and Drop2 > 0
Drop2 = Drop2 - 1
Item$ = "Wooden Dagger"
Gosub Inventory
If Space > MaxSpace
Item$ = "Fists"
Drop2 = Drop2 + 1
Endif
If Drop1 = 0 then Drop1 = 1
Goto Reintro2
Endif
If Keystate(4)=1 and Drop3 > 0
Drop3 = Drop3 - 1
PotionAmount = PotionAmount + 1
Gosub Inventory
If Space > MaxSpace
PotionAmount = PotionAmount - 1
Drop3 = Drop3 + 1
Endif
Goto Reintro2
Endif
If Keystate(19)=1
Health = OldHealth
Item$ = OldItem$
Armor$ = OldArmor$
Gold = OldGold
PotionAmount = OldPotionAmount
Drop1 = 1
Drop2 = 1
Drop3 = 2
Gosub Inventory
Goto Reintro2
Endif
Loop
Endif
If Round = 4
Drop1 = 1
Drop2 = 3
BackDrop4:
Gosub Space
Print "Drops:"
Print "Press the number on the left of the drop to take"
Print " 1) Hide Armor, Protection 3, Weight 3, Amount " + Str$(Drop1)
Print " 2) Potion, Amount " + Str$(Drop2)
Print "Press the number to take the loot"
Print "Press R to reset what you have"
Print "Note you can't get more stuff than you can carry..."
Print ""
Print "Inventory " + Str$(Space) +" / "+ Str$(MaxSpace)
Print "Level " + Str$(Level)
Print "Xp " + Str$(Xp)
Print Item$
Print Armor$
Print "Armor Protection " + Str$(ArmorPoints)
Print "Attack " + str$(Attack)
Print "Gold " + Str$(Gold)
Print "Potions " + Str$(PotionAmount)
Do
If Spacekey() Then exit
If Keystate(2)=1 and Drop1 > 0
Drop1 = Drop1 - 1
Armor$ = "Hide Armor"
Gosub Armor
Gosub Inventory
If Space > MaxSpace
Armor$ = OldArmor$
Drop1 = Drop1 + 1
Endif
Goto Reintro4
Endif
If Keystate(3)=1 and Drop2 > 0
Drop2 = Drop2 - 1
PotionAmount = PotionAmount + 1
Gosub Inventory
If Space > MaxSpace
PotionAmount = PotionAmount - 1
Drop2 = Drop2 + 1
Endif
Goto Reintro4
Endif
If Keystate(19)=1
Health = OldHealth
Item$ = OldItem$
Armor$ = OldArmor$
Gold = OldGold
PotionAmount = OldPotionAmount
Drop1 = 1
Drop2 = 3
Gosub Inventory
Goto Reintro4
Endif
If Round = 7
Drop1 = 1
Drop2 = 1
BackDrop7:
Gosub Space
Print "Drops:"
Print "Press the number on the left of the drop to take"
Print " 1) Iron Spear, Damage 12, Weight 6, Amount " + Str$(Drop1)
Print " 2) Iron Sword and Shield, Damage 7, Protection 3, Weight 7, Amount " + Str$(Drop2)
Print "Press the number to take the loot"
Print "Press R to reset what you have"
Print "Note you can't get more stuff than you can carry..."
Print ""
Print "Inventory " + Str$(Space) +" / "+ Str$(MaxSpace)
Print "Level " + Str$(Level)
Print "Xp " + Str$(Xp)
Print Item$
Print Armor$
Print "Armor Protection " + Str$(ArmorPoints)
Print "Attack " + str$(Attack)
Print "Gold " + Str$(Gold)
Print "Potions " + Str$(PotionAmount)
Do
If Spacekey() Then exit
If Keystate(2)=1 and Drop1 > 0
Drop1 = Drop1 - 1
Item$ = "Iron Spear"
Gosub Item
Gosub Inventory
If Space > MaxSpace
Item$ = OldItem$
Drop1 = Drop1 + 1
Endif
If Drop2 = 0 then Drop2 = 1
Goto Reintro7
Endif
If Keystate(3)=1 and Drop2 > 0
Drop2 = Drop2 - 1
Item$ = "Iron Sword and Shield"
Gosub Item
Gosub Armor
Gosub Inventory
If Space > MaxSpace
Item$ = OldItem$
Drop1 = Drop1 + 1
Endif
If Drop1 = 0 then Drop1 = 1
Goto Reintro7
Endif
If Keystate(19)=1
Health = OldHealth
Item$ = OldItem$
Armor$ = OldArmor$
Gold = OldGold
PotionAmount = OldPotionAmount
Drop1 = 1
Drop2 = 1
Gosub Inventory
Goto Reintro7
Endif
Loop
Endif
Return
Reintro2:
cls
Print "After the wolf was killed a rusty gate cracked open..."
Print "The announcer's voice was not to be heard the only thing to be heard was the water dripping form the ceiling."
Print " "
Print " "
Print "Press Space to exit"
Goto BackDrop2
Reintro4:
cls
Print "The green blob dissipated killing all of the moss on the way to the drain."
Print "It looks like you could create potions from this, and you found some gold near the drain."
Print "Later you found a set of hide armor in a crate."
Print " "
Print " "
Print "Press Space to exit"
Goto BackDrop4
Reintro7:
cls
Print "You have done it! The Brick wall slowly slides apart."
Print "There is a rack of spears and swords which appear to be iron."
Print "There is a single door that is barred in front of you."
Print " "
Print " "
Print "Press Space to exit"
Goto BackDrop7
I can't figure it out, I know what the error is but I can't find it. Take anything you want from it but if you can see if you can find the error.
Yeah, I know I hate doing this I looked over the whole thing six times and I can't find it.
Wait, what?