Page 1 of 1

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

Posted: Thu Nov 24, 2005 4:10 pm
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 ?

Posted: Thu Nov 24, 2005 7:49 pm
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.

Posted: Thu Nov 24, 2005 8:33 pm
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.

Posted: Thu Nov 24, 2005 9:38 pm
by Ice Cream Jonsey
I think there is a cantgo.h already on the Archive. One sec.

Posted: Thu Nov 24, 2005 9:41 pm
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.

Posted: Fri Nov 25, 2005 11:51 am
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).

Posted: Fri Nov 25, 2005 12:43 pm
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

Posted: Sun Nov 27, 2005 4:26 pm
by Hugella2
Thanks for pointing out the problem with the Hugonomicon, Otto! Didn't realize there was a problem.

Posted: Tue Nov 29, 2005 4:00 pm
by Otto
Are you in charge of this website ? Will you manage to fix the problem with the database ?

Posted: Tue Nov 29, 2005 8:07 pm
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. :)