Random choice in tease

All about the past, current and future webteases and the art of webteasing in general.
---
Post Reply
dark0512
Explorer
Explorer
Posts: 56
Joined: Sat Aug 20, 2011 10:13 pm
I am a: Switch

Random choice in tease

Post 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?
Thamrill
Explorer At Heart
Explorer At Heart
Posts: 301
Joined: Thu Jan 03, 2013 4:55 pm
Gender: Male
Sexual Orientation: Straight
I am a: Submissive

Re: Random choice in tease

Post 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?
Image

Image

Image
intermolecularpyro
Explorer
Explorer
Posts: 51
Joined: Wed Jan 15, 2020 8:19 am

Re: Random choice in tease

Post 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!
Post Reply