Page 1 of 1

[EOS Editor] Enabling pages after enough laps?

Posted: Fri Jul 19, 2019 10:17 pm
by Morexis
Heya, everyone!

I'm fairly new to Milovana and still pretty lost but I hope this is the right place to ask this.

I'm currently working on an EOS tease with randomness as central theme. I seperated the pages into different groups and a page from one group will randomly goto one of another group. Now, in order to make the tease long enough, the final group is disabled from the start. However, I want them to be enabled again after the player has played enough laps.

For example, group 2 leads to group 1 and the final group, group 3. The player gets sent to group 2 but since I don't want him to goto group 3 yet, it's disabled. Because of that, he gets sent to a page from group 1 which returns him to a random page from group 2.
Now comes the tricky part: at that point, I want group 3 to become enabled again so there's a chance to get sent to a page from group 3.

Is this even possible? If it is, how? The only way I could think of is a prompt asking for the number of played rooms and a connected if-choice. I'd much prefer a hidden solution, though.

I'm still in the trying-stuff-out phase and I'd love your help with it. :smile:

Re: [EOS Editor] Enabling pages after enough laps?

Posted: Sat Jul 20, 2019 5:12 am
by Roblsforbobls
Cool premise, I'm excited to see it once it's done!
So If I'm understanding you correctly, you want the player to go from Group 1 --> 2 --> 1 --> 2 etc. for a number of times. Once the player has done that many laps, Group 3 will be enabled and there will be a chance to go there. The one exception is that the player can never go from Group 1 --> Group 1 or Group 3 --> Group 3 or Group 2 --> Group 2. To make this work, we will have to get a little creative with the coding. I've made a test version myself to make sure this works and I'll share it here so you can look over it and try to replicate it in your tease.

Here's the code:
https://drive.google.com/file/d/1wrFxAM ... sp=sharing
Upload it into Eos in a new tease (so you don't overwrite another tease!)

If you want to test it, start on the "page-helper" page.
The other relevant pages for your question are the "Group#" pages - the rest are little mini tutorials that I've been making for myself as I learn new things in Eos. They might be helpful for you too!

Basically, I set it up so that every page's GoTo sends the player to the page-helper page, which then decides where to send the player. This page will increase a variable "laps" by 1 every time it is visited. When the number of laps is less than a certain number, it will send the player from Group 1 --> Group 2 --> Group 1 etc. If the number of laps is above a certain number, it will enable the Group 3 pages, and it will essentially flip a coin to determine where to send the player when all three Groups are enabled. This decision is made by the code

Code: Select all

var myNumber = Math.floor((Math.random() * 2) + 1);
console.log('The number is %s', myNumber)
I chose this method because there is no set order of pages in your tease. Page-helper can take care of all the actions that have to happen behind the scenes between every page, and will make it easier to add more such actions if you choose to.

Some important notes:
Spoiler: show
  • Change the GoTo action of every page to go to the new helper page. You can copy and paste this GoTo to make it easier!
  • Every page in Group 1 needs an additional Eval action:

    Code: Select all

    pageid = 1
    This will allow the helper page know that the player was last at a Group 1 page. Every page in Group 2 needs the same eval, but setting that "pageid" variable to 2. Do the same for Group 3 pages.
  • On the helper page, add the eval for increasing the variable "laps" by 1 (can be done with "laps++" or "laps = laps + 1")
  • On the helper page, you'll need some If statements. This is where it starts getting complex, so I will let you look through the example :-P
  • Make sure to define your variables in the initial script! The only variables you should need for this are "pageid" (tells page-helper which Group the player was last in), "myNumber" (stores the result of the coin flips once Group 3 is enabled), and "laps" (tells page-helper how many pages the player has been to). You can find these variables in the initial script - find it by clicking the gear on the left.

Feel free to reply to me or DM me if you have any questions about how I did it or about anything else. I apologize for just throwing this example at you... I tried typing an explanation and I realized that it got too complicated for me to explain it clearly to you.
To anyone else reading this, feel free to download it as well - I think the mini tutorials can be helpful for anyone getting into Eos :-D

Re: [EOS Editor] Enabling pages after enough laps?

Posted: Sat Jul 20, 2019 10:19 pm
by Morexis
Wow, thanks for the code and the explanation!

But I'm having some trouble with it. I'm supposed to upload the script on the "code" page, right? Well, if I do that, I get a validation error " pages.start Your tease must have a page called "start" ". Is there an easy way to fix this? I'm guessing the first page simply needs to be renamed to "start".
Or is the code supposed to be an init script?

Sorry I'm so bad at this :blush:. I really look forward to seeing the code once it works!

Re: [EOS Editor] Enabling pages after enough laps?

Posted: Sun Jul 21, 2019 12:25 am
by Roblsforbobls
Sorry, my bad! I renamed the original start page - I didn't realize that would prevent people from uploading it to Eos. I added a start page and reuploaded the code to Google Drive. Try this link instead!
https://drive.google.com/file/d/1uxZEGG ... sp=sharing

Re: [EOS Editor] Enabling pages after enough laps?

Posted: Sun Jul 21, 2019 10:20 am
by Morexis
Alright, it works now.

I checked it out and everything works perfectly! I still can't figure out how some of the pages work but I think I understand everything regarding my question.

Thank you very much again. If I have any questions regarding your code, I'll send you a message. :-)

Re: [EOS Editor] Enabling pages after enough laps?

Posted: Sun Jul 21, 2019 6:23 pm
by Roblsforbobls
No problem, happy to help :-D I can't wait to see your tease when it's done!