Variable addresses don't work!

Bluevoss
14 Feb 2018, 02:41

I haven't downloaded Squiffy in a while and just had to (the computer needed to be fully reloaded). Suddenly I found that the code that was working no longer does. So here's how I'm trying to do this (It worked BEFORE I reloaded)

[[start]]:

@set rRoomName=fred

[[{rRoomName}]]

[[fred]]:

I'm in fred

Now I get a message: WARNING: null line 1: In section 'start' there is a link to a section called [[{rRoomName}]], which doesn't exist

Any ideas how to use variables for paths?


K.V.
14 Feb 2018, 02:44

Hello.

This may help:

http://textadventures.co.uk/forum/squiffy/topic/rscw6a0r7ukfg0zgsu0j2q/variables-in-section-passage-links#c54ab756-8109-49fc-8606-2bfdc5e45c3d


Bluevoss
14 Feb 2018, 02:59

That's close but not the same thing.

In your example, you are simply trying to change the prompt.

In mine, I used the variable to select the section to go to. I used to use this all over to redirect actions depending on situations. Lose a battle with orcs, go to "loseOrcs". Lose to goblins, go to "loseGoblins". It's more than just changing the title of the link. It's changing the link itself.

Here is is combining the two...

[[start]]:

    set("variable","fred")
This is an example game.

[[{variable}]]



[[fred]]:

It works!

This still shows the warning but runs under "RUN". However, it will not run in a brower.


Bluevoss
14 Feb 2018, 03:58

It might be that these just throw warnings yet it seems that it is a problem with Firefox.

I'll repost this with another subject line.


K.V.
14 Feb 2018, 04:36

That last example doesn't throw any errors on my end.

I even added a bit, to try to really heat things up, but it runs smoothly on my Firefox, as do your other examples.

[[start]]:
    var names = ["Fred","Barney","Wilma","Betty"];
    var randInt = Math.floor(Math.random()*4)+0;
    set("variable",names[randInt]);
Click the link!  (It changes randomly.)

[[{variable}]]

[[Fred]]:
    setTimeout(function(){squiffy.story.go("start");},500);
Fred likes Cocoa Pebbles.
    

[[Barney]]:
    setTimeout(function(){squiffy.story.go("start");},500);
Barney likes Fruity Pebbles.

[[Wilma]]:
    setTimeout(function(){squiffy.story.go("start");},500);
Wilma likes fast food.

[[Betty]]:
    setTimeout(function(){squiffy.story.go("start");},500);
Betty likes Barney.

I mentioned my theory concerning your popup blocker on the other thread, but I don't think that's it, seeming how it works when you use "Open with".

Is your Windows 10 machine 64 bit or 32? (I'm just taking wild stabs in the dark now. Mine is 64, though.)


Bluevoss
15 Feb 2018, 00:42

I just checked. Both machine and firefox are running at 64.


loopernow
15 Feb 2018, 02:24

Bluevoss, your original example above (fred-I'm in fred) works for me. Your code is fine. Something seems to be going on with your environment.

I'm on OS X using the Safari browser.


Bluevoss
16 Feb 2018, 02:32

Yeah, I don't know why it was freaking out when I first ran it. I got all sorts of warnings. But one problem seemed to be that I was running in Microsoft Edge (I thought I was in Firefox but Edge was defaulted for htmls). Once I fixed this and got it to run once, all those problems cleared right up.


K.V.
16 Feb 2018, 04:11

I'm glad to hear you got it working.

I never use Edge. I don't know why it doesn't like good games.

It may need to be updated, or you may need to install, activate, or enable a feature.

Or it might just plain not play Squiffy games...


Sky Schemer
16 Mar 2018, 13:42

Edge works just fine, but like I.E. it won't run Javascript present in local files. It has to be content served from a remote web server via HTTP/HTTPS. (Though, at least with I.E., you have the option of enabling the content.)