So, I have a story in which the order you visit pages is important (at least, the first visit). So if you go to page 1, page 6, page 4, and page 5 in that order, it's different than going to 1, 2, 3, 4, 5.
The first thing I tried was adding passage names to an array for the pages that mattered for the count, if you once you click on a link to go to the page. Then, let's say the text on page 3 changes if you have been to page 5, before going to page 4. So on page 3:
(if: $passlog.indexOf("page5") is not -1 and is < $passlog.indexOf("page4")[some text] (else:)[other text]
Which simply did not work at all. So I was trying to figure if either .indexOf doesn't work, or if I am using it wrong; both are completely possible in this case. I did find a kind of kludgey workaround-- I created variables to store the number of times I visit the passages ($count1, $count2) in question, and created a third variable for each page ($p1; $p2, et al). So If, say, p1 is in $passlog already, it'll set $p1 to itself; if it is not, then it'll set $p1 to whatever $count1's value is. Then I can compare $p1 and $p2 for basically the same result. The problem is what happens if $p1 and $p2 are equal, which is pretty likely... in fact, the only reason this is working at all right now is because there's a bug in my counting method that is artificially inflating the numbers of later passages.
So... Help?
Comments
There's a bracket missing after "page4"
When doing multiple conditions you need to provide the left hand side for each condition, even it it's the same (though you can use 'it' to reduce on typing)
You don't need the second 'is'
The following will work
BTW you've posted this question twice.
unfortunately, it's not working... I could have the wrong assumption though. I figured that it'd find the first instance of "page5" in the array and return that; if "page5" is in the array multiple times. Maybe that's the problem?
prints 'works' as expected.
What problems are you getting?