[Question] Variables and Returning To Pages?

All about the past, current and future webteases and the art of webteasing in general.
---
Post Reply
MasterfulEll
Explorer
Explorer
Posts: 7
Joined: Thu Oct 21, 2021 7:51 pm

[Question] Variables and Returning To Pages?

Post by MasterfulEll »

Good afternoon, everyone.

I'm currently creating a new EOS Tease, and am struggling with 2 issues. I have almost zero background in scripts or coding, so please bear with me:

Issue 1:In the Tease there are multiple stages that the player will progress through, and the way in which the stage will play out will vary depending on an external luck factor (dice roll, card draw, coin toss, etc), in the early stages of the game, the options are binary (odd/even number, more than 3/less than 3, and so on), so simple eval + if operations work for changing dialogue, images, and times for those paged based on the options picked. However, further on in the game the options will go beyond binary options hae have 3 or more possible outcomes. What would the best way to alter the game based on the outcomes if there were more than 2 actions? This is keeping in mind that multiple variables will be stacked. For example, lets say the suit of the drawn card is called variable A, and determines what images will be shown, and the numerical value of the card is called variable B, and determines the metronome speed from a pre-set selection of speeds. If the card drawn is a 5 of hearts, it would need to pick the images set for hearts, and the metronome speed set to the number 5. What would be the best way to do this?

Issue 2: This is a much simpler issue, and I feel like there's something huge I'm missing, because it seems so easy: The player is given notification button on the screen at all times that they can select if they get too close to the edge. When pressed, they are sent to a single page to take a short break to calm down, and then get sent back to the page they were on when they pressed the button... but I'm not sure how to return the player back to the page they were on. It seems like an easy fix, but I haven't found a way to do it yet.

Thank you in advance to anyone who can help me with this!

(P.S if you know of any fun twists on tasks or stroking methods that you'd like to see in multi-stage tease, I'm all ears! If there are any suggestions that make it in, they will of course get a little shout out in the credits :-) )
User avatar
indyc
Explorer At Heart
Explorer At Heart
Posts: 530
Joined: Sun Mar 28, 2021 10:03 pm
Contact:

Re: [Question] Variables and Returning To Pages?

Post by indyc »

For your first example on randomness I would actually suggest using only 2 variables. For example, if you are drawing from a 40 card deck and each card is a picture then:
1-10 can be heart
11-20 can be spade
21-30 can be diamond
31-40 can be club

The metronome randomizer can be a separate variable.

That all being said, for personal taste I don't usually prefer the pure random games/teases. Any way that you can allow for player choice would be a big draw for me. For example, choosing WHEN to use the slow metronome or not and what to see where you only have a few choices to spend.

For your second question, I too would love to know the answer to this. You could make the button press not go to a separate page and instead be a picture inside of the button code. (I do this a lot in my own tease but I never liked how limiting it is). This button could be copy pasted across all of your pages you would want it in.
fapnip
Explorer At Heart
Explorer At Heart
Posts: 431
Joined: Mon Apr 06, 2020 1:54 pm

Re: [Question] Variables and Returning To Pages?

Post by fapnip »

MasterfulEll wrote: Fri Dec 03, 2021 11:50 pm but I'm not sure how to return the player back to the page they were on.
This can be done, but you can't go back to the exact position in a page -- everything will start again from the top.

In its simplest form, this could be done with a single simple string variable, but there are issues with that as soon as you try nest a few pages deep. Using an array is an easy fix.

First, define an array in your Init Script

Code: Select all

var pageStack = []
Now, in an eval before going to a page do:

Code: Select all

pageStack.push(pages.getCurrentPageId())
Then you go to the page you want to go to using a Goto action, or otherwise.

Now, on that new page, when you want to go back to the page that called you, in an eval simply do:

Code: Select all

pages.goto(pageStack.pop())
Edit:
I should also mention that if, on that new page, you don't plan on returning to the page that called you, instead going to a different page -- and you don't want even that page to return the page that called you, then, before you go to a different page, you should do a:

Code: Select all

pageStack.pop()
MasterfulEll
Explorer
Explorer
Posts: 7
Joined: Thu Oct 21, 2021 7:51 pm

Re: [Question] Variables and Returning To Pages?

Post by MasterfulEll »

fapnip wrote: Sat Dec 04, 2021 1:06 am
MasterfulEll wrote: Fri Dec 03, 2021 11:50 pm but I'm not sure how to return the player back to the page they were on.
Spoiler: show
This can be done, but you can't go back to the exact position in a page -- everything will start again from the top.

In its simplest form, this could be done with a single simple string variable, but there are issues with that as soon as you try nest a few pages deep. Using an array is an easy fix.

First, define an array in your Init Script

Code: Select all

var pageStack = []
Now, in an eval before going to a page do:

Code: Select all

pageStack.push(pages.getCurrentPageId())
Then you go to the page you want to go to using a Goto action, or otherwise.

Now, on that new page, when you want to go back to the page that called you, in an eval simply do:

Code: Select all

pages.goto(pageStack.pop())
Edit:
I should also mention that if, on that new page, you don't plan on returning to the page that called you, instead going to a different page -- and you don't want even that page to return the page that called you, then, before you go to a different page, you should do a:

Code: Select all

pageStack.pop()
Thank you so much! after including these actions and with a small amount of tinkering, the feature fully works as intended :-)
Post Reply