Non-threaded

Forums » Advanced Editor Forum » Read Thread

Get help from the experts on variables, scripts, items, and other scary things.

Bug: Inconsistent Results from Link Restrictions

one year ago

I have a page with links that are displayed depending on variable restrictions. However, the links that are displayed are inconsistent with values of variables.

HOW TO REPRODUCE

Play https://chooseyourstory.com/story/solhaven then select the following choices

  • "Gaard the Riverman"
  • "Disembark"
  • "Go South"
  • "Talk with a riverman"
  • "Farewell"
  • "Go South"
  • "Enter Mother's Ruin Tavern"
  • "Talk with Bozun"
  • "I am looking for something to do"

You are now on a page that shows two links "Accept" and "Decline" however according to the link restrictions two different links should be displayed. Both and Accept and Decline have the link restrictions "%I=0 NOT" set. However, %I=0 and hence the accept/decline links should not be displayed. Pagescript that is executed on this page is

%I:=0
$PAGETEXT:=$PAGETEXT+"DEBUG: %I = "+%I

The output in the page body "DEBUG: %I = 0" confirms that the variable has been set to 0.

If the steps "Talk with a riverman" and "Farewell" are skipped the page works as expected.

Bug: Inconsistent Results from Link Restrictions

one year ago

Pretty much impossible to give you direct help on this without seeing the code, but here's my troubleshooting advice:

-Set the variable "I" (and other relevant variables) to visible on all pages, and click through to story to make sure it's doing what it's supposed to on all pages.

-If that doesn't help, check all the individual link/page scripts in reverse order to make sure they have the right info on them.

-I know that pagescript doesn't work on the page itself, but it should work for the links, so I doubt that's your issue. Still, to check this issue you can temporarily make the code happen on the previous page's link script.

-I'm not familiar with the script format you're using, I have no spaces in mine and the quotes seem out of place. Could this be your issue? Could just be a different format than I'm used to.

Bug: Inconsistent Results from Link Restrictions

one year ago
Thanks for the reply. What I pasted is literally the whole page. The script is working and I confirmed that the variable has the right value after the script has run. At this point I am convinced that this is a bug on the server.

Bug: Inconsistent Results from Link Restrictions

one year ago
It has to do with the order things get loaded in on. The link restrictions are checked before the page script is loaded. I added you as a co-author to a quick test storygame i made to show this in case you wanted to see it behaving isolated. In both cases, X=1 when its displayed on the page, but because of where the variable was assigned, the links presented are different.

Bug: Inconsistent Results from Link Restrictions

one year ago
OK thank you very much! How did I never notice this?!

I fixed it and it is working now.

Bug: Inconsistent Results from Link Restrictions

one year ago
Moved to advanced editor forum since its less a bug and more just the way the editor works.