Clothing bug?

it seems there is a bug involving clothing.

drop hat
(first attempting to take your hat)
You’re already wearing your hat.
remove hat
You’re already wearing your hat.
doff hat
You’re already wearing your hat.

can’t drop something worn because there is first an implicit take.
not sure why the others don’t work


If you could post your code, we might be able to see what happened. In this minimal code:

(current player #player)
(#player is #in #Lab)

(room *)
(name *)The Lab

(name *)	hat
(wearable *)

(#hat is #wornby #player)

I get the following output:

Dialog Interactive Debugger (dgdebug) version 0m/03. Library version 0.46.

The Lab
You are here.

> drop hat
(first attempting to remove the hat)
You take off the hat.

The hat falls to the ground.

If you omit the (wearable *) declaration you get output like @cfmoorz2 describes… maybe that’s the issue?



yes, that was it. i had typed “wearble” then stared at it over and over and never noticed. duh.

BTW - i am brand new to dialog and wasn’t sure about what kind of community was available. very impressed by the rapid and helpful responses.



Purely a guess, but I think the fact as mentioned in the What are Dialog's pros & cons compared to TADS? thread that it’s pretty easy to just pick up and Try a Thing In Dialog makes it easier for people to swoop in and address these kinds of problems, without having first macheted their way through a major project to learn the ropes.


A fun thing is that, if you’re running your game in dgdebug, you’ll get a nice warning about this:

Warning: clothing.dg, line 12: Possible typo: A rule is defined for (wearble $), but this predicate is never queried and has no interface definition.

(And I think the compiler will print the same warning too.)


When I saw this topic, I expected another bug in the library v0.46.

Chapter 4: Items mentions this:

But for this to work, the library must be able to invoke ($ goes underneath $) in a multi-query, with the second parameter unbound. Therefore, be aware that if the second parameter is a trait, it needs to be prefixed by an asterisk:

(#underpants goes underneath *(pants $))
((pants $) goes underneath #trenchcoat)

But the only place where ($ goes underneath $) is used in the library is this,

($Obj recursively goes underneath $Cover)
	($Obj goes underneath $Next)
		($Next = $Cover)
		*($Next recursively goes underneath $Cover)

where it is not invoked in a multi-query, which can be corrected by replacing the query in the library with:

	*($Obj goes underneath $Next)

Or, just define a new ($Obj recursively goes underneath $Cover) predicate with the correct multi-query in your source file, although this way comes with a slight performance hit.