Help me get my GRILL on

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
Jizaboz
Posts: 3204
Joined: Tue Jan 31, 2012 2:00 pm
Location: USA
Contact:

Help me get my GRILL on

Post by Jizaboz »

I was messing with this for about half an hour again tonight after a long break, and it's still driving me nuts. I can't take the meat. I can't see the meat once on the grill at all. Note that the burned phase works just fine. I can ruin the meat, but I can't remove it before it's ruined haha

Code:

Code: Select all

!----------------------------------------------------------------------------
! Pit
!----------------------------------------------------------------------------

room pit " By the Fire Pit"
{
	s_to {currentpicture = "barbwire"
        return muddy_dirt
	}
	long_desc
	{
	if self is not visited
		{
			indent (true)
			"This fire is always at least smouldering so long as everyone finds brush and waste in the perimeter to keep it going. This is where everyone comes to cook anything they can't cook elsewhere. It's rare you see anyone out here cooking anything though, as food as very scarce and when anyone gets good food they cook it however they can closer to their house so others won't bother them."
		}
		currentpicture = "firepit"
		indent (true)
		"You are standing in front of a fire pit of cinder blocks with a makeshift grill composed of some metal grating and wire. There is no one else here at the moment."
	}
	each_turn
	if GameEvents[12] = 1
				{
					select RoomTurnCount
						case 3 : 
					{"The meat is smelling really good and making your stomach growl loudly."
						move meat to pit
					}
						case 5 : "You smell burnt meat. There wasn't much of it to begin with, so you discard the charred remains into the fire."
						move meat to cage
				}
}

scenery firepit "firepit"
{
	nouns "firepit" "grill" "fire" "pit"
	in pit
	is platform
	is container
	holding 0
	capacity 2
	article "the"
	long_desc
		{
		"The fire blazes along. There's a makeshift grill in one corner of it you can place things on to cook."
		}
		
		
		before {
                xobject DoPutIn {
                        if object ~= carcass
                                "You have no desire to try to cook that."
                        else
						{
							indent(true)
						     "You place the meat on what looks like the cleanest part of the grill."
						return false
						}
			}
				}
        after
        {
                xobject DoPutIn ! since the only thing that works is the carcass
                {
					"You hear a sizzling sound."
					GameEvents[12] = 1
					remove carcass
                }
        }
}

scenery cinderblock "cinderblock"
{
	nouns "cinderblock" "block"
	in pit
	article "the"
	long_desc
		{
		"The fire blazes along. There's a makeshift grill in one corner of it you can place things on to cook."
		}	     
}

Behavior in game:

Code: Select all

By the Fire Pit
  
  This fire is always at least smouldering so long as everyone finds brush and waste in the perimeter to keep it going. This is where 
everyone comes to cook anything they can't cook elsewhere. It's rare you see anyone out here cooking anything though, as food as 
very scarce and when anyone gets good food they cook it however they can closer to their house so others won't bother them.

  You are standing in front of a fire pit of cinder blocks with a makeshift grill composed of some metal grating and wire. There is no one 
else here at the moment.

>put carcass on grill

  You place the meat on what looks like the cleanest part of the grill.
You hear a sizzling sound.

>look at grill
The fire blazes along. There's a makeshift grill in one corner of it you can place things on to cook.

>wait
Time passes...
The meat is smelling really good and making your stomach growl loudly.

>take meat
You haven't seen anything like that.

>take carcass
You don't see that.

>SHIT
You don't need to use the word "shit."


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

Re: Help me get my GRILL on

Post by Roody_Yogurt »

The short answer is, you have to give the meat the known attribute or else Hugo doesn't know the player knows about it yet.

I re-coded the example just to verify (I changed a few things to not rely on some of your defined things):

Code: Select all

player_character you "you"
{
}

object carcass "carcass"
{
	article "a"
	noun "carcass"
	in you
	long_desc
		"Mmmm, carcass."
	size 1
}

object meat "cooked meat"
{
	article "some"
	adjective "cooked"
	noun "meat"
	long_desc
		"Mmmm, cooked meat."
	before
	{
		object DoGet
		{
			Deactivate(cook_daemon)
			return false
		}
	}
}

