Eos "if" action problem
Eos "if" action problem
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?
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?
- DSH
- 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
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
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
-
- Explorer At Heart
- Posts: 203
- Joined: Thu Feb 28, 2019 3:30 pm
- I am a: Switch
Re: Eos "if" action problem
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.)
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".
-
- 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
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
Re: Eos "if" action problem
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
Also at the start I typed in the eval "n = 0" but I don't think that's the problem
- Attachments
-
- Screenshot (4).png (124.58 KiB) Viewed 1445 times
- DSH
- 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
do a semicolon in your eval actions
I always do it that way
I always do it that way
sorry for my english is not very good
Re: Eos "if" action problem
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.
Re: Eos "if" action problem
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
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
Re: Eos "if" action problem
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.
-
- Explorer
- Posts: 96
- Joined: Sat Aug 24, 2019 11:42 am
- Gender: Male
- Location: Germany
Re: Eos "if" action problem
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
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
Re: Eos "if" action problem
Hey! Welcome back!
Who is online
Users browsing this forum: No registered users and 27 guests