"smart can't go" (auto displaying valid exits)
Moderators: Ice Cream Jonsey, joltcountry
"smart can't go" (auto displaying valid exits)
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 ?
Is there a built in command, or similar libraries in Hugo ?
-
- Posts: 192
- Joined: Mon Nov 22, 2004 3:19 pm
- Location: Wichita, KS
- Contact:
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.
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.
-
- Posts: 192
- Joined: Mon Nov 22, 2004 3:19 pm
- Location: Wichita, KS
- Contact:
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.
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.
- Ice Cream Jonsey
- Posts: 30193
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
- Ice Cream Jonsey
- Posts: 30193
- Joined: Sat Apr 27, 2002 2:44 pm
- Location: Colorado
- Contact:
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.
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!
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).
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
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