Door pushing/pulling

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

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

Door pushing/pulling

Post by Roody_Yogurt »

The other day, I noticed that in a game compiled with USE_VERBSTUB, when it comes to doors, >PUSH always means >OPEN DOOR and >PULL always means >CLOSE DOOR. Of course, hinged doors in real life have 'interior' and 'exterior' sides, depending on which way they swing. Now, I don't consider myself a "simulationist", but this seems like an easy enough thing to fix. Here is the new code:

Code: Select all

#ifset VERBSTUBS
	before
	{
		object DoPush
		{
			if location = self.between
				return Perform(&DoOpen, self)
			else
				return Perform(&DoClose, self)
		}
		object DoPull
		{
			if location = self.between
				return Perform(&DoClose, self)
			else
				return Perform(&DoOpen, self)
		}
	}
#endif
In the above code, between #1 is always the exterior side and between #2 is always the interior side.

Anyhow, I thought I'd share that. I haven't thought of ways to simplify/represent it further, but people are welcome to try.

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

Re: Door pushing/pulling

Post by Tdarcos »

Roody_Yogurt wrote:Of course, hinged doors in real life have 'interior' and 'exterior' sides, depending on which way they swing.
And then there are swinging doors that you can push either way, as well as revolving doors (hint, hint) that you can only push. About the only place I see swinging doors are in commercial restaurants and in the kitchens of some older houses as an easier way to allow people in and out of the kitchen where it had doors on it. (Most places today do not put a door on the kitchen.)

But I think your pointing out that doors have specific directions is an excellent addition. Have you ever looked at the Half Life series of games; when you go through a door, it always opens either toward the player or away from them? So the way the door is open depends on which side you were standing in front of it when you activated it. And I think Portal does the same thing when you escape into the back of the Enrichment Center.
"I really feel that I'm losin' my best friend
I can't believe this could be the end."
- No Doubt, Don't Speak

Post Reply