Using Emily Short’s basic hyperlinks extension, I can do stuff like list the available topics of conversation, and have every topic be a hyperlink that inserts the command ‘ask soandso about topic’. The problem is that Glulx seems to only support setting a link using an id number; therefore, I would need to create a table that assigned a unique id to every imaginable combination of soandso and topic; and then I would need to figure out that id when listing the topics.
Any ideas how I might build the text of the replacement command at runtime, while listing topics?
Define the number of “ask NPC about TOPIC” as 1000*(npc number) + (topic number).
Another method is:
Get an upper bound on the number of NPC/topic combinations you’ll need.
Create a table with one column being indexed text.
Whenever you have to print a link, look through the table to see if the entry is already there.
3a) If the entry is, select the number of the corresponding row.
3b) If the entry isn’t, add a new entry with the corresponding text, and select the number of the new row.
But I think I’ll go with Erik Temple’s extension. If I can make mine work with his method of declaring links, I think it would be perfect, as the circular buffer avoids having to store and traverse a huge list of commands.
Al right, I’ve got a solution that uses the syntax of Erik Temple’s extension, but doesn’t have to traverse a list of commands every time it says a link (Which could happen dozens of times outputting the result of a single command). It has it’s own limitation: If the table isn’t large enough, links at the top of the window will be overwritten by links generated at the bottom. You need a large table, however, it will still be smaller than a list of every command that could possibly be typed that Erik Temple’s extension is likely to produce.
I should point out that I plan on blanketing the entire game in this to make it easily playable on touch screen devices like the ipad. The conversation stuff was just the first part I encountered where writing the commands out in the code wasn’t feasible.