Eos "if" action problem

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
tetraporn
Curious Newbie
Curious Newbie
Posts: 4
Joined: Tue May 04, 2021 7:35 pm

Eos "if" action problem

Post by tetraporn »

Hello, I would like to do something like this:

page1: set a variable to 0
page2: stuff happens
page3: variable = variable + 1
if variable == 2:
then go to page 4
else go to page 2

basically it's like a loop but everytime you get to the end u get like a point, and when you went through the loop enough times, you get to continue

the problem is that after the "if" at page3 nothing happens, it doesn't go to neither of the pages

can anyone help?
User avatar
DSH
Explorer At Heart
Explorer At Heart
Posts: 223
Joined: Thu Dec 31, 2020 7:39 am
Gender: Male
I am a: None of the above

Re: Eos "if" action problem

Post by DSH »

Do you have a shared link from your project or take a picture of the place in the EOS where you suspect the error.
but so blind it is difficult to help, could only be a small typing mistake a colon instead of a semicolon, for example
sorry for my english is not very good
RemiHiyama
Explorer At Heart
Explorer At Heart
Posts: 203
Joined: Thu Feb 28, 2019 3:30 pm
I am a: Switch

Re: Eos "if" action problem

Post by RemiHiyama »

Are there any errors in your browser console?

Not going to either one is a bit odd, that makes me think a mistyped variable name making it freeze on one of the commands on page 3. (If it wasn't going to page 3 at all, I'd suspect an issue with page 4 causing the preloader to error out, but it doesn't sound like that's the case.)
Auto: Replaces selected instances of the word "not" with the word "definitely".
Roblsforbobls
Explorer At Heart
Explorer At Heart
Posts: 260
Joined: Tue May 21, 2019 2:27 am
Gender: Male
Sexual Orientation: Asexual
I am a: Switch

Re: Eos "if" action problem

Post by Roblsforbobls »

tetraporn wrote: Mon Sep 06, 2021 4:11 pm the problem is that after the "if" at page3 nothing happens, it doesn't go to neither of the pages

can anyone help?
Hi tetraporn,

Are you sure it gets stuck after the "if" at page3 happens? If so, which part of the "if" is causing the problem? It sounds like further investigation may be required.

I suggest adding a "Say" action before and after every other relevant action on page3 (assuming you know it gets stuck on page 3), including before the final "if" at page3 and inside the "if" action (before the "go to" actions in the "then" and "else" parts). The message in the "Say" actions should be sequential numbers (1, 2, 3, etc.) so you'll know which action successfully runs before the tease gets stuck, and that should give you a better idea of how to fix it.

If you still need help after doing this debug process (or if you have already done something similar), let us know what you find and we'll take it from there :-)

Best,
Robls
tetraporn
Curious Newbie
Curious Newbie
Posts: 4
Joined: Tue May 04, 2021 7:35 pm

Re: Eos "if" action problem

Post by tetraporn »

Here's a screenshot of the "page3", I also did what Robls said (adding a "say" command before every action) and as I said, it stopped before the "if" command (or in the middle of it, not sure) and neither of the actions in the "if" happened

Also at the start I typed in the eval "n = 0" but I don't think that's the problem
Attachments
Screenshot (4).png
Screenshot (4).png (124.58 KiB) Viewed 1445 times
User avatar
DSH
Explorer At Heart
Explorer At Heart
Posts: 223
Joined: Thu Dec 31, 2020 7:39 am
Gender: Male
I am a: None of the above

Re: Eos "if" action problem

Post by DSH »

do a semicolon in your eval actions
I always do it that way

Image
sorry for my english is not very good
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: Eos "if" action problem

Post by fapnip »

DSH wrote: Tue Sep 07, 2021 4:00 pm do a semicolon in your eval actions
semicolons are generally not needed in JavaScript, unless you're trying to pack a bunch on one line, or for a few edge cases -- but they don't hurt.... unless you put them in an Eos "condition". Semicolons shouldn't be in an Eos condition.

I'm curious to see exactly where and how "n" was first defined. If page 4-2 is the first time n was encountered, then "n = n + 1" will break with an "n is not defined" error. Would need to be something like "n = (window.n || 0) + 1" to work in that case.

It would be best to have a link to the tease to really see the issue.
tetraporn
Curious Newbie
Curious Newbie
Posts: 4
Joined: Tue May 04, 2021 7:35 pm

Re: Eos "if" action problem

Post by tetraporn »

I went "n = 0" at the start page

I don't know how to give a link to the tease but, the only eval command is at the start page and then at the 4-1 4-2 and 4-3 pages, but the tease goes to only one random page out of these three

And the only "if" commands are at the "4-" pages which is on the screenshot, you can also see the eval commands on the screenshot, they're all the same in the three "4-" pages

I don't think the other commands are relevant, not sure tho
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: Eos "if" action problem

Post by fapnip »

tetraporn wrote: Tue Sep 07, 2021 6:34 pm I don't know how to give a link to the tease
Click the "Share" icon in the Eos editor (the three dots connected by two lines, looking kinda like "<" symbol, but with dots.), copy the link from there, and paste it here.
undeniable_denial
Explorer
Explorer
Posts: 96
Joined: Sat Aug 24, 2019 11:42 am
Gender: Male
Location: Germany

Re: Eos "if" action problem

Post by undeniable_denial »

tetraporn wrote: Tue Sep 07, 2021 6:34 pm I went "n = 0" at the start page
You should put that in your initalization script under "options". If you click preview in the middle of your tease, then the code from the start page is skipped and, like fapnip said, an uninitialized n is bad.
tetraporn
Curious Newbie
Curious Newbie
Posts: 4
Joined: Tue May 04, 2021 7:35 pm

Re: Eos "if" action problem

Post by tetraporn »

I'm sorry ya'll i am just really dumb, at the start I put the "n = 0" after the "go to" command, so it never actually set the "n".
It really was just a stupid mistake

I now also did what undeniable_denial said and put "n = 0" in the init script

Thanks for all your help tho
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: Eos "if" action problem

Post by fapnip »

undeniable_denial wrote: Tue Sep 07, 2021 7:35 pm You should...
Hey! Welcome back!
Post Reply

Who is online

Users browsing this forum: No registered users and 27 guests