Giter Site home page Giter Site logo

Comments (8)

EvanBalster avatar EvanBalster commented on June 20, 2024

Here is a version of the now-broken extension with a few debug printouts. These merely serve to demonstrate that the Inform 7 mechanisms of Inline Hyperlinks are working as expected.

Inline Hyperlinks.txt

from extensions.

EvanBalster avatar EvanBalster commented on June 20, 2024

By injecting printouts into the "handle glk event rule" I have zeroed in on these lines in Glulx Entry Points as the point where processing of the hyperlink seems to stop:

	if the outcome of the rulebook is the replace player input outcome:
		decide on GEP internal input replacement;
	if the outcome of the rulebook is the require input to continue outcome:
		decide on GEP internal input continuation;

The original:

	if the outcome of the rulebook is the replace player input outcome:
		decide on input replacement;
	if the outcome of the rulebook is the require input to continue outcome:
		decide on input continuation;

EDIT: I seem to have confirmed that the outcome of the handle glk rulebook is not a success with either version.

from extensions.

EvanBalster avatar EvanBalster commented on June 20, 2024

Upon further inspection, it appears that the "the handle glk event rule" is never invoked by the latest version of the extension, because the HandleGlkEvent which previously called it was replaced by a new handler in Danni Willis' Glk Events.

By extension, the following lines are never run:

follow the input-cancelling rules;
follow the command-showing rules;
follow the command-pasting rules;

This apparently breaks Glulx Entry Points' ability to inject or replace player commands. I'm inclined to call this a bug in Glulx Entry Points.

from extensions.

curiousdannii avatar curiousdannii commented on June 20, 2024

It's very possible there are a ton of bugs - the state of affairs for hyperlinks in I7 is really poor. Sorry. I'm not sure if I'll have the time to look into this any time soon.

There are other hyperlink extensions. I'm not sure which is the most up to date.

from extensions.

EvanBalster avatar EvanBalster commented on June 20, 2024

It seems like repairing the "glulx replacement command" function in Glulx Entry Points might do a lot for the hyperlink situation. :)

I'm tinkering to see if I can work out how to restore functionality to the Handle Glk Event Rule. There are two problems with this:

  • Both the Handle Glk Event Rule and the Glk Events extensions invoke the glulx input handling rules. They should probably operate on different rulebooks to avoid , but using a new rulebook in GEP would break compatibility with existing extensions (ie, broken extensions would stay broken until updated).
  • I'm not sure how to replicate the return value from HandleGlkEvent with Glk Events. I think its only effect is to either end or continue the current turn.

As a compromise on the first issue, I've implemented a small addition to GEP that patches the two handlers together and restores the command-pasting part of the hyperlinks feature:

GEP internal recursion flag is a number that varies.  GEP internal recursion flag is initially 0.

A glulx input handling rule (this is the glulx input shim rule):
	If GEP internal recursion flag is 1:
		make no decision;
	say "(IH0)";
	Now GEP internal recursion flag is 1;
	Let handler result be the value returned by glk event handling;
	Now GEP internal recursion flag is 0;
	Rule fails.
	
The glulx input shim rule is listed first in the glulx input handling rules.

...But I'm still trying to figure out how I can respect the handler result and actually submit the pasted command.

from extensions.

EvanBalster avatar EvanBalster commented on June 20, 2024

Here's a rather crude modification that restores the broken functionality without introducing a new rulebook. With these changes Inline Hyperlinks works again, although there are probably other better ways to fix things.

Glulx Entry Points.txt

My changes are purely additions:

GEP internal recursion flag is a number that varies.  GEP internal recursion flag is initially 0.

Stashed glk result is a number that varies.  Stashed glk result is initially 0.

A glulx input handling rule (this is the glulx input shim rule):
	If GEP internal recursion flag is 1:
		make no decision;
	Now GEP internal recursion flag is 1;
	Now stashed glk result is the value returned by glk event handling;
	Now GEP internal recursion flag is 0;
	Rule succeeds.
	
The glulx input shim rule is listed first in the glulx input handling rules.

To decide what number is the value returned by glk event result recalling (this is the unstash glk event rule):
	decide on stashed glk result.
Include (- 

  [ HandleGlkEvent ev context abortres newcmd cmdlen i ;
      for (i=0:i<3:i++) evGlobal-->i = ev-->i;
      (+ library input context +) = context;
      return (+ value returned by glk event result recalling +) ;
  ];

-) before "Glulx.i6t".

Essentially what we're doing here is intercepting Glk Events' invocation of the input handling rules so we can dispatch Glulx Entry Points' own with additional logic... collecting the result... and later returning that result from HandleGlkEvent (which allows us to submit commands).

from extensions.

uecasm avatar uecasm commented on June 20, 2024

The command-replacement functionality in Glulx Entry Points is broken. Use this extension instead.

from extensions.

EvanBalster avatar EvanBalster commented on June 20, 2024

The command-replacement functionality in Glulx Entry Points is broken. Use this extension instead.

Thanks, I'll give that a try! That said, I think I've worked out how to repair Glulx Entry Points and I'll be making a PR shortly.

I notice far more extensions rely on Glulx Entry Points than rely directly on Glk Input Handling... But I think there's a (tidy, robust) way to fix GEP without breaking compatibility with anything.

from extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.