(assuming you mean)

This is a discussion / support forum for the Hugo programming language by Kent Tessman. Hugo is a powerful programming language for making text games / interactive fiction with multimedia support.

Hugo download links: https://www.generalcoffee.com/hugo
Roody Yogurt's Hugo Blog: https://notdeadhugo.blogspot.com
The Hugor interpreter by RealNC: http://ifwiki.org/index.php/Hugor

Moderators: Ice Cream Jonsey, joltcountry

User avatar
Ice Cream Jonsey
Posts: 25243
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

(assuming you mean)

Post by Ice Cream Jonsey »

I have a situation where:

First move of the game is open the cabinet
Second move of the game is to get a shirt out of that cabinet

When the player types
>give it to soandso

Hugo insists that I mean the first thing, the cabinet. I can't believe I have never had this issue before, it's got to be because it's the start of the game?

I have tried assigning object and xobject to the shirt after it is taken. I just do not get it.

Do you guys know how Hugo comes to the determination that the object I mean is a piece of scenery that was not the last thing referenced?
the dark and gritty...Ice Cream Jonsey!

User avatar
Ice Cream Jonsey
Posts: 25243
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Re: (assuming you mean)

Post by Ice Cream Jonsey »

I solved it by giving the jumpsuit a pronoun of "it" but still Weird.
the dark and gritty...Ice Cream Jonsey!

User avatar
Tdarcos
Posts: 7648
Joined: Fri May 16, 2008 9:25 am
Location: Arlington, Virginia
Contact:

Re: (assuming you mean)

Post by Tdarcos »

Ice Cream Jonsey wrote: Sun Sep 01, 2019 5:12 pm When the player types
>give it to soandso

Hugo insists that I mean the first thing, the cabinet. I can't believe I have never had this issue before, it's got to be because it's the start of the game?

Do you guys know how Hugo comes to the determination that the object I mean is a piece of scenery that was not the last thing referenced?
I did a search of hugolib / verblib / objlib to find and examine the "take" verb which redirects to "get". And I found what's missing in your case. You need to give the cabinet the attribute "static", which is something the player can't take. Try putting "is static" in the definition of the cabinet (and possibly the drawer, if that is an additional object). I suspect this will fix your problem, as then the only item in the room the player legally can take is the shirt.
"Perhaps she'll understand, if you tell it to her, plain."
- Don McLean, Castles in the Air

User avatar
Ice Cream Jonsey
Posts: 25243
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Re: (assuming you mean)

Post by Ice Cream Jonsey »

Thanks, pal. I'll give that a shot.
the dark and gritty...Ice Cream Jonsey!

Roody_Yogurt
Posts: 2079
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Re: (assuming you mean)

Post by Roody_Yogurt »

Roodylib actually has something for this. It's mentioned in the Roodylib "docs" in the Pronouns section under SetPronoun. Ideally, it's a routine you can replace with pronoun-setting rules, but Roodylib doesn't actually make such rules because I'm not sure any set of rules would apply to every game.

Like, in my game "the Halloween Horror":
>PUT POPCORN IN MICROWAVE
You put the popcorn in the microwave.

>CLOSE IT
You would want the "it" obect set to the microwave, right? But imagine some kind of Zork Zero cauldron.
>PUT THING IN CAULDRON
You throw the thing into the cauldron.

>EXAMINE IT
The cauldron bubbles with greater intensity now.
In this instance, it makes more sense that "it" refers to the cauldron, right? Maybe the distinction has something to do with openable-vs-non-openable containers, but I imagine it's just as likely to be best addressed on a case-by-case manner.

To help with the rule-making, Roodylib keeps track of some additional globals that remember the last turn: last_verbroutine, last_object, and last_xobject (actually, I think I made these globals for something else but it helps out here, too). So between that and verbroutine, object, and xobject, you should be able to make some rules you are happy with.

In your instance, maybe something like this?
replace SetPronouns
{
if it_obj = last_xobject
{
if not ((verbroutine = &DoClose, &DoOpen) and not xobject) or (verbroutine = &DoPutIn and object = xobject )
{
object = last_object
AssignPronoun(last_object)
}
}
}
This system hasn't gotten a lot of testing so I'm not 100% sure this won't break something. I'll definitely take a closer look at all of this as I get back into Roodylib stuff.

Roody_Yogurt
Posts: 2079
Joined: Mon Apr 29, 2002 6:23 pm
Location: Milwaukee

Re: (assuming you mean)

Post by Roody_Yogurt »

So, for days, I've been meaning to add some more pronoun-fixing code to Roodylib. Last night, I finally got around to putting together a test game to reacquaint myself with how things currently work before I go "fixing" things.

I was only able to replicate this issue with hugolib without roodylib (and funnily enough, if one UNDOs and then tries the same command again, it gets it right the second time). Pronoun-handling in Hugo's standard library always was a little slapdash. Without remembering the specifics of everything I did, I know I tried to make things a little more consistent in Roodylib. In Roodylib, it seems it almost always applies the "it" object to the object, which seems to work for the most part.

I think I might add some code to Parse which checks the context (like whether the verb is something like "open"/"close") and chooses the "it" object based what fits, but other than that, I guess I'm already pretty happy with Roodylib's behavior. If anyone has any thoughts, feel free to share.

Post Reply