Move all items in the inventory to another place.

Hi all,

I’m trying to setup a playable dream sequence in a game I’m writing and need to remove all items from the player’s inventory while he/she’s asleep.

So far I’ve setup to storage rooms (RealStore and DreamStore) to store inventories from the respective worlds. I’ve modified the sleep rules and time rules but I cannot for the life of me work out how to move the player’s inventory to the temporary stores and recover them when the player wakes up/falls asleep.

Any ideas???

You generally do this kind of thing with a repeat:

repeat with X running through things carried by the player begin;
now X is in DreamStore; 
end repeat;

Alternatively (and this is likely to make your life easier in a number of other ways, down the line), you can switch viewpoints between different people, and have a dream character already set up in the dreamworld:

now the player is dream self;

and switch back with

now the player is yourself;

That avoids the need to inventory-shuffle things, and may make it easier to remember to distinguish between dreamworld and real world in the rest of your code. But it’s ultimately an aesthetic distinction.

That’s awesome!

I didn’t know you could set up different viewpoint characters. That will save a whole lot of time remembering which bed the player fell asleep in.

Thanks :slight_smile:

repeat with X running through things carried by the player begin;
	now X is in DreamStore; 
	end repeat;

Or, shorter:

Now all things carried by the player are in the DreamStore.