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 » Sat Sep 03, 2016 10:59 am

Hi all,

Can somebody please help?

I want to check that the player is only carrying ONE object, so I assumed the expression would be %Player%.Held.Count = 1, but when I run the task with the debugger open, and the PC is only carrying one object, the debugger tells me that the restriction has failed.

Can somebody please tell me where I am going wrong, it's driving me nuts! :x

Many thanks.
OUT NOW: Run, Bronwynn, Run!
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 and The Lost Children
User avatar
Lazzah
Moderator
 
Posts: 2113
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England
Points: 17

Re: Help with expressions

Postby ice_wanted » Sat Sep 03, 2016 1:17 pm

Hi Lazzah,
The expression works, I've tested it in a custom task (v5.0.34).
ice_wanted
 
Posts: 87
Joined: Thu Aug 22, 2013 1:12 am
Points: 10

Re: Help with expressions

Postby Lazzah » Sat Sep 03, 2016 1:48 pm

I have just worked out why the expression is failing:

The one object I am carrying is a CONTAINER and if there are any objects in the container ADRIFT will count those as being "held" as well. Why does Campbell make life so bloody awkward for us, the restriction REFERENCED OBJECT MUST BE HELD BY THE PLAYER CHARACTER does this as well.

Does anyone know of a way around this??????
OUT NOW: Run, Bronwynn, Run!
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 and The Lost Children
User avatar
Lazzah
Moderator
 
Posts: 2113
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England
Points: 17

Re: Help with expressions

Postby ice_wanted » Sat Sep 03, 2016 4:02 pm

Hi Lazzah,
I'm brainstorming here...but it should work. You could create a "selection only" object.property. Create a new object group and add that property to the group definition so that all object inside inherit this property. Add all your "heldable" objects inside the group. Then add a filter in your expression to count only object that have the object.property. Something like this: %Player%.Held.[property_id].Count=1.
Cheers.
ice_wanted
 
Posts: 87
Joined: Thu Aug 22, 2013 1:12 am
Points: 10

Re: Help with expressions

Postby saabie » Sun Sep 04, 2016 1:06 am

From the wiki:
This function has one parameter which can be either true or false.
* If this is set to true or omitted (ie. %character%.Held(true) or %character%.Held ), then this function will return a complete list of everything in the characters inventory, including objects that are inside of other objects.
* If the parameter is set to false (ie. %character%.Held(false) ), then only those objects directly held by the character will be listed and anything contained inside those objects will be ignored.

So %Player%.Held(False).Count = 1 should work.
saabie
 
Posts: 901
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia
Points: 10

Re: Help with expressions

Postby Lazzah » Sun Sep 04, 2016 7:39 am

saabie wrote:From the wiki:
This function has one parameter which can be either true or false.
* If this is set to true or omitted (ie. %character%.Held(true) or %character%.Held ), then this function will return a complete list of everything in the characters inventory, including objects that are inside of other objects.
* If the parameter is set to false (ie. %character%.Held(false) ), then only those objects directly held by the character will be listed and anything contained inside those objects will be ignored.

So %Player%.Held(False).Count = 1 should work.

Thanks saabie, that did the trick.
OUT NOW: Run, Bronwynn, Run!
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 and The Lost Children
User avatar
Lazzah
Moderator
 
Posts: 2113
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England
Points: 17


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 4 guests