"smart can't go" (auto displaying valid exits)

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

Otto

"smart can't go" (auto displaying valid exits)

Post by Otto »

In inform there is a library for handling "can't go" events, it's called smartcantgo and can display the valid exits when the player type a wrong exit. It's also possible to display in the status bar the directions.

Is there a built in command, or similar libraries in Hugo ?

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

There isn't anything built in, but it wouldn't be overly difficult. In Trading Punches I have a "mode" for the wrist watch that shows available exits. Something like this could be built in pretty easily. Just make the cant_go { } text for every room call the same function. This function would check to see if location.n_to returns false, location.s_to, etc etc. Build/print a result that says "you can't go that way." You could even begin with a sentence explaining why the original direction won't work -- i.e. "A wall is in the way. "; followed up with the available directions.

To make it better, you'd want to add a set of custom properties. Basically, something like "is_north" and "is_south" which you could assign special meaning in each room. Perhaps is_north returns "to the garden" and is_south returns "around a corner to the clerk's office". The result is, this one function could then say "You can go "; n_obj.name; " "; location.is_north; and so forth.

These are the kinds of things that would be pretty cool to see as 3rd party Hugo extensions. I don't think it would be too hard to create a .H file to include, which not only defines the new properties, but also includes the custom cant_go message routine.

In fact, a custom class could even be used. It would be up to the author to simply "inherit" from this custom class, in every room. It would pretty much only need to have the cant_go routine included as a call.

Merk
Posts: 192
Joined: Mon Nov 22, 2004 3:19 pm
Location: Wichita, KS
Contact:

Post by Merk »

I started working on CANTGO.H, then realized it becomes more complicated when room directions print messages and/or perform other verb routines. In other words, if location.n_to does more than just return 0 or another room, then you can't check locatoin.n_to without actually running that property code.

I think CANTGO.H is still do-able, but it'll be a little more complicated than I thought at first. That is, unless you always make sure n_to, s_to, e_to, and so forth are simply properties.

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

Post by Ice Cream Jonsey »

I think there is a cantgo.h already on the Archive. One sec.
the dark and gritty...Ice Cream Jonsey!

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

Post by Ice Cream Jonsey »

Yeah, it's called "cango.h" and it's downloadable through here:

http://ifarchive.jmac.org/indexes/if-ar ... tions.html

Sorry I did not see this earlier. I used this file for Necrotic Drift and it worked really well. It's something I feel I would put in all future games that I made as it really raises the bar in how "professional" your game comes off.
the dark and gritty...Ice Cream Jonsey!

Kent!

Post by Kent! »

The room_base class from environ.hug in the FB selected source package also provides this sort of cant_go functionality. It has the advantage that you can use it in conjunction with dir_to properties that do more (or less) than return a location. The disadvantage is that it lists only those exits it's sure are exits (with the wording "You can at least go..." if there are questionable exits).

Otto

Post by Otto »

Thank you very much for your replies, and for pointing out this page about hugo contributions.
I thought everything was on http://hugonomicon.sourceforge.net . Unfortunately, there is a mysql problem on the website at the moment so I was unable to see it at all.

I'll add some information about hugo on the ifwiki, if you wish you can contribute too : http://www.ifwiki.org/index.php/Hugo

I've started a thread about Hugo on a mailing list dedicated to the localization of IF systems :

http://groups.google.fr/group/rakontoin ... d02f6f7acb

We may try to translate it into Italian and French

Hugella2

Post by Hugella2 »

Thanks for pointing out the problem with the Hugonomicon, Otto! Didn't realize there was a problem.

Otto

Post by Otto »

Are you in charge of this website ? Will you manage to fix the problem with the database ?

Hugella2

Post by Hugella2 »

Otto: yes, that's my ill-conceived vision malfunctioning. However, I'm in the midst of final exams so it may be a week or so before I can really get to fixing the damn thing, BUT I WILL. :)

Post Reply