After the javascript if statement I don't see the continuation

Lerik

From some reason I don't see any text after I click "test"... why?

First Boulder: {rotate firstboulder:earth:fire:water:wind} <br>
Second Boulder: {rotate secondboulder:earth:fire:water:wind} <br>
Third Boulder: {rotate thirdboulder:earth:fire:water:wind} <br>
Fourth Boulder: {rotate fourthboulder:earth:fire:water:wind} <br>

[check]


[check]:
        if (firstboulder == water && secondboulder == earth && thirdboulder == fire && fourtboulder == wind)
        {
        var firstpuzzle=true;
        }
testtest
{if firstpuzzle=true:you solved it.}{else:You didn't solve it.}

thetruespin

You're mixing up Squiffy attributes and Javascript variables. The rotate function asigns a value to a Squiffy attribute. You can't read that attribute with Javascript unless you first convert it to a javascript variable.

You can do so using:

var myjsvariable = squiffy.get("myattribute");

The same applies when you're going the other way too.


Lerik

First off thank you for the reply; I wanna point out that the documentations do a poor job of mentioning this. Maybe I'm missing something but the part in the documentation that mentions "JavaScript" has only one small example and it doesn't show the attribute/javasript combo properly. I had to dig through the forum posts (before and after I posted) and eventually found a single thread that mentioned it a while ago. I was able to get some grounds but I'm still a bit stuck.. I don't see anything after I click "test"

First Boulder: {rotate boulderone:earth:water:fire:wind} <br>
Second Boulder: {rotate bouldertwo:earth:water:fire:wind} <br>
Third Boulder:{rotate boulderthree:earth:water:fire:wind} <br>
Fourth Boulder: {rotate boulderfour:earth:water:fire:wind} <br>

[test]
[test]:
        var a;
        var boulderone = squiffy.set("boulderone",boulderone);
        var boulderone = squiffy.set("bouldertwo",bouldertwo);
        var boulderthree = squiffy.set("boulderone",boulderthree);
        var boulderfour = squiffy.set("boulderone",boulderfour);
        if (boulderone=="earth")
        {
        squiffy.set("a",1);
        }
        else
        {
        squiffy.set("a",2);
        }
blablah
{a}

Lerik

Nevermind, it looks like I typed boulderone twice...so far so good. Thanks!


thetruespin

There are lots of errors in your code. Try:

First Boulder: {rotate boulderone:earth:water:fire:wind} <br>
Second Boulder: {rotate bouldertwo:earth:water:fire:wind} <br>
Third Boulder:{rotate boulderthree:earth:water:fire:wind} <br>
Fourth Boulder: {rotate boulderfour:earth:water:fire:wind} <br>

[test]
[test]:
var a;
var boulder1 = squiffy.get("boulderone");
var boulder2 = squiffy.get("bouldertwo");
var boulder3 = squiffy.get("boulderthree");
var boulder4 = squiffy.get("boulderfour");
if (boulder1 == "earth")
{
squiffy.set("a",1);
}
else
{
squiffy.set("a",2);
}

{a}

blah blah

The above should work. I've also given your Squiffy attributes and JS variables slightly different names to make it less confusing.

Sadly the documentation for Squiffy is quite poor. That said, Squiffy only features very limited scripting through Markdown, so realistically if you want to do anything clever you're going to have to use pure JS anyway. Combined with an understanding of HTML and CSS, you can actually make quite advanced games in Squiffy.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums