Good afternoon! I have a simple question this time (I hope). I’d like to spawn a thing upon a player action. Specifically, I’d like to spawn a bullet on a table when the player takes the lamp from the table. That way it appears as if the bullet was “under” the lamp.
I can’t seem to figure out the wording to do this, and the index of phrases talks about moving things and removing them from play, but not about spawning them into play and placing them somewhere.
You cannot create entirely new objects at runtime in I7. (Well, you can do it with an extension, but even then you’d be well-advised not to rely on doing it too much.) The usual way around this is to define a number of similar objects in your code, starting out of play (or, in the case of multiple objects defined by a single phrase, somewhere that the player will never encounter them), and then move them into play when you need them.
[code]
Ten bullets are in the Hidden Armoury. [Hidden Armoury then becomes a container, but the player will never encounter it because you haven’t said where it is.]
After taking the lamp for the first time:
if there is a bullet in Hidden Armoury begin;
say “Oh, look, there was a bullet under the lamp. How unseemly! Ammunition should always be stored securely in a clean, dry place. You snaffle it, just in case a baby discovers it and uses it as a chew toy.”;
let N be a random bullet in the Hidden Armoury;
now the player carries N;
end if;[/code]
See also the manual’s example Claims Adjustment.
(Some other IF languages, such as TADS, do allow dynamic object creation. For your purposes, though, dynamic object creation seems unnecessary.)