Dynamic monster mutations

As I said, Inform just created an object whose name is “your head.” If you had code to detach that head and make it part of something else, its name would still be “your head.” It doesn’t understand “the head of the player” or “the player’s head” because those aren’t names of the object you’re trying to talk about. (And as Sam said, there’s no way for it to interpret “the head of the player” or even “the head that is part of the player” because there’s no guarantee that there will always be one and only one head that is part of the player at any given time.)

Yeah, I kinda worked that out, but I still think that it should understand ‘your’ as ‘the player’ since it does that with basically everything else. :confused: But thanks a lot everyone, now all I have to do is work out how to make my mutations system.

Thing is, “your” should not signify “the player”, but rather “a possession of the player” or similar. The degree to which Inform 7 understands such matters is more a factor of the automatic naming of incorporated parts; the understand machinery isn’t really the culprit. Anyway, you could solve the issue by using the “understand when” facility, like so:

[code]Pertainment relates a thing (called x) to a thing (called y) when x is part of y or x is held by y. The verb to pertain to (it pertains to, they pertain to, it is pertaining to) implies the pertainment relation.

Understand “your” as a thing when the item described pertains to the player.[/code]

Thanks, I’ll put that in, I’m sure it will help. :slight_smile:

By the way, do any of you know how to set up a script that chooses one of a number of options at random? I know how to do it in a ‘say’ command but I have no idea how to do it normally and there doesn’t seem to be anything in the documentation about it.

For a start, there’s plenty in the documentation about it. See 8.18. Randomness.

Other than that, the question is really what you mean by an ‘option’. If it’s just choosing one game-entity that matches a particular description, it’s straightforward:

let X be a random burrito in Greater California;

If your option is just some arbitrary chunk of code, you want this (see 11.8. Otherwise for the notation):

let Z be a random number from 1 to 3; if Z is: -- 1: say "Congratulations! You have won your very own animatronic moose."; now the player carries the animatronic moose; -- 2: say "Hooray! You have won this all-expenses-paid trip to Mindanao, effective immediately."; move the player to Mindanao; -- 3: say "Sorry, you have died. This is a pretty terrible game, to be honest."; end the story;
But if it’s a fairly regular kind of result, it might be more efficient to use a table and choose a random row from it:

Table of Island Destinations
island	attraction	problem
Mindanao	"glorious mountains"		"political violence"
Little Diomede	"view of Russia"	"soul-crushing, frozen isolation"
Madagascar	"lemurs"		"deforestation"
Britain		"cultured, attractive people"		"terrible food"
Vancouver	"temperate rainforests"	"Canadians"

Instead of opening the envelope:
sort the Table of Island Destinations in random order;
choose row 1 in the Table of Island Destinations;
say "You have won an all-expenses-paid trip to [the island entry], famed for its [attraction entry]! Hope you don't have a problem with [problem entry].";
move the player to the island entry;

Thanks for all your help, I’ve searched several times for ‘random’ but I couldn’t find anything. :stuck_out_tongue: This should be really helpful.

Eash, Ok, I have another problem, lol. I have created the Body Parts, and I can probably clone them with Dynamic Objects by Jesse McGrew, but I can’t get the game to move the objects to and from the player and storage, or make sure that they are a part of the player and not worn or visible in the inventory. Has anyone got any ideas how I could do this?

If we have a specific body part (Jane’s nose), the syntax is,

now Jane's nose is part of Jane.

This is just a suggestion, but I’d do it in three steps:

  • Define the concept of an unassigned body part, that is, a body part which is not yet part of a person.
  • Define the concept of a person without body parts (i.e. it does not “incorporate” anything). You could call it an “incomplete” person.
  • add an unassigned body part of each type to each incomplete person.