alt_title property
(Also, hey, look, I found a better way to share code)
option amusement_option "For Your Amusement/Words To Try"
{
in main_menu
alt_title "For Your Amusement"
menu_text
{
"Have you ever:\n"
"\_ ...opened the grating from beneath while the leaves were still
on it?"
"\_ ...tried swearing at ZORK I?"
"\_ ...waved the sceptre while standing on the rainbow?"
"\_ ...tried anything nasty with the bodies in Hades?"
"\_ ...burned the black book?"
"\_ ...damaged the painting?"
"\_ ...lit the candles with the torch?"
"\_ ...read the matchbook?"
"\_ ...tried to take yourself (or the Thief, Troll, or Cyclops)?"
"\_ ...tried cutting things with the knife or sword?"
"\_ ...poured water on something burning?"
"\_ ...said WAIT or SCORE while dead (as a spirit)?\n"
! "\nPress any key for more..."
! pause
CoolPause(1)
CenterTitle("Words To Try")
"Words you may not have tried:\n"
"\_ HELLO (to Troll, Thief, Cyclops)"
"\_ ZORK"
"\_ OIL (lubricate)"
"\_ XYZZY"
"\_ WALK AROUND (in forest or outside house)"
"\_ PLUGH"
"\_ FIND (especially with house, hands, teeth, me)"
"\_ CHOMP (or BARF)"
"\_ COUNT (candles, leaves, matches, blessings)"
"\_ WIN"
"\_ MUMBLE (or SIGH)"
"\_ LISTEN (especially to the Troll, Thief, or Cyclops)"
"\_ REPENT"
"\_ WHAT IS (grue, zorkmid, ...)"
"\_ YELL (or SCREAM)"
"\_ SMELL\n"
CoolPause(1)
}
}
So, the name of the object represents how the choice will be listed in the menu itself, and the alt_title property is how the page is titled when you are reading it (if you don't provide an alt_title property, it just uses the link name).
TopPageMargin routine
Right now, TopPageMargin defaults to returning 2 so page text automatically starts 2 lines down from the top. If your menu page text already does its own carriage returns for proper spacing, you can always replace TopPageMargin to return 0.
Glk menus
Other thoughts
Looking at the code again, I was reminded how newmenu is currently a mix of array and object hierarchy design. Given that I've done much more object-hierarchy organized design since I initially wrote newmenu, I started wondering, hmm, maybe I should just switch newmenu to doing everything by object hierarchy.
After thinking about it, my initial conclusion was that all of the necessary object-organization routines would complicate things more than necessary, and the end result would probably be more memory-intensive than the existing system so I've given up on that idea for now. Still, it seems like it might be possible to design something that only rearranges itself as necessary and largely works without writing values to anything.
I'll probably get back to this as some point when I have something else I really should be doing instead.
No comments:
Post a Comment