Hyperlink extension woes

I am using Daniel Stelzers INline Hyperlinks…I can see the link…bu nothing happens when I click it. Any ideas? ex is understood to be examine

Parking Lot is a room. "You are in a large flat paved surface that is getting hot in the sun.  Your minivn is already hot and the [link]handle[as]EX HANDLE[end link] is too hot to touch.  Off to the east you can see people lining up for tickets, while off to the south, north and west you see a sea of cars."

Does it work if you spell out EXAMINE in full?

Unless you’ve added it yourself, ex isn’t a valid command. Use x or examine instead.

I have added it myself…and I tried EXAMIINE and it still doesnt register.

Is there something I forgot to add Ive added the includes that were needed…is there something more to the code that I missed I just thought all you needed was the link and stop link

Does manually typing in the EXAMINE HANDLE command work under the circumstances where you’re trying to get the link to work?

The example code from the extension itself doesn’t seem to work, so it seems fairly safe to say that the extension is currently broken. Searching the forums suggests that there was some update to Glulx Entry Points that broke it, and it was never fixed.

Hyperlinks by Dannii Willis does seem to still work, however, although the interface is a bit more clunky.

I haven’t really tried using hyperlinks before myself, though. If you want extensive hyperlinks, perhaps you should look at making a choice-based game instead of a parser game?

2 Likes

Ok, the problem with Inline Hyperlinks appears to specifically be the version of Glulx Entry Points by Emily Short that’s included in the extension github. If you delete that and use the one built-in to Inform 7 6M62 instead then it starts working as expected.

I haven’t looked further into exactly what is breaking it in the github version, or if the differences are needed for some other reason.

Having said that, Inline Hyperlinks isn’t really designed to work with hyperlinks in windows other than the main or status windows, so once you try to do the window layouts suggested in other threads then it may break again for you. Hyperlinks is better in that regard. I might have a play later with building a merged extension just for the fun of it, unless someone beats me to it.


@Dannii It looks like the main problem is that HandleGlkEvent is commented out? As far as I can tell, this means that the handle glk event rule is only called for arrange events and not any others? If I uncomment this then Inline Hyperlinks works again.

4 Likes

It’s been a long time since I’ve looked at any of this sorry.

Just from looking at the code I can’t really see any reason why Inline Hyperlinks wouldn’t work with the latest GEP, as long as you haven’t enabled the Use direct event handling option. Are you sure “the default inline hyperlink handling rule” isn’t running?

Wait, are you using Inline Hyperlinks with Flexible Windows? If so, then Inline Hyperlinks doesn’t create “a glulx hyperlink rule” to hook into the events system. I’m guessing it was written back when Flexible Windows used to have hyperlink stuff built in.

To be honest a new Hyperlinks extension should probably be written. I’m happy to provide some guidance and/or explanations of how I think the Inform 7 Glk ecosystem should work (ie, what I was planning when I started splitting things up), but I don’t have the time right now to make it myself.

1 Like

I am not using Flexible Windows

Are you sure about that? Check the Extensions section in the Index, it may be included by some other extensions (eg. Location Images by Emily Short that we discussed in another thread).

Though FWIW Dannii, the tests that I was doing were just on the example from Inline Hyperlinks and was definitely not using Flexible Windows and did not have that use option enabled.

Not using that either…I can list what Im using and if its being called from somewhere else…let m know

Include Basic Screen Effects by Emily Short.
Include Version 5 of Glulx Text Effects by Emily Short.
Include Locksmith by Emily Short.
Include Skeleton Keys by Emily Short.
Include Glulx Text Effects by Emily Short.
Include Basic Screen Effects by Emily Short.
Include Glulx Image Centering by Emily Short.
Include Multiple Sounds by Massimo Stella.
Include Inline Hyperlinks by Daniel Stelzer.
Include Text Capture by Eric Eve.

I’ve had a stab at this, and actually gotten a near-complete working version of Inline Hyperlinks with the new v10 Glulx Entry Points rulebook, at least for the basic case. (Haven’t done integration with Flexible Windows yet, but that’s next.)

Hit a bit of a stumbling block in the advanced usage, however. One of the examples assumes that you can “say” some text within the hyperlink event handler. However this doesn’t work – in Glulxe you get a fatal error that printing isn’t allowed while line input is active. I haven’t tested other terps but I think some others would just not print anything in that case.

It looks like at some point the event handling was moved from HandleGlkEvent to glk_select; not sure if that’s related or not. (Although this is probably why the current version of Inline Hyperlinks broke, since it’s not running the handle glk event rule any more, which is what handled the command input.)

I can probably work around that for this particular example, but it would be nice if the input could be suspended, it prints things, then the input resumed. The code in Glulx Entry Points cancels the input event but there’s no obvious way to resume it again other than by faking a line input event (which is wrong if it was actually waiting for a character event, and wrong if you didn’t want to actually pretend the player entered something). I also don’t see any obvious way to tell whether a line or char event was requested (Inform should be requesting only one or the other, though); that seems like a hole in Glk.

I have a wild and crazy idea that I might try later. But it is quite crazy.

1 Like

I don’t know what your crazy idea is (but I’m keen to hear it), but my crazy idea with moving event handling to glk_select was to make it easier to convert event types. So you could say now glk event type is char-event; now glk event value 1 is 49; to turn a hyperlink event into a keypress event with the value of the ‘1’ key. Similarly the buffer of a line input event could be filled out, though that’s more complex. I also had ideas about a hyperlink extension which would use the memory address of a string/function as the hyperlink code to more easily determine what should be done when a hyperlink is received.

Printing during line input is always going to be tricky. You’re right that more should be provided by these extensions to support it. As to detecting which type of event was waiting, glk_cancel_line_event will tell you whether line input was active if you pass an event struct. But it might be better for an extension just to intercept calls to the input requests and track them that way.

Yes, that was the crazy idea.

My I6 is a bit rusty (haven’t used it for more than tiny things in… over a decade, probably), but I think this does the trick.

Have a look and let me know what you think. (I’ve left it as a draft for easy code review and further fiddling before merging it.)

It’s mostly a merge of Inline Hyperlinks with a couple of other Hyperlinks extensions, and then getting the whole to work with the changes to glk_select, then splitting it apart into separate extensions again for modularity.

1 Like

Not sure if I should announce it anywhere else, but I’ve merged the Inline Hyperlinks extension (and related) to master now. Intended to do it a while back but was distracted by something shiny.

People not interested in hyperlinks specifically, might be interested that one of the components lets you suspend and resume input events (allowing debugging output during input event processing, among other things), and inject arbitrary commands as player input.

2 Likes