ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Object name returned as "nothing"

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.

Object name returned as "nothing"

Postby ElliotM » Wed Feb 10, 2016 2:58 am

I was experimenting with a way to change the name of a location during play and ran into a bug where an object's name is returned as "nothing" if it is at the end of a dot operator sequence.

Nothing Bug.taf
(14.71 KiB) Downloaded 41 times

I gave locations an object property named Primary Feature which had the key Primfeat, and then in group Everywhere I checked the Short Location Description box and added the line of code below to the Short Location Description to override the normal short name.
adrift Code: Select all
%PCase[%Player%.Location.Primfeat.Name]%


When you run the test file, you will see that the name of the location has become "Nothing", showing that while the Everywhere group is overriding the short name like I wanted it to do, I'm not getting the object name as the new location name. In the Custom Statusbar I have some bug testing code that shows that while you can get the key, adding .Name after the key won't get you the object name.
adrift Code: Select all
Primary Feature Key is "%Player%.Location.Primfeat" and the Name is "%Player%.Location.Primfeat.Name"
ElliotM
 
Posts: 1183
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Object name returned as "nothing"

Postby ElliotM » Wed Feb 10, 2016 4:42 am

Curious if anyone else has run into situation where the dot operator falls short of replacing itself to the correct reference like how .Name failed in this case. A work around would be to just use the object key with "%Player%.Location.Primfeat" and a Text Override to replace the object key but that isn't the solution that I had hoped would work.
ElliotM
 
Posts: 1183
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Object name returned as "nothing"

Postby saabie » Wed Feb 10, 2016 5:21 am

Yes, that's definitely a bug with the item functions.
Even if we use the key of the location (Test) directly, and print the function in a general task to simplify everything:
Test.Primfeat returns the key "Lab"
Lab.Name returns the name of the object "the testing lab"
but Test.Primfeat.Name does not work.
Also Test.Primfeat.Noun does not work at all, it just prints itself as if it's not recognised as a valid function.
saabie
 
Posts: 827
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Object name returned as "nothing"

Postby ElliotM » Wed Feb 10, 2016 5:54 am

Thanks for having a look, Saabie. Has this one already been submitted to the bug tracker? I want to say that this sounds like something that has already been reported on but can't seem to find one that is similar.
ElliotM
 
Posts: 1183
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Object name returned as "nothing"

Postby saabie » Wed Feb 10, 2016 7:29 am

I can't find it either, go ahead and add a new one.
saabie
 
Posts: 827
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Object name returned as "nothing"

Postby ElliotM » Wed Feb 10, 2016 7:55 am

Here is the bug link: http://www.adrift.co/bug/19076
ElliotM
 
Posts: 1183
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Object name returned as "nothing"

Postby saabie » Wed Feb 10, 2016 11:32 pm

WORKAROUND
Create a user function called ObjName that has an Object reference called "object" and which contains "%object%.Name".
Use this functio whenever you want to get the name of an object returned by an object property:
%ObjName[%Player%.Location.Primfeat]%
saabie
 
Posts: 827
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Object name returned as "nothing"

Postby ElliotM » Thu Feb 11, 2016 1:57 am

Thanks! That is pretty useful and way easier than doing one Text Override per object.
ElliotM
 
Posts: 1183
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Object name returned as "nothing"

Postby Campbell » Thu Mar 31, 2016 9:03 pm

This will be fixed in the next release.
ADRIFT Developer developer.
User avatar
Campbell
Site Admin
 
Posts: 4569
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland

Re: Object name returned as "nothing"

Postby ElliotM » Thu Mar 31, 2016 11:05 pm

Awesome, thanks Campbell.
ElliotM
 
Posts: 1183
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 1 guest