ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Help with expressions

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Help with expressions

Postby Lazzah » Wed Apr 12, 2017 11:00 am

Hi all,

I want to list only the dynamic objects present in a location when I type LOOK ON CRATE (where the top of the crate is a location).

As I am a total dunce at these new expressions, etc, I would be very grateful if one of the more knowledgeable Drifters could come to my rescue and tell me the expression I need to use.

Many thanks in anticipation.
OUT NOW: The Lost Children
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire
User avatar
Lazzah
Moderator
 
Posts: 2016
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Help with expressions

Postby saabie » Thu Apr 13, 2017 12:35 am

If you mean the objects ON the crate, then you can't put a static object ON something else so you can either use:
%ListObjectsOn[%object%]%
Which prints: "On the crate are the pistol and the red book", or:
%object%.Children(Objects,On).List
which only prints the object names: "The pistol and the red book"

If you want to print the dyamic objects in a location, excluding static objects that have "Specifically list object in location descriptions" ticked, then you can filter the list like this:
%location%.Objects.StaticOrDynamic(Dynamic).List
saabie
 
Posts: 834
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Help with expressions

Postby Lazzah » Thu Apr 13, 2017 4:15 pm

Thanks for your help, saabie! :claps: :yeah: :bravo: :Thanks:
OUT NOW: The Lost Children
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire
User avatar
Lazzah
Moderator
 
Posts: 2016
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Help with expressions

Postby Lazzah » Sat Apr 22, 2017 9:23 am

saabie wrote:If you mean the objects ON the crate, then you can't put a static object ON something else.

I know, but if the top of the crate is a location there can be - and are - static objects at that location.

saabie wrote:If you want to print the dyamic objects in a location, excluding static objects that have "Specifically list object in location descriptions" ticked, then you can filter the list like this:
%location%.Objects.StaticOrDynamic(Dynamic).List

With the old functions, for example %ListObjectsAtLocation[key]%, you would type the key of the location where it says [key]. How do you do this with these new functions, they are double-dutch to an old git like me!

Thanks!

:Thanks:
OUT NOW: The Lost Children
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire
User avatar
Lazzah
Moderator
 
Posts: 2016
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Help with expressions

Postby saabie » Sat Apr 22, 2017 12:17 pm

The key always goes in the same place as the %location% reference.
With the new item functions it will always be first:
Key.Objects.List
Will get all of the objects in the location with the key "Key", and then List them.

Key.Objects.StaticOrDynamic(Dynamic).List
does the same thing, but this time we check the "StaticOrDynamic" property, of each object at the location, is set to the state "Dynamic", and only those are passed on to "List" to be printed.
saabie
 
Posts: 834
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Help with expressions

Postby Lazzah » Sat Apr 22, 2017 2:42 pm

Hi saabie,

I have entered the completion message for the LOOK THROUGH HOLE task as: On the floor of the tunnel you see HalfwayAlo.%location%.Objects.StaticOrDynamic(Dynamic).List. However, when I enter the command LOOK THROUGH HOLE when testing the game - and there is a dynamic object in the referenced location - the message is displayed exactly as above!

What have I done wrong???????? :?
OUT NOW: The Lost Children
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire
User avatar
Lazzah
Moderator
 
Posts: 2016
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Help with expressions

Postby saabie » Sun Apr 23, 2017 12:30 am

%location% is a task reference to a location entered by the player, and is replaced with the key of that location before the rest of the function is executed.
You can't have BOTH a location key and a location reference in the same function. Either one or the other.

HalfwayAlo.Objects.StaticOrDynamic(Dynamic).List will list the dynamic objects at the location with the key HalfwayAlo

%location%.Objects.StaticOrDynamic(Dynamic).List will list the dynamic objects at the location that the player entered into a command with a %location% reference.
saabie
 
Posts: 834
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Help with expressions

Postby Lazzah » Sun Apr 23, 2017 5:38 am

Hi saabie,

OK, I've now got that and it works. As ever, thanks for your help. :Thanks: :claps: :bravo: :yeah:
OUT NOW: The Lost Children
Current W.I.P.: Magnetic Moon
Also available: The Axe of Kolt, The Spectre of Castle Coris, The Fortress of Fear, Die Feuerfaust - The Fist of Fire
User avatar
Lazzah
Moderator
 
Posts: 2016
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 2 guests

cron