[EOS] random text

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
kleeeee
Curious Newbie
Curious Newbie
Posts: 2
Joined: Fri Apr 26, 2019 9:24 pm

[EOS] random text

Post by kleeeee »

Hi, newbie here. I don't have much experience in coding but trying to learn how to create a tease in the EOS editor. Is there a way to insert random text? I've seen other teases somehow set different teasing/edge lines in the init script and call them back during the tease itself but I'm having trouble understanding what they did. Help is appreciated!
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: [EOS] random text

Post by Thamrill »

kleeeee wrote: Mon Jan 05, 2026 6:34 am Hi, newbie here. I don't have much experience in coding but trying to learn how to create a tease in the EOS editor. Is there a way to insert random text? I've seen other teases somehow set different teasing/edge lines in the init script and call them back during the tease itself but I'm having trouble understanding what they did. Help is appreciated!
I wrote a simple example tease whose script you can see here: https://milovana.com/webteases/geteossc ... 76607a5063

Basically, in the init script you create all possible options, like so:

Code: Select all

 cars = ["Saab", "Volvo", "BMW"]; 
for simplicty I hadded some code in the init functin that makes it easier randomly generate a number between 0 and max-1:

Code: Select all

function getRandomInt(max) {
  return Math.floor(Math.random() * max);
}
then before the say action you can call an eval function to define the text, like so:

Code: Select all

text=cars[getRandomInt(cars.length)]
this sets the text variable to one of the three possible values in the cars array (remember that value in an array are indexed from 0 to length-1)

Then, in the say action, you set the text to be variabe "text"

In principle, you can directly place "cars[getRandomInt(cars.length)]" in the say action, and skip the eval.

A practical way could be to create something like:

Code: Select all

 flavourChar1= ["Line 0", "Line 1", "Line 2", "Line 3"];
flavourChar2= ["Line 0", "Line 1", "Line 2", "Line 3"]; 
and then for character 1 set the text with:

Code: Select all

 flavourChar1[getRandomInt(flavourChar1.length)] 
and for character 2 set the text with:

Code: Select all

 flavourChar2[getRandomInt(flavourChar2.length)] 
Image

Image

Image
kleeeee
Curious Newbie
Curious Newbie
Posts: 2
Joined: Fri Apr 26, 2019 9:24 pm

Re: [EOS] random text

Post by kleeeee »

thank you so much!
Post Reply