Solving two issues in the Standard Libary (v.5.0.35.3)

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.
Post Reply
User avatar
Denk
Posts: 587
Joined: Mon Feb 22, 2016 6:21 pm
Points: 251
Location: Hjørring, Denmark

Solving two issues in the Standard Libary (v.5.0.35.3)

Post by Denk »

I have been looking into two issues in the standard library:

Problem 1:
PUT object IN POUCH. If the object is already in the pouch, we get (First removing 'object' from the pouch') "You put the 'object' in the pouch."
It would be better just to say that the object is already in the pouch.

Problem 2:
If we type TAKE OBJECT we get "You are already carrying the 'object'" if it is inside a container you are carrying.
It would be better if it took the object out of the container you are carrying.

Solution to problem 1:
PouchProblem1.taf
(15.54 KiB) Downloaded 40 times
The fix was done by changing the restrictions in the tasks "Remove before put" and "Put objects in others".

First take a look at the restrictions in "Remove before put":
The two last restrictions are new:
[Referenced Objects must not be inside Referenced Object 2] AND
[Referenced Objects must not be on Referenced Object 2]

Note that because there were some OR's between some of the restrictions, it was necessary to add parentheses around the original set of restrictions. Also note that the message field in these two new restrictions must be empty.

Now take a look at the restrictions in "Put objects in others":
The only change here is that I have added the following restriction:
[Referenced Objects must not be inside Referenced Object 2]

Please note the restriction message.

Finally, go to the "Advanced" pane in the "Put objects in others"-task. Here the field "If task fails and input references 'all', display this..." is empty. Copy this text into this field: You have nothing to put in %object2%.Name.

Solution to problem 2:
File "PouchProblem2.taf" EDIT: Removed because this file had a bug. Please use "PouchProblem2 version2.taf" two posts below, where the bug has been fixed.
The problem is this ADRIFT restriction:
[Referenced Objects][must not][be held by][The Player Character]

If you are holding a container with an object inside, the object inside is also treated as if it is held by the Player Character.

To fix this it was necessary to create a new property: TakeFix

TakeFix is a property of all items and it is an Integer. Leave it undefined for all locations, objects and characters except for the player character. It should be one for the player character.

Also, open the Standard Libary task "Take Objects (Parent Task)" and find the restriction: [Referenced Objects][must not][be held by][The Player Character]

Change this restriction to an expression restriction and copy this into the expression field: %objects%.Parent.Takefix=0
EDIT: This restriction is wrong. The restriction should be: %objects%.Parent.Takefix.Sum=0

Now, only if you carrying the object directly (i.e. not holding any containers with it), you will get the message "You are already carrying the coin".

If something is not clear, just ask.
Attachments
PouchProblem2.taf
(15.57 KiB) Downloaded 44 times
Last edited by Denk on Thu Oct 01, 2020 10:37 am, edited 2 times in total.
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
rovarsson
Posts: 94
Joined: Mon Dec 23, 2019 10:37 pm
Points: 15
Location: Belgium

Re: Solving two issues in the Standard Libary (v.5.0.35.3)

Post by rovarsson »

Good work Denk! Thanks.

I had semi-solved 'Remove before put' by adding [Referenced Objects must not be inside Referenced Object 2]. It works for what I need, but I knew from the beginning it 's a superficial patch. Your solution is more in-depth and thorough. I'll implement it next time I open TT.

I worked around TAKE 'object' when 'object' is in a container being carried by making it a worn container and prohibiting the player from taking it off. This makes Adrift switch to TAKE 'object' FROM 'container'. This too is a superficial patch. Even with a good reason, it's annoying to the player. (Not to mention to me.) As before, your solution is more thorough. Thanks.
User avatar
Denk
Posts: 587
Joined: Mon Feb 22, 2016 6:21 pm
Points: 251
Location: Hjørring, Denmark

Re: Solving two issues in the Standard Libary (v.5.0.35.3)

Post by Denk »

Unfortunately, it turns out that in some situations ADRIFT gives an error if you apply my solution to problem 2 above. For instance, if you are wearing a bag with an object (e.g. a hammer) and there is another object on the ground (e.g. a chisel) then if you type:

GET HAMMER AND CHISEL

You will get an error if you are using my fix shown above.

to avoid this problem, change the restriction:

%objects%.Parent.Takefix=0

to:

%objects%.Parent.Takefix.Sum=0

Then everything works as it should. Fixed version below:
Attachments
PouchProblem2 version2.taf
(15.61 KiB) Downloaded 5 times
----------------------------------------------------------------------
The Bash Saga:
1. The Dragon Diamond 2. The Way Home 3. Stone of Wisdom
----------------------------------------------------------------------
Post Reply