Creating and moving objects from table

The scenario: the player attacks things in a room and then coins fall out as objects the player can then pick up. I want the coins to be fixed-random from a table.

I came across the example “Introduction to Juggling” in §16.16 of the documentation, and tried to modify. The example uses a custom action to summon the specific noun from the table, where I need it to be random.

I whipped up this sample code to try and work out the idea before plugging it into my actual game. The trouble is getting the sequence to move the coin selected in the table to the game world. I’ve tried many variations from my limited Inform vocabulary of move "[coin entry]" to the location;


The Kitchen is a room. The player is in the Kitchen.

The description of kitchen is "A typical kitchen with: stove, fridge, pot, dish rack, backsplash"

Stove is scenery in kitchen. 
Fridge is scenery in kitchen.
Pot is scenery in kitchen.
Dish Rack is scenery in kitchen.
Backsplash is scenery in kitchen.


The plural of coin is coins. A coin is a kind of thing. Some coins are defined by the Table of Random Money.

Instead of attacking something:
	if the number of filled rows in the Table of Random Money is not 0:
		say "You punch the [noun].";
		try PullingMoney;
	otherwise if the number of filled rows in the Table of Random Money is 0:
		say "You punch the [noun] and nothing happens.";

PullingMoney is an action applying to nothing.

Carry out PullingMoney:
	choose a random row in the Table of Random Money;
	say "[coin entry] fall to the floor";
	move the "[coin entry]" to the location;
	blank out the whole row.

Table of Random Money
coin	Description
nickels	"Two nickels"
dime	"One dime"
quarters	"Four quarters"

Any advice on how to get that carry out action to recognize the coin as the object to be pulled from the table into the game world?

Your problem is that "[coin entry]" is text, so you want something like move the coin entry to the location instead.

3 Likes

Argh! I’m glad it was a quick solution, but man, I also hate that it was something so small. Thank you!