By that I mean, multiple outcomes. Anytime I try to make a series of statements, it tries to satisfy ALL of them. I want it to see if it satisfies the first statement, then move to the next. If that doesn’t work, I want it to go down the list.
This is what I’ve been trying to get to work:
[code]A weapon has a number called damage.
A weapon is a kind of thing.
A blade is a kind of weapon.
A sword is a kind of blade.
A knife is a kind of blade.
The dagger is a knife. The damage of the dagger is 5.
After examining weapon:
if the damage is 25:
say “This weapon is flawlessly crafted.”;
otherwise if the damage is 20:
say “This weapon is near-flawless.”;
otherwise if the damage is 15:
say “This weapon is pretty average.”;
otherwise if the damage is 10:
say “This weapon could use some work.”;
otherwise if the damage is 5:
say “This weapon is poorly crafted.”;[/code]
The game will take this, but when I examine the dagger in my game, I get no output.
I was also trying to mess with this but couldn’t get it to work either:
[code]Check examining a weapon:
say “Your weapon is [status of the weapon]. (Damage: [damage of the weapon])” instead.
To say status of the weapon:
let x be damage of the weapon;
if x is 25:
say “a flawless [noun]”;
otherwise if x is at most 5:
say “a crude [noun]”;
otherwise if x is at most 15:
say “an average looking [noun]”;
otherwise if x is at most 20:
say “a fine [noun]”;[/code]
Check examining a weapon:
say "Your weapon is [status of the noun]. (Damage: [damage of the noun])" instead.
To say status of (W - a weapon):
let x be damage of W;
if x is 25:
say "a flawless [W]";
The trick to remember is that if you defined “weapon” as a kind of thing, you never write “the weapon” in your code. It never works. (Nor does “the room”, “the thing”…) You always have to refer to a variable or a particular item. In most actions, “the noun” is the variable to consider. When you’re defining a phrase, like your “To say status of …”, you define your own variable.
[code]A weapon has a number called damage.
A weapon is a kind of thing.
A blade is a kind of weapon.
A sword is a kind of blade.
A knife is a kind of blade.
The dagger is a knife. The damage of the dagger is 5.
After examining a weapon:
if the damage of the noun is 25 begin;
say “This weapon is flawlessly crafted.”;
otherwise if the damage of the noun is 20;
say “This weapon is near-flawless.”;
otherwise if the damage of the noun is 15;
say “This weapon is pretty average.”;
otherwise if the damage of the noun is 10;
say “This weapon could use some work.”;
otherwise if the damage of the noun is 5;
say “This weapon is poorly crafted.”;
end if.[/code]
Bear in mind that you’ll get a blank response if the damage of the weapon is not 5, 10, 15, 20 or 25. To avoid this, you might want something like this.
[code]A weapon has a number called damage.
A weapon is a kind of thing.
A blade is a kind of weapon.
A sword is a kind of blade.
A knife is a kind of blade.
The dagger is a knife. The damage of the dagger is 5.
After examining a weapon:
if the damage of the noun is at least 25 begin;
say “This weapon is flawlessly crafted.”;
otherwise if the damage of the noun is at least 20;
say “This weapon is near-flawless.”;
otherwise if the damage of the noun is at least 15;
say “This weapon is pretty average.”;
otherwise if the damage of the noun is at least 10;
say “This weapon could use some work.”;
otherwise if the damage of the noun is at least 5;
say “This weapon is poorly crafted.”;
otherwise;
say “This probably doesn’t even classify as a weapon.”;
end if.[/code]