room STARTLOCATION "By the Fire Pit"
{
	e_to test_room
	initial_desc
		"This fire is always at least smouldering so long as everyone finds brush
		and waste in the perimeter to keep it going. This is where everyone comes
		to cook anything they can't cook elsewhere. It's rare you see anyone out
		here cooking anything though, as food as very scarce and when anyone gets
		good food they cook it however they can closer to their house so others
		won't bother them."
	long_desc
		"You are standing in front of a fire pit of cinder blocks with a
		makeshift grill composed of some metal grating and wire. There is no one
		else here at the moment."
	before
	{
		location MovePlayer
		{
			if cook_daemon is active
			{
				"Not while the carcass is cooking!"
				return true
			}
			return false
		}
	}
}

room test_room "Test Room"
	{
		long_desc
			"Just testing MovePlayer here."
		w_to STARTLOCATION

	}
daemon cook_daemon
{
	timer 0
}

event cook_daemon
{
	self.timer++
	select self.timer
		case 3
		{
			Indent(true)
			"The meat is smelling really good and making your stomach
			growl loudly."
			move meat to firepit
			meat is known
		}
		case 5
		{
			Indent(true)
			"You smell burnt meat. There wasn't much of it to begin
			with, so you discard the charred remains into the fire."
			remove meat
			event_flag = true
			Deactivate(cook_daemon)
		}
}

scenery firepit "firepit"
{
	nouns "firepit" "grill" "fire" "pit"
	in STARTLOCATION
	is platform
	is container
	holding 0
	capacity 2
	article "the"
	long_desc
		"The fire blazes along. There's a makeshift grill in one corner of it
		you can place things on to cook."
	before
	{
		xobject DoPutIn
		{
			if object ~= carcass
				"You have no desire to try to cook that."
			else
			{
				"You place the meat on what looks like the cleanest part of the
				grill."
				Activate(cook_daemon)
				return false
			}
		}
	}
	after
	{
		xobject DoPutIn ! since the only thing that works is the carcass
		{

			"\nYou hear a sizzling sound."
			remove carcass
		}
	}
}

scenery cinderblock "cinderblock"
{
	nouns "cinderblock" "block"
	in STARTLOCATION
	article "the"
	long_desc
		"The fire blazes along. There's a makeshift grill in one corner of it you
		can place things on to cook."
}

User avatar
Jizaboz
Posts: 3204
Joined: Tue Jan 31, 2012 2:00 pm
Location: USA
Contact:

Re: Help me get my GRILL on

Post by Jizaboz »

I knew Roody would come to the rescue. Thank you man! I'll try this out soon. Your code makes sense, but I never would have figured out the known attribute thing by myself.

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

Re: Help me get my GRILL on

Post by Tdarcos »

By the way, I believe the manual says you're not supposed to give an object both PLATFORM and CONTAINER attributes at the same time as they are conflicrting. I think for a grill you'd want only attribute platform.
"Perhaps she'll understand, if you tell it to her, plain."
- Don McLean, Castles in the Air

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

Re: Help me get my GRILL on

Post by Roody_Yogurt »

It's true that normally, if you want something to act as both a container and platform (like a standalone safe that you can also set things on), you'd want to use Kent Tessman's "supercontainer" addition as Hugo has no built-in support for keeping track of which objects are on the object and which are inside. In some cases, like this one, you might use both "container" and "platform" just to help with player commands (as it will accept both >PUT CARCASS IN PIT and >PUT CARCASS ON GRILL).

User avatar
Jizaboz
Posts: 3204
Joined: Tue Jan 31, 2012 2:00 pm
Location: USA
Contact:

Re: Help me get my GRILL on

Post by Jizaboz »

I meant to mention a few days ago I'm glad you handled attempting just walking away from the grill as well. Already moved onto adding status change per eating. Thanks again!

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

Re: Help me get my GRILL on

Post by Tdarcos »

Wasn't there a movie about that? A woman whose grill was stolen: How Stella Got Her Grill Back.
"Perhaps she'll understand, if you tell it to her, plain."
- Don McLean, Castles in the Air

User avatar
pinback
Posts: 15868
Joined: Sat Apr 27, 2002 3:00 pm
Contact:

Re: Help me get my GRILL on

Post by pinback »

In the yard, not too far from the car.

Post Reply