Doors, directions, etc.

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: 30184
Joined: Sat Apr 27, 2002 2:44 pm
Location: Colorado
Contact:

Doors, directions, etc.

Post by Ice Cream Jonsey »

Not that I am trying to get anyone to do my dirty work for me, but this is one of those things that I think I have just plain forgotten: is there an easy way to get the following to happen:

Code: Select all

You are in a room. There is a door to the north. 

>north
(Opening the door first)

North Room. 
You are in the north room. There is a door to the south.
Basically, the bit I am concerned with is the whole "go north" and then have the door (which is perfectly accessible through normal door means) routines kick in. This is probably a ridiculously easy effect to get, right? I am having no luck figuring out just how to do it.
the dark and gritty...Ice Cream Jonsey!

Kent

Wait

Post by Kent »

Doesn't the basic door class in objlib.h do what you want?

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

Re: Wait

Post by Ice Cream Jonsey »

Kent wrote:Doesn't the basic door class in objlib.h do what you want?
I took a look at that, and by all rights it definitely should. I basically have a room setup like this:

Code: Select all

LightRoom Store "Store"
{
   long_desc
   {
     "Blah blah. There is a door to the south"
   }

s_to
 {

Perform(&DoGo,BackOffice_door)
 }
}

And I have the door setup like this:

Code: Select all

door BO_Hall1_door
{
	nouns "door" "hall" "office"
	adjective "hall" "back" 
	article "the"
	between Store, BackOffice		
	is static, not open, not locked

}

When playing through the game, if I type ">south" in the Store room there I get an out of memory error.

I should come completely correct: in the real code that I am using, I do have some Before routines in the door itself to give a custom message for opening said door which I have not included here. My next step is to rip those out and see what happens. But the whole &Perform DoGo thing ought to punch over to the door and run through it's ">enter door" routine, correct?

I have a feeling this is going to embarassing when I realize what I overlooked or did wrong. If I slink out of this thread with a gimmick handle, you'll know it's me.
the dark and gritty...Ice Cream Jonsey!

Kent

Here's what it may be

Post by Kent »

Try:

Code: Select all

s_to
     return YourDoorHere.door_to
in your room direction and see where it gets you. I think by explicitly calling Perform(&DoGo) you're probably entering a recursive spiral. The door class's door_to property handles messages, opening and closing, and returning a valid room (if applicable), assuming you've set the 'between' property for the door up right.

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

Re: Here's what it may be

Post by Ice Cream Jonsey »

Kent wrote:Try:

Code: Select all

s_to
     return YourDoorHere.door_to
in your room direction and see where it gets you. I think by explicitly calling Perform(&DoGo) you're probably entering a recursive spiral. The door class's door_to property handles messages, opening and closing, and returning a valid room (if applicable), assuming you've set the 'between' property for the door up right.

Just plugged it in -- worked like a charm & was magically delicious. Thanks!
the dark and gritty...Ice Cream Jonsey!

Post Reply