Here's what your code should look like by now, which some possible differences depending on how you did the angry message property.
player:tell("You stroke ", this:title(), ".");
player.location:announce(player:titlec(), " strokes ", this:title(), ".");
rand = random(5);
happy = random(2);
if (happy == 1)
this.happiness = this.happiness - rand;
else
this.happiness = this.happiness + rand;
endif
if (this.happiness < 0)
player.location:announce_all(this:titlec(), " ", this.angry_msg, " ", player:title());
else
player.location:announce_all(this:titlec(), " ", this.happy_msg);
endif