Armed

version 3 by David Ratliff

  • Home page
  • Beginning
  • Previous



  • Example: *** Trolls - Bob, king of the trolls, must be destroyed! This example shows how easy it is to override some of the values used by Armed, such as max health and maximum damage, as well as how to make a NPC always want to attack the player on sight. Additionally, this example shows a simple way to create something to restore health to the player.

            *:"Trolls"

            Include Armed by David Ratliff

            Use no scoring.

            A crossbow is a bow. The description of the crossbow is "An old crossbow. It still functions, but only barely." The maximum damage of the crossbow is 25.

            A sharpened bone is a kind of knife. The maximum damage of a sharpened bone is 15.

            A thing called the old rusty sword is a sword.

            A potion is a kind of thing.

            Instead of drinking a potion:
                if the present health of the player is less than 86 begin;
                    let elixer be a random potion carried by the player;
                    say "You gulp down the vile tasting potion. 15 points have been restored to your health.";
                    change the present health of the player to the present health of the player + 15;
                    remove elixer from play;
                otherwise;
                    say "Drinking the potion while your health is [present health of the player] will do you no good. Save it for when you need it.";
                end if.

            A troll is a kind of person. The max health of a troll is usually 40. A troll is usually hostile. Every troll carries one sharpened bone.

            Forrest is a room. The description of forrest is "A lush forrest. In front of you is a cave. A peculiar odor wafts out from the cave. Strangely, you neither see nor here any animals. Will you go in?" The crossbow and one potion are here.

            Cave is a room. Cave is inside from forrest. The description of cave is "A dank cave. It smells rather like trolls." A troll called a tall troll is in cave.

            Passage is north of cave. The description is "A narrow passage leading deeper into the cave." A troll called a short troll is here. It carries two potions.

            Throneroom is west of passage. The description is "This is the throneroom of Bob the troll king." Bob is a troll in throneroom. The max health of Bob is 70. Bob is docile. Bob carries the old rusty sword.

            After going to throneroom for the first time:
            say "Bob the troll king looks at you and says 'I am the troll king. Leave now or I will punish you for killing my followers!'".

            Every turn:
                if Bob is dead, end the game saying "You have slain Bob, king of the trolls!".

            Test me with "take all/go in/shoot troll with crossbow/shoot troll with crossbow/x me/drink potion/i/go north/shoot troll with crossbow/shoot troll with crossbow/search troll/take potions/i/drink potion/x me/go west/shoot Bob with crossbow/shoot Bob with crossbow/shoot Bob with crossbow/shoot Bob with crossbow"