EOS - How to go to random pages with % liklihood

All about the past, current and future webteases and the art of webteasing in general.
---
Post Reply
boundupone
Explorer At Heart
Explorer At Heart
Posts: 487
Joined: Sat Jun 01, 2013 8:01 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

EOS - How to go to random pages with % liklihood

Post by boundupone »

Image we have a simple tease -

Start
Option-a
Option-b
Option-c

In start page the mistress will decide which punishment to give the slave. I want to randmonise which one she chooses, but multiplied by %

So if we imagine there is a 70% chance she will choose option-a 25% she will choose option-b, and just 5% she will choose option-c

Any help appreciated as I haven't been able to get an eval to work, but it should be simple
Try anything once!
User avatar
Batman314
Explorer
Explorer
Posts: 76
Joined: Thu Sep 12, 2013 2:59 pm

Re: EOS - How to go to random pages with % liklihood

Post by Batman314 »

I know I'm not the best programmer on here, but I think this will work pretty well for your idea:

Code: Select all

//the function should go in the init script 
function choosePunishment(weight1, weight2, weight3){
  
  //an array with the names of the pages
  var pageArray = ['punishment1', 'punishment2', 'punishment3']
  
  //random range is the sum of the weights, you can use percentage
  //but they don't need to add to 100 this way
  var randomRange = Math.random() * (weight1 + weight2 + weight3)
  
  //the pageChoice variable will choose the location in the 
  //pageArray, and will be updated in the if statements
  var pageChoice = 0

  if (randomRange < weight1) {
    pageChoice = 0
  } 
  else if (randomRange < (weight1 + weight2)){
    pageChoice = 1
  }
  else {
    pageChoice = 2
  }

  //the function will output a string from page array 
  //at a location chosen by the the pageChoice variable
  return pageArray[pageChoice]

}//end of function

//you can call the function in a page eval action
//add whatever weights you want in the function
var nextPage = choosePunishment(70, 25, 5)
pages.goto(nextPage)
Hope it helps!

-Batman314
User avatar
Drool
Experimentor
Experimentor
Posts: 1478
Joined: Sat Nov 28, 2015 2:24 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Switch

Re: EOS - How to go to random pages with % liklihood

Post by Drool »

Hi.
There is also a possibility to do this without any eval.
If you have the pages
Option-a
Option-b
Option-c

and you use "goto Option-*" (note the STAR), EOS will randomly jump to one of these pages with a probability of 1/3.

If you simply copy pages and name them like

Option-a
Option-a1 (copy of Option-a)
Option-a2 (copy of Option-a)
Option-b
Option-b1 (copy of Option-b)
Option-c

you have 1/2 for 'a' 1/3 for 'b' and 1/6 for 'c'.

Crude. Primitive. The way I like it. :lol:
fapnip
Explorer At Heart
Explorer At Heart
Posts: 430
Joined: Mon Apr 06, 2020 1:54 pm

Re: EOS - How to go to random pages with % liklihood

Post by fapnip »

boundupone wrote: Sat Jun 05, 2021 4:54 pm So if we imagine there is a 70% chance she will choose option-a 25% she will choose option-b, and just 5% she will choose option-c
There's 101 ways to do it, but here's another option:

Code: Select all

var n=Math.floor(Math.random()*100)

if (n<70) {
  pages.goto('Option-a')
} else if (n<95) {
  pages.goto('Option-b')
} else {
  pages.goto('Option-c')  
}
boundupone
Explorer At Heart
Explorer At Heart
Posts: 487
Joined: Sat Jun 01, 2013 8:01 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: EOS - How to go to random pages with % liklihood

Post by boundupone »

fapnip wrote: Sun Jun 06, 2021 5:22 pm
boundupone wrote: Sat Jun 05, 2021 4:54 pm So if we imagine there is a 70% chance she will choose option-a 25% she will choose option-b, and just 5% she will choose option-c
There's 101 ways to do it, but here's another option:

Code: Select all

var n=Math.floor(Math.random()*100)

if (n<70) {
  pages.goto('Option-a')
} else if (n<95) {
  pages.goto('Option-b')
} else {
  pages.goto('Option-c')  
}
Brilliant, thanks, that works perfectly. I had something very similar but made a few school boy errors so it didnt work, this is perfect though
Try anything once!
boundupone
Explorer At Heart
Explorer At Heart
Posts: 487
Joined: Sat Jun 01, 2013 8:01 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: EOS - How to go to random pages with % liklihood

Post by boundupone »

Drool wrote: Sun Jun 06, 2021 7:49 am Hi.
There is also a possibility to do this without any eval.
If you have the pages
Option-a
Option-b
Option-c

and you use "goto Option-*" (note the STAR), EOS will randomly jump to one of these pages with a probability of 1/3.

If you simply copy pages and name them like

Option-a
Option-a1 (copy of Option-a)
Option-a2 (copy of Option-a)
Option-b
Option-b1 (copy of Option-b)
Option-c

you have 1/2 for 'a' 1/3 for 'b' and 1/6 for 'c'.

Crude. Primitive. The way I like it. :lol:
That is a simple workaround, thanks for the idea. For my tease though I would end up with a lot of pages!
Try anything once!
boundupone
Explorer At Heart
Explorer At Heart
Posts: 487
Joined: Sat Jun 01, 2013 8:01 pm
Gender: Male
Sexual Orientation: Straight
I am a: Switch

Re: EOS - How to go to random pages with % liklihood

Post by boundupone »

Batman314 wrote: Sat Jun 05, 2021 9:17 pm I know I'm not the best programmer on here, but I think this will work pretty well for your idea:

Code: Select all

//the function should go in the init script 
function choosePunishment(weight1, weight2, weight3){
  
  //an array with the names of the pages
  var pageArray = ['punishment1', 'punishment2', 'punishment3']
  
  //random range is the sum of the weights, you can use percentage
  //but they don't need to add to 100 this way
  var randomRange = Math.random() * (weight1 + weight2 + weight3)
  
  //the pageChoice variable will choose the location in the 
  //pageArray, and will be updated in the if statements
  var pageChoice = 0

  if (randomRange < weight1) {
    pageChoice = 0
  } 
  else if (randomRange < (weight1 + weight2)){
    pageChoice = 1
  }
  else {
    pageChoice = 2
  }

  //the function will output a string from page array 
  //at a location chosen by the the pageChoice variable
  return pageArray[pageChoice]

}//end of function

//you can call the function in a page eval action
//add whatever weights you want in the function
var nextPage = choosePunishment(70, 25, 5)
pages.goto(nextPage)
Hope it helps!

-Batman314
Thank you, really appreciate you taking the time to put this. fapnip's solution is a simpler one I am going to use, but this was interested for me to follow through to see how you did this. thank you for your help
Try anything once!
Post Reply

Who is online

Users browsing this forum: damon3, freak, milobee and 23 guests