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

4 Likes

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)


#Lab
(room *)
(name *)The Lab


#hat
(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.
2 Likes

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

4 Likes

sigh.

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.

thx!

8 Likes

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.

3 Likes

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.)

4 Likes

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)
	(or)
		*($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.

1 Like