"Nothing is closed" when trying to exit a closed c

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

Juhana
Posts: 7
Joined: Wed Oct 16, 2013 2:50 am

"Nothing is closed" when trying to exit a closed c

Post by Juhana »

Hey everyone,

I'm trying my hand at Hugo and I already found a default response I don't quite understand.

The code is this (based on shell.hug):

Code: Select all

#include "verblib.g"
#include "hugolib.h"

routine init
{
    prompt = ">"
    player = you
    location = yard

    move player to location
    FindLight(location)
    DescribePlace(location)
    location is visited
    CalculateHolding(player)
}

routine main
{
    PrintStatusLine
    run location.each_turn
    runevents
    RunScripts
    if parent(speaking)~=location
        speaking = 0
}

player_character you "you"
{
}

room yard "Mansion Courtyard"
{
}

object car "car"
{
    nouns "car"
    in yard
    is container, enterable, openable, not open
}
Example transcript:
Mansion Courtyard
Car is here.

>enter car
Car is closed.

>open car
Opened.

>enter car
You get into car.

Mansion Courtyard, in car

>close car
Closed.

>out
Nothing is closed.
Where did the "Nothing is closed" come from? Does the game think I'm trying to exit the "nothing" object? Is the code missing something?

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

Post by Roody_Yogurt »

Ok, I tracked it down to DoExit. DoExit wasn't setting the "object" global before calling VMessage(&DoLookIn,1):

Code: Select all

replace DoExit
{
	local p

#ifclear NO_OBJLIB
	! >GO OUT winds up calling DoExit with object = out_obj, thanks to
	! the direction-parsing code in Perform().  English ambiguities being
	! what they are, we correct that interpretation of "out" here, and
	! treat the command as a generic instruction to exit whatever
	! container context we may be in.
	if object = out_obj
		object = nothing

	if object = nothing or object = location
	{
		if player in location and out_obj in direction
		{
			word[1] = out_obj.noun
			word[2] = ""
			return Perform(&DoGo)
		}
	}
	elseif object = d_obj and player in location
	{
		return Perform(&DoGo, object)
	}
#endif

	p = parent(player)

#ifclear NO_OBJLIB
	if object and player not in object
#else
	if object and player not in object
#endif
		VMessage(&DoExit, 1)             ! "You aren't in that."
	elseif p is openable, not open
	{
		object = p
		VMessage(&DoLookIn, 1)           ! "X is closed."
	}
	else
	{
		if object = nothing
			object = p
		move player to location
		if not object.after
			VMessage(&DoExit, 2)     ! "You get out.."
	}
	return true
}

Juhana
Posts: 7
Joined: Wed Oct 16, 2013 2:50 am

Post by Juhana »

Thanks for the quick fix, good to know I wasn't completely off!

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

Post by Roody_Yogurt »

The Hugo library is impressive for being written by one guy, but despite the games released over the years, it still hasn't gotten all of the testing that it needs. As you can see, we are still finding things like that.

Anyhow, you said on the ifMUD that you are enjoying some aspects of Hugo. I'd be curious to know what things you like!

Juhana
Posts: 7
Joined: Wed Oct 16, 2013 2:50 am

Post by Juhana »

Yeah, it's understandable that all the bugs haven't been found yet. Inform has a several magnitudes larger user base and Standard Library bugs are still popping up from time to time.

I haven't gotten very far yet, but so far it looks like Hugo has succeeded in being feature-complete but not forcing a specific world model (which is what I found a little bit problematic with TADS).

Compared to Inform I like that you can modify the internals more freely like with the DoExit thing here. In Inform (especially 7) a lot of stuff is hardcoded in the compiler/interpreter or otherwise inaccessible. You can also see that the virtual machine is free of historical baggage (no need to maintain backward compatibility to Infocom story files) and therefore seems to be more straightforward.

Compiler options are a bonus, I like the C-like compiler directives you can use to add variations to the source files. I'm using Grunt to automatize the build process and this works nicely together with it.

Some downsides: I'm used to more modern high-level languages so it takes a while to get used to pointers and resource limits and fiddling with arrays manually. The language's age is starting to show. As a personal hurdle some things are the complete opposite to what I'm used to (mainly in JavaScript/HTML: "return false" stops an event, in Hugo "return true" stops action processing; properties are boolean values and attributes more complex values in HTML).

Oh, and the manual is really good. People are always talking about how DM4 is the best thing ever, but the Hugo Book is definitely at par or even better, especially the technical part.

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

Post by Roody_Yogurt »

Juhana wrote:Compared to Inform I like that you can modify the internals more freely like with the DoExit thing here. In Inform (especially 7) a lot of stuff is hardcoded in the compiler/interpreter or otherwise inaccessible. You can also see that the virtual machine is free of historical baggage (no need to maintain backward compatibility to Infocom story files) and therefore seems to be more straightforward.
To be honest, when I used Inform 6, I didn't completely understand the point of replacing routines (and not altering one's standard library files), but then again, I barely understood what I was working with. I appreciate Hugo for forcing me to understand the benefit of such a system, and luckily, for the most part, it's fairly transparent.
Juhana wrote:Compiler options are a bonus, I like the C-like compiler directives you can use to add variations to the source files. I'm using Grunt to automatize the build process and this works nicely together with it.
Yeah, I like how can set up a game so I can compile a Roodylib-enhanced or non-Roodylib-enhanced version pretty easily. I've also taken advantage of Hugo's usage of environment variables, as I've found that Windows applications can get confused by long path names (and I do a fair amount of compiling from the desktop).

Juhana wrote:Oh, and the manual is really good. People are always talking about how DM4 is the best thing ever, but the Hugo Book is definitely at par or even better, especially the technical part.
The DM4's strongest asset is the fact that the first section gets you really excited to write IF, but that doesn't necessarily make the language any easier to learn. You're right that the Hugo Book does a great job.


Anyhow, it's great that you're taking a look at Hugo. At some point, you should talk to Kent about Hugo's future. I mean, he has some ideas already, but I'm sure he'd appreciate your insight.

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

Post by Ice Cream Jonsey »

Juhana, if you would like an account on my Linode server, just let me know.
the dark and gritty...Ice Cream Jonsey!

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

Post by Roody_Yogurt »

Ok, so Robb made a linode account for Juhana. Now, both of you guys are probably more familiar with setting stuff up than I am, but I thought I'd share my .profile file (I forget if it is created automatically but it goes in the home directory):

Code: Select all

# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
	. "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
#if [ -d "$HOME/bin" ] ; then
#    PATH="$HOME/bin:$PATH"
#fi
#PATH=$PATH:$HOME/bin
#PATH="home/roody/bin:$PATH"
export PATH=~/bin:$PATH
export HUGO_LIB="$HOME/hugolib"
That last line sets the HUGO_LIB environment variable so I can keep my library files in one place and not have to copy them to every project.

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

Post by Roody_Yogurt »

I ended up adding the DoExit fix and a couple other things and uploaded a new version of Roodylib today:
http://hugo.gerynarsabode.org/index.php?title=Roodylib

Post Reply