Pulling items from another room

The player is in the Loan Office. Ganon will deposit into a Vault and withdraw things from it for the player. I can deposit easily enough, say, DEPOSIT ARMOR

Depositing is an action applying to one carried thing.
Understand "deposit [something preferably held]" as depositing.

Carry out depositing in Loan Office: 
	say "Ganon says, 'We will take very good care of your [noun].[line break] "; 
	move noun to Vault;
	say "Ganon leaves but returns shortly. He says, 'Your item is now stocked and locked. It will be available whenever you want it.' [line break]"; 

The player is not in the Vault but this works. It takes the noun from the player and puts it into the Vault.
However, I want to move it from the Vault back to the player, and the parser can’t see it (it’s not in the room), even if I place Vault in scope..
I also tried to make use of the standard removing [things inside] from [something] rule. I don’t think my WITHDRAW ARMOR command even made it that far.
I get the “I don’t see that here.” parser error.

I even went so far as to search through all the things in the Vault.

Withdrawing is an action applying to one thing.
Understand "withdraw [something]" as withdrawing.

Carry out withdrawing in Loan Office: 
	say "Ganon leaves but returns shortly with [noun]. 'Here you go,' he says.[line break]"; 
	let L be the list of things in the Vault;
	repeat with Item running through L:
		if Item is noun:
			try removing Item from Vault;
			say "You add the [noun] to your inventory.";
			break;

Does someone know how to retrieve my item from the Vault?

I can’t test right now, but off the top of my head I would run a check rule to make sure the item is in the vault then use the move command to get the item here, as I believe that’s a god-mode command that doesn’t care about things like scope.

Move the noun to the player.

The now command would also work.

How are you formulating your “after deciding the scope of the player” rule?

You can also confirm the location of the noun via a showme [something] command.

1 Like

The following worked for me:

Withdrawing is an action applying to one thing.
Understand "withdraw [any thing]" as withdrawing.

The can't reach inside rooms rule does nothing when the current action is withdrawing.

Check an actor withdrawing:
	if the noun is not in the Vault:
		say "You can't withdraw that!" instead.

Carry out withdrawing:
	now the player carries the noun.

Report withdrawing:
	say "You withdrew [the noun]."
1 Like

I think you want to instead place the contents of Vault in scope, but not 100% sure on that. Not sure that’s even valid syntax actually.

I wouldn’t reuse the removing action – just manually move the item to the player.

Check withdrawing something (called it):
	if it is not in the vault:
		say "You haven't deposited that." instead;

Carry out withdrawing something (called it):
	say "Ganon returns with [the it] etc etc";
	now the player carries it.

I can’t get that far.

WITHDRAW ARMOR
yields the error. Parser doesn’t see the armor,
so MOVE rule never gets triggered.

I am forcing the Vault as the first search scope with

Does the player mean withdrawing something contained in Vault:
	it is very likely.

I have used the SHOWME command to verify that the armor is indeed in the Vault.

Great! I think this is the scope rule I wanted.
I’ll give a try and let you know.
Thx.

EDIT: Nope. Again, I get the I don’t see that here error.
I can’t get the WITHDRAW command to trigger.

applying to one thing means one touchable thing. The [something] token means an object in scope. The full details of scope are complicated, but this short description covers most of the territory:

  • directions are always in scope
  • if the player can see a thing (i.e., there’s light and it and the player aren’t on opposite sides of any closed opaque containers), it’s in scope
  • even if it’s dark, these are always in scope: the player, things enclosed by the player that aren’t also enclosed by a closed opaque container, and, if the player is on or in a thing, the thing they’re on or in.

If you want to allow the player to refer to things out of sight, there are basically two approaches:

  • use an after deciding the scope of the player rule to place it in scope manually under the appropriate circumstances
  • define the action is applying to a visible thing and use any in the grammar token (yes, to allow interaction with something that isn’t visible, you specify visible thing)

If you use applying to one visible thing in the action specification and [any thing] as the grammar token, there’s really nothing stopping its use with any thing in the game, on-stage or off. This is great for debugging actions but for everything else you probably want to qualify the token with an adjective.

Assuming the player will never actually visit the Vault, it doesn’t really need to exist, so I just made a deposited either-or property on things for that adjective instead of creating a deposited adjective by making a definition that checked whether a thing was enclosed by the Vault.

We want to be able to respond to attempts to withdraw things that aren’t in the vault, but [any deposited thing] wouldn’t match them, so I just made a separate invalid-withdrawing action for that case.

The Loan Office is a room.
Ganon is a person in the Loan Office.
Ganon wears a cravat.

A thing can be deposited.

The player holds the crackerjack box.
The toy surprise is in the crackerjack box.
The bees are a plural-named thing in the Loan Office.

Depositing is an action applying to one carried thing.
understand "deposit [thing]" as depositing.

carry out depositing:
now the noun is deposited;
repeat with t running through things enclosed by the noun begin;
  now t is deposited;
end repeat;
now the noun is nowhere;

report depositing:
say "Ganon says, 'We will take very good care of your [noun].[line break]";
say "Ganon leaves but returns shortly. He says, '[The noun] [are] now stocked and locked. [They] will be available whenever you want [them].'";

Withdrawing is an action applying to one visible thing.
Understand "withdraw [any deposited thing]" as withdrawing.

Invalid-withdrawing is an action applying to one thing.
Understand "withdraw [something]" as invalid-withdrawing.
Check invalid-withdrawing: instead say "[We] [haven't] deposited [the noun].".

Carry out withdrawing:
now the noun is not deposited;
repeat with t running through things enclosed by the noun begin;
  now t is not deposited;
end repeat;
now the player carries the noun;

Report withdrawing: say "Ganon returns with [the noun] and [we] [take] [regarding the noun][them] from him."

test me with "deposit cravat / deposit bees / deposit crackerjack box / withdraw toy / withdraw bees / withdraw Ganon"

As written, this assumes that Ganon knows and can access the contents of any deposited containers. If you wanted him to not “know about” the contents of closed opaque containers and/or to be unable to access the contents of locked containers, some other stuff would be needed.

2 Likes

I’m getting some strange things here.
> WITHDRAW ARMOR
gives me the I can’t see that here. error.
If I say
> SHOWME ARMOR
I get Which do you mean, 1 leather armor or the Armor showcase?
Now the Armor showcase is not even here! It is a different room. I check back
and there is no “Understand” statement that equates the ARMOR with ARMOR SHOWCASE.
(The 1 leather armor was in the player’s inventory and is now in the Vault.)

Perhaps a clue is that ARMOR is a kind of thing. Perhaps the kind classification is muddying the waters?
Since everything the player carries is an instance of a kind, I must use
> WITHDRAW (kind of thing)
And yet that worked great for
> DEPOSIT ARMOR
I tried using other things in the player’s inventory for depositing and then withdrawing, and I get the same can’t-see-it error.

Unless I misunderstand, the goal is to manipulate something in another room (not visible and not touchable). This is not permitted in the most common cases, so some tweaks may be needed.

I would adjust the scope and conditionally disable the “can’t reach into rooms” rule. It’s good to be very specific when doing this kind of thing, because weird things can happen if we don’t keep the scope narrow.

Note that you can bypass both visibility and accessibility by using a before rule, which probably sounds like a good deal, but if this were my own code I would go the scoping route.

emporium is a room.
vault is a room.

the bauble is in the vault.

withdrawing is an action applying to one thing.
understand "withdraw [something]" as withdrawing.

after deciding the scope of the player:
	if withdrawing, place the contents of the vault in scope;
	
the can't reach inside rooms rule does nothing when withdrawing a thing held by the vault.

I had most of that already, but what really did the trick was this: I changed put Vault into scope with put the contents of Vault into scope.
Here is my working code

Withdrawing is an action applying to one visible thing.
Understand "withdraw [thing]" as withdrawing.

[To force items from the Vault.]
Does the player mean withdrawing something contained in Vault:
	it is very likely.
The can't reach inside rooms rule does nothing when the current action is withdrawing.

After deciding the scope of the player when location is Loan Office:
	place the contents of the Vault in scope;

Carry out withdrawing in Loan Office: 
	say "Ganon leaves but returns shortly with [noun]. 'Here you go,' he says.[line break]"; 
	now the player carries noun;
	say "You add the [noun] to your inventory.";

I’ve edited it slightly to remove distraction code.
Weirdly, if I remove the “one visible thing” to “one thing”, I get the error message
> WITHDRAW ARMOR
The Vault isn’t open.

Now I need to get WITHDRAW working for multiple things, like 20 arrows. :smiley:

Is the vault a room or a container? I think the “The Vault isn’t open” is a failed attempt to reach into a closed container, not a room (someone chime in if I’m wrong!)

Does the player mean is not used to determine scope. It’s for disambiguation when multiple objects match. You need an After deciding the scope of the player rule.

Is using any really necessary? Can’t you do something like this?

Withdrawing is an action applying to one visible thing
Understand "withdraw [something]" as withdrawing.
After deciding the scope of the player while withdrawing: place the contents of the Vault in scope.

If I’m not mistaken, this should also mean you don’t need to care about the reaching inside rule, as that’s used to determine whether you can touch something.

I think this is correct. My solution did not need the Vault to be in scope because I used “any thing” in the grammar. I stopped the reaching inside rule because I didn’t change the action definition to “visible thing”.

If you change the definition to visible thing, and use “any thing” you don’t need to stop the reaching inside rule, and you don’t need the contents of the Vault to be in scope. If you use “thing” or “something” in the grammar, you need the contents of the Vault in scope. That’s what my quick test revealed, anyway.

Edit: I should point out that using “any thing” really means ANY THING, including scenery. So, you’d need to add check rules to prevent withdrawing things that shouldn’t be carried around by the player.

Edit 2: Curiously, it did that when the grammar token used “something”.

As I said, there are two main approaches. One can use any and not manually place things in scope like I did, or one can use, e.g., something and manually place things in scope like you did.

But, yes, visible thing’s effect of ensuring that the action won’t ever be stopped by the basic acessibility or carrying requirements rules can be useful for both cases.

Good tips here from all.
I don’t want to put the world in scope because there are armors (and other items) all over the world. I want to specifically withdraw the items that are only in the Vault, which is a container and scenery in Ganon’s Office (the Loan Office).All seven banking transactions are conducted (and enforced) only in the Loan Office.

If the vault is a scenery container in the Loan Office, its contents (other than anything enclosed by an opaque container) will already be in scope when the player is in the Loan Office. They’d also be visible (though unmentioned by look). They’d also be touchable (other than anything enclosed by a closed container). If a spoon were in the vault, the player would be able to x spoon or take spoon.

But if a thing is in the player’s location, it’s surprisingly hard to try to avoid all the situations by which the game might inadvertently reveal that. You make your life easier by just not having it there.

The Vault is a closed container (opaque by default?). The Vault is mentioned by LOOK, so your comment makes my problem even more mysterious. It wasn’t working that way.

The armor, being in a closed container, was not in sight (as expected), thus the
I don’t see that here. error. The WITHDRAW command was never triggered.

Ah. You see, I assumed the Vault was an inaccessible room serving as a place to put things so they’re not in play, but really not not in play. The can’t reach inside rooms rule has no effect on a closed container in the player’s location.