Glimmr Graphic Hyperlinks
version 1/100805 by Erik Temple
Part 3 - Clicking Graphlink Rules
Current graphlink x is a number that varies.
Current graphlink y is a number that varies.
Current graphlink window is a g-window that varies.
Current graphlink row is a number that varies. [We can refer to this number from within the graphlink processing rules, ensuring that we operate on the same row that was selected in the clicking graphlink rules.]
Candidate replacement command is indexed text that varies. [The candidate replacement command is set in the clicking graphlink rules. If the default graphlink processing rule is fired, this will be converted into the glulx replacement command, to be processed by Glulx Entry Points. We use a "candidate" because if we actually set the replacement command, Glulx Entry Points will automatically paste the command. So we need to save the information in a variable, but only act on it if we hit the default rule.]
The clicking graphlink rules are a rulebook.
To decide whether the click hit a hot link:
repeat through the Table of Graphlink Glulx Replacement Commands in reverse order:
if the current graphlink window is g-win entry:
if the current graphlink x >= p-left entry and the current graphlink x <= p-right entry and the current graphlink y >= p-top entry and the current graphlink y <= p-bottom entry:
now the current graphlink is linkid entry;
now the current graphlink row is the chosen-row;
if there is a replacement entry:
now the candidate replacement command is replacement entry;
now the candidate replacement command is "";
To decide which number is the chosen-row:
(- ct_1 -).