Why is this hint/goal crashing?

I have multiple hints and goals that all work wonderfully but this one always crashes. I realize the bit below is probably not very helpful.

The closeWhenTrue tag seems to be the issue. I’ve made sure the object name for the closeWhenTrue command is correct along with the reveal tag.

There are 6 hints above this one and they work just fine.

I tried goldenShawl.isWornBy(me) and also goldenShawl.isIn(me) to no avail. I also entered the hint command AFTER the PC is wearing the goldenShawl and the same error crops up.

+ Goal 'How do I talk to the man with the loom? '
    [
        'Say hello. ',
        'Ask about castle. ',
        'Take garment. '
    
    ]

    openWhenRevealed = 'shayLoom'
    closeWhenTrue = goldenShawl.isIn(me)
;

Error output below:

connectWebUI:http://localhost:64215/?TADS_session=55c964d9-030a-e03c-24479b517e1a-9bc1
Runtime error: object value required
-->{obj:Goal}.closeWhen() ../extensions/adv3Lite/hintsys.t, line 164
   {obj:Goal}.updateContents() ../extensions/adv3Lite/hintsys.t, line 354
   topHintMenu.updateContents() ../extensions/adv3Lite/hintsys.t, line 477
   hintManager.showHints() ../extensions/adv3Lite/hintsys.t, line 623
   Hints.execAction({obj:Command}) ../extensions/adv3Lite/actions.t, line 371
   Hints.execCycle({obj:Command}) ../extensions/adv3Lite/action.t, line 1117
   Hints.exec({obj:Command}) ../extensions/adv3Lite/action.t, line 1095
   default1Doer.execAction({obj:Command}) ../extensions/adv3Lite/doer.t, line
415
   default1Doer.exec({obj:Command}) ../extensions/adv3Lite/doer.t, line 384
   {obj:Command}.execDoer([Hints]) ../extensions/adv3Lite/command.t, line 548
   {obj:Command}.execIter([Hints]) ../extensions/adv3Lite/command.t, line 503
   {obj:Command}.exec() ../extensions/adv3Lite/command.t, line 243
   Parser.parse('hint') ../extensions/adv3Lite/remapcmd.t, line 889
   mainCommandLoop() ../extensions/adv3Lite/main.t, line 177
   runGame(true) ../extensions/adv3Lite/main.t, line 118
   gameMain.newGame() ../extensions/adv3Lite/misc.t, line 124
   mainCommon(newGame) ../extensions/adv3Lite/main.t, line 70
   main(['impossibleWeb.t3']) ../extensions/adv3Lite/main.t, line 24
   flexcall(main, ['impossibleWeb.t3'])
/usr/local/Cellar/frobtads/2.0/share/frobtads/tads3/lib/_main.t, line 217
[More]
   _mainCommon(['impossibleWeb.t3'], nil)
[More]
/usr/local/Cellar/frobtads/2.0/share/frobtads/tads3/lib/_main.t, line 122
[More]
   _main(['impossibleWeb.t3'])
[More]
/usr/local/Cellar/frobtads/2.0/share/frobtads/tads3/lib/_main.t, line 31

Any help is appreciated!

1 Like

I hope someone more knowledgeable than me will come along and give a diagnosis, but in the meantime I’d try some of the classic debugging strategies:

  • substitute true and nil for the boolean checks (so, closeWhenTrue = true and = nil, for example), just to see what happens and to narrow down potential sources of errors

  • change the check to the same condition on a different object or a different condition on the same object

  • perform the same check (for example, goldenShawl.isWornBy(me)) in a different context

  • comment out the other hints and/or copy the code for this goal (plus necessary objects) over to a minimal starter game and try it out in isolation

    • if it works, then slowly copy over other bits from your project into this testing environment, until the problem appears again

As you say, it doesn’t seem to be a general problem with the hints mechanism, at least at first glance. If I just add the following lines to the Adv3Lite starter game…

+ me: Player 'you'  
    "You like rings. <.reveal ringWanted>"
;

+ ring: Wearable 'ring'
    "It's a small silver ring. "
;
    
topHintMenu: TopHintMenu 'Hints';

+ HintMenu 'General Hints'; 

++ Goal 'It could be useful to obtain a ring.'
    [
    'The ring is nice. ',
    'You could take it. ',
    'You could wear it. '
    ]
    openWhenRevealed = 'ringWanted'
    closeWhenTrue = ring.isWornBy(me)
;

… then that appears to work as intended. After doing “X ME”, the hint becomes available, and after putting on the ring, the hint is deactivated.

I took a short look at lines 354 and 164ff. in hintsys.t, as referenced in the stack trace, but nothing jumped out at me. When the program checks the goal’s closeWhen property, the gPlayerChar’s methods hasSeen and knowsAbout are called. So maybe if there was something off with gPlayerChar, that could result in your error message; or if there was a problem with the goldenShawl object such that it isn’t found or doesn’t provide the necessary methods. But I don’t know, really.

3 Likes

Ah thank you!

I had a closeWhenAchieved condition mismatched with a boolean value in a completely different goal object.

Thank you for the debugging tips. Solved!

2 Likes