Page 1 of 1
[EOS] Can't figure why my tease freezes
Posted: Wed Mar 15, 2023 8:09 pm
by Epton
Hey guys, I am trying to use 1 IF to check if a variable is true and then inside of it I use another IF that should pick the number from the function that generated it. can't I use the called function after the first IF?
My Function:
function Resultup(max) {
return 1 + Math.floor(Math.random() * max)
}
function Results() {
return Resultup(8)
}

It continues that way up to Resultsup8
Incase you were wondering if I load Resultdown

Re: [EOS] Can't figure why my tease freezes
Posted: Wed Mar 15, 2023 9:55 pm
by kerkersklave
One thing that sticks out: you use the name Resultsup both for a function and a variable. They share the same namespace, so when you assign to Resultsup, you are overwriting the function and trying to call it will result in an error. Should only happen though if you run that code twice or you did the same thing before in some other way.
Re: [EOS] Can't figure why my tease freezes
Posted: Thu Mar 16, 2023 5:37 pm
by Epton
kerkersklave wrote: Wed Mar 15, 2023 9:55 pm
One thing that sticks out: you use the name Resultsup both for a function and a variable. They share the same namespace, so when you assign to Resultsup, you are overwriting the function and trying to call it will result in an error. Should only happen though if you run that code twice or you did the same thing before in some other way.
I know it is a bit confusing but I am not
Function:
Resultup(no s here) and Results
Variable:
Result
sup (the s is here)
Re: [EOS] Can't figure why my tease freezes
Posted: Thu Mar 16, 2023 7:31 pm
by Thamrill
Epton wrote: Thu Mar 16, 2023 5:37 pm
kerkersklave wrote: Wed Mar 15, 2023 9:55 pm
One thing that sticks out: you use the name Resultsup both for a function and a variable. They share the same namespace, so when you assign to Resultsup, you are overwriting the function and trying to call it will result in an error. Should only happen though if you run that code twice or you did the same thing before in some other way.
I know it is a bit confusing but I am not
Function:
Resultup(no s here) and Results
Variable:
Result
sup (the s is here)
Looking only at a snippet of code is not very helpful to identify the issue; can you share the script in preview mode?
Re: [EOS] Can't figure why my tease freezes
Posted: Thu Mar 16, 2023 8:33 pm
by Epton
Thamrill wrote: Thu Mar 16, 2023 7:31 pm
Epton wrote: Thu Mar 16, 2023 5:37 pm
kerkersklave wrote: Wed Mar 15, 2023 9:55 pm
One thing that sticks out: you use the name Resultsup both for a function and a variable. They share the same namespace, so when you assign to Resultsup, you are overwriting the function and trying to call it will result in an error. Should only happen though if you run that code twice or you did the same thing before in some other way.
I know it is a bit confusing but I am not
Function:
Resultup(no s here) and Results
Variable:
Result
sup (the s is here)
Looking only at a snippet of code is not very helpful to identify the issue; can you share the script in preview mode?
This is all of the code.
I have a function in init aka Results()
I use Resultdown1/2/3/4.... to count how many times each option was chosen and if it is 2 it goes to a different page, that is it.
The error I get is that it is not able to read the eval: Resultsup = Resultup() [what I've marked in blue]. if I use it before IF Virgin == True, then it works just fine.
https://milovana.com/webteases/showteas ... 5526a14bad
Re: [EOS] Can't figure why my tease freezes
Posted: Fri Mar 17, 2023 5:35 am
by Thamrill
Epton wrote: Thu Mar 16, 2023 8:33 pm
Thamrill wrote: Thu Mar 16, 2023 7:31 pm
Epton wrote: Thu Mar 16, 2023 5:37 pm
I know it is a bit confusing but I am not
Function:
Resultup(no s here) and Results
Variable:
Result
sup (the s is here)
Looking only at a snippet of code is not very helpful to identify the issue; can you share the script in preview mode?
This is all of the code.
I have a function in init aka Results()
I use Resultdown1/2/3/4.... to count how many times each option was chosen and if it is 2 it goes to a different page, that is it.
The error I get is that it is not able to read the eval: Resultsup = Resultup() [what I've marked in blue]. if I use it before IF Virgin == True, then it works just fine.
https://milovana.com/webteases/showteas ... 5526a14bad
As a first look, you haven't closed the curly bracket of the Results function in the Initialization scripts. Adding it the tease runs, otherwise it doesn't even load. I will look more into it, but as a first comment all nested if actions make for a difficult to maintain code and you should consider if it wouldn't be better to reorganize the code in different pages, flattening the trees of actions
Re: [EOS] Can't figure why my tease freezes
Posted: Fri Mar 17, 2023 9:45 am
by Epton
Thamrill wrote: Fri Mar 17, 2023 5:35 am
Epton wrote: Thu Mar 16, 2023 8:33 pm
Thamrill wrote: Thu Mar 16, 2023 7:31 pm
Looking only at a snippet of code is not very helpful to identify the issue; can you share the script in preview mode?
This is all of the code.
I have a function in init aka Results()
I use Resultdown1/2/3/4.... to count how many times each option was chosen and if it is 2 it goes to a different page, that is it.
The error I get is that it is not able to read the eval: Resultsup = Resultup() [what I've marked in blue]. if I use it before IF Virgin == True, then it works just fine.
https://milovana.com/webteases/showteas ... 5526a14bad
As a first look, you haven't closed the curly bracket of the Results function in the Initialization scripts. Adding it the tease runs, otherwise it doesn't even load. I will look more into it, but as a first comment all nested if actions make for a difficult to maintain code and you should consider if it wouldn't be better to reorganize the code in different pages, flattening the trees of actions
I did close them I noticed as I was about to reply, I didn't know the share link changes each save after the tease is released sorry.
I'll think about reorganizing the nested ifs that can load from different page like the eval one I guess.
I appreciate your help
https://milovana.com/webteases/showteas ... 22ac61b383
It seems that the curly brackets is what froze my tease lol now im back to the IF problem. Thank you for the reply it helped me to look at where I forgot to look at lol, this thread can be considered as closed :) .
Re: [EOS] Can't figure why my tease freezes
Posted: Fri Mar 17, 2023 3:39 pm
by Thamrill
Epton wrote: Fri Mar 17, 2023 9:45 am
Thamrill wrote: Fri Mar 17, 2023 5:35 am
Epton wrote: Thu Mar 16, 2023 8:33 pm
This is all of the code.
I have a function in init aka Results()
I use Resultdown1/2/3/4.... to count how many times each option was chosen and if it is 2 it goes to a different page, that is it.
The error I get is that it is not able to read the eval: Resultsup = Resultup() [what I've marked in blue]. if I use it before IF Virgin == True, then it works just fine.
https://milovana.com/webteases/showteas ... 5526a14bad
As a first look, you haven't closed the curly bracket of the Results function in the Initialization scripts. Adding it the tease runs, otherwise it doesn't even load. I will look more into it, but as a first comment all nested if actions make for a difficult to maintain code and you should consider if it wouldn't be better to reorganize the code in different pages, flattening the trees of actions
I did close them I noticed as I was about to reply, I didn't know the share link changes each save after the tease is released sorry.
I'll think about reorganizing the nested ifs that can load from different page like the eval one I guess.
I appreciate your help
https://milovana.com/webteases/showteas ... 22ac61b383
It seems that the curly brackets is what froze my tease lol now im back to the IF problem. Thank you for the reply it helped me to look at where I forgot to look at lol, this thread can be considered as closed :) .
One more thing I found is that I got this:
ReferenceError: Resultsup is not defined
at Interpreter.unwind (interpreter.min.js:1:57275)
at Interpreter.throwException (interpreter.min.js:1:55951)
at Interpreter.getValueFromScope (interpreter.min.js:1:53867)
at Interpreter.stepIdentifier (interpreter.min.js:1:72938)
at Interpreter.step (interpreter.min.js:1:3938)
at Interpreter.run (interpreter.min.js:1:4285)
at n.value (VirtualMachine.js:29:23)
at Object.run (if.js:16:24)
at ActionQueue.js:54:72
at u (runtime.js:45:40)
So what i feel to suggest you (and this is one of the reason I personally don't like Javascript) is to define all the variables that you're going to need in the tese in the initialization script. The error arises in page "Results" in the If action checking for virginity.
Another thing that I feel I should tell you, is that in many cases you are creating an excessive ammount of eval actions. In every eval action you can put multiple lines of code, so you can put multiple instructions inside a single action, rather than placing many eval actions one after the other
Re: [EOS] Can't figure why my tease freezes
Posted: Fri Mar 17, 2023 4:33 pm
by Epton
Thamrill wrote: Fri Mar 17, 2023 3:39 pm
Epton wrote: Fri Mar 17, 2023 9:45 am
Thamrill wrote: Fri Mar 17, 2023 5:35 am
As a first look, you haven't closed the curly bracket of the Results function in the Initialization scripts. Adding it the tease runs, otherwise it doesn't even load. I will look more into it, but as a first comment all nested if actions make for a difficult to maintain code and you should consider if it wouldn't be better to reorganize the code in different pages, flattening the trees of actions
I did close them I noticed as I was about to reply, I didn't know the share link changes each save after the tease is released sorry.
I'll think about reorganizing the nested ifs that can load from different page like the eval one I guess.
I appreciate your help
https://milovana.com/webteases/showteas ... 22ac61b383
It seems that the curly brackets is what froze my tease lol now im back to the IF problem. Thank you for the reply it helped me to look at where I forgot to look at lol, this thread can be considered as closed :) .
One more thing I found is that I got this:
ReferenceError: Resultsup is not defined
at Interpreter.unwind (interpreter.min.js:1:57275)
at Interpreter.throwException (interpreter.min.js:1:55951)
at Interpreter.getValueFromScope (interpreter.min.js:1:53867)
at Interpreter.stepIdentifier (interpreter.min.js:1:72938)
at Interpreter.step (interpreter.min.js:1:3938)
at Interpreter.run (interpreter.min.js:1:4285)
at n.value (VirtualMachine.js:29:23)
at Object.run (if.js:16:24)
at ActionQueue.js:54:72
at u (runtime.js:45:40)
So what i feel to suggest you (and this is one of the reason I personally don't like Javascript) is to define all the variables that you're going to need in the tese in the initialization script. The error arises in page "Results" in the If action checking for virginity.
Another thing that I feel I should tell you, is that in many cases you are creating an excessive ammount of eval actions. In every eval action you can put multiple lines of code, so you can put multiple instructions inside a single action, rather than placing many eval actions one after the other
This is what I don't understand because I use up the same way as resultsup but for some reason resultsup doesn't work. the only difference is that up does not have an IF above it.
And I've done lots of evals because for some reason x= tease.getitem("x") doesn't work if it is not in an individual eval. so it simply stuck xD but thanks for mentioning it.
Edit:
OMG I am soooo stupid

... I've placed it all under else of Resultdown3 so it obviously couldn't find it lol
Thanks for the help

Re: [EOS] Can't figure why my tease freezes
Posted: Sat Mar 18, 2023 12:05 pm
by Thamrill
Epton wrote: Fri Mar 17, 2023 4:33 pm
And I've done lots of evals because for some reason x= tease.getitem("x") doesn't work if it is not in an individual eval. so it simply stuck xD but thanks for mentioning it.
It should work for multiple commands; just put them in different lines and place a semicolumn at the ond of each line