sensory desc text can't use <<first time>> tags (adv3Lite)

There is a pineapple in the room. The object’s smellDesc property is defined as…

smellDesc = 'The <<first time>>fresh <<only>>scent of pineapple <<first time>>unexpectedly <<only>>fills the air. <.p>';

But when I sniff in the room, the <> text is never displayed. When put a breakpoint on the smellDesc, I see that the text is always processed twice before any text is output to the game window, thereby guaranteeing that the text that is finally displayed can never be the first time text.

This happens with smellDesc defined as either a single or double quoted string (the documentation says it should be double quoted).

It also happens with listenDesc.

Here’s a transcript…

…from this code…

[code]#charset “us-ascii”

#include <tads.h>
#include “advlite.h”

versionInfo: GameID
IFID = ‘445C38A3-AD1B-4729-957A-F584600DE5C1’
name = ‘test’
byline = ‘by Jerry Ford’
htmlByline = ‘by
Jerry Ford

version = ‘1’
authorEmail = ‘Jerry Ford jerry.o.ford@gmail.com
desc = ‘Testing sensory detection.’
htmlDesc = ‘Testing sensory detection.’

;

gameMain: GameMainDef
initialPlayerChar = me
paraBrksBtwnSubcontents = nil

;

me: Actor ‘me’ @room
“The main man.<.p>”
isHim = true

person = 2

;
room: Room ‘room’
“In the room.<.p>”

;

  • pineapple: Thing ‘pineapple;fruit’
    “A pineapple. <.p>”

    smellDesc = ‘The <>fresh <>scent of pineapple <>unexpectedly <>fills the air. <.p>’;
    ;[/code]

You could work around it using a <> xxx <> yyy <> zzz<> construction – presumably you’d see “yyy” the first time – but it does seem that the library code is going astray here.

That’s close, but not quite right. If I define the smellDesc as…

 smellDesc = '<<one of>>aaa<<or>>bbb<<or>>ccc<<stopping>> <.p>';

…I get this…

The aaa text does not get used. To make it work correctly, I need to alternate between empty values and legitimate strings…

smellDesc = '<<one of>><<or>>aaa<<or>><<or>>bbb<<or>>ccc<<stopping>> <.p>';

The property text is parsed twice, then used; twice then used, and so on (until the end of the list, when the last value is then used continually—StopEventList behavior)…

[/quote]
Actually, I solved it by explicitly defining StopEventList, which appears to be the same thing as <><>>.

[code]+ pineapple: Thing ‘pineapple;fruit’
“A pineapple. <.p>”

smellDesc
{
    pineappleOdorText.doScript();
}
    //'<<one of>><<or>>aaa<<or>><<or>>bbb<<or>>ccc<<stopping>> <.p>';

;

pineappleOdorText: StopEventList
[
’ ',
‘aaa’,
‘’,
‘bbb’,
‘ccc’
]
;

[/code]

However, this demonstrates its own peculiarity. Note the first string in the list—it’s a space, not an empty string. If I make it an empty string, I get the library-default You smell nothing out of the ordinary. for the first sniff, then it starts using the event list.

What makes this last bit even more peculiar is that I need the space in my test-bed environment (quoted here) but in the actual game in which this problem first arose, I use an empty string, not a space, and I get the results I want.

Also, the <> construction does not need a space to make it work.

Jerry

Try the following fix (which seems to work with a quick test) and let me know if you run into any problems with it.

Put the following modification in your game code:

modify Thing
   checkDisplay(prop)
    {        
        return propType(prop) != TypeNil;
    }
;

So far, at least, it seems to be working. I’ve tried it with each of the different ways I encountered the problem previously (<>, <> and doScript()). Thanks.

Jerry