Page 1 of 1

Random choice in tease

Posted: Mon Oct 18, 2021 2:32 am
by dark0512
Hi,

I am working on a tease and while it's working when I run a preview, i'm getting a validation error (i'm assuming that will stop me from publishing the tease).

I am using this:

var holdEdge = Math.floor(Math.random() * 100) ;
if (holdEdge < 70) {
holdEdgeResult = "Hands off";
} else if (holdEdge < 90) {
holdEdgeResult = "Stay on the edge";
var holdIt = true;
} else {
holdEdgeResult = "Let it fade";
}

Basically, i'm trying to get this to randomly get you to hold the edge or not...I wrote it for 3 possibilities, but obviously i'm currently only using two of the three.

I am getting this in the validator:

NULL value found, but a string is required

Does not have a value in the enumeration ["left","right","center"]


I'm not exactly sure how to fix it?

Re: Random choice in tease

Posted: Mon Oct 18, 2021 4:51 am
by Thamrill
dark0512 wrote: Mon Oct 18, 2021 2:32 am Hi,

I am working on a tease and while it's working when I run a preview, i'm getting a validation error (i'm assuming that will stop me from publishing the tease).

I am using this:

var holdEdge = Math.floor(Math.random() * 100) ;
if (holdEdge < 70) {
holdEdgeResult = "Hands off";
} else if (holdEdge < 90) {
holdEdgeResult = "Stay on the edge";
var holdIt = true;
} else {
holdEdgeResult = "Let it fade";
}

Basically, i'm trying to get this to randomly get you to hold the edge or not...I wrote it for 3 possibilities, but obviously i'm currently only using two of the three.

I am getting this in the validator:

NULL value found, but a string is required

Does not have a value in the enumeration ["left","right","center"]


I'm not exactly sure how to fix it?
Since it mentions "enumeration ["left","right","center"]" I guess the problem is that a say action has an unset alignment. Have you edited the script outside the editor? Maybe downloading the script and re-uploading it?

Re: Random choice in tease

Posted: Mon Oct 18, 2021 7:09 am
by intermolecularpyro
I sometimes get this error too! To fix it, I tried making sure the affected say action definitely looks right, but it doesn't make any difference.
I find that just deleting the action and making it again will do it. A bit annoying but not the end of the world.

Not sure what causes it though. I make my teases on my phone, so I have to write text in the notes app, then copy & paste into the say action text field - otherwise it's functionally impossible to make them, as text goes all over the place, random characters will appear and disappear etc. I only get this error a small handful of times with hundreds of say actions in the tease.

I know that's probably not relevant here, but essentially just replace the affected say action with a newly made one and you should be fine!