Location query

Please forgive me my beginner’s question.

How do I query a location? What I tried is this:

Testroom: Room ‘Testroom’
“Testroom room description”
;

DefineIAction(Help)
execAction(){
if(me.location==Testroom){
“Message for Testroom.”;
return;
}
“Message for any other room.”;
return;
}
;
VerbRule(Help)
‘help’ | ‘hints’
: HelpAction
verbPhrase = ‘help’
;

Thanks!

That should do the trick.

2 Likes

It did. Thank you very much!

Take a look at thing.t in the adv3 library. It has several methods to check the current location. isIn() is only one of them and checks if the object is directly or indirectly in the given location. There’s also isDirectlyIn(), isNominallyIn() and isInFixedIn().

2 Likes

I note that InFixedIn() looks being an useful one; this can solve some cases of a little consistency problem I felt (if one put back an object in a drawer, the appropriate description should revert to the initial, unmoved, description, keeping the moved state), basically, in pseudocode:

if item is moved and infixedin(originalplace) then
description = initialdescription
/*and, much more intriguing: */
npcUnawareofIndiscretion = true

Interesting… but who has the time of reading from A to Z the entire library reference ? I openly encourage the other Nelson to extend the mapping of the periplus also to adv3…

Best regards from Italy,
dott. Piergiorgio.

4 Likes

It’s on my to-do list! I also plan to include above information in the TADS Cookbook.

– Jim

1 Like