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
EOS - How to go to random pages with % liklihood
-
- 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
Try anything once!
Re: EOS - How to go to random pages with % liklihood
I know I'm not the best programmer on here, but I think this will work pretty well for your idea:
Hope it helps!
-Batman314
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)
-Batman314
- Drool
- 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
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.
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.
Re: EOS - How to go to random pages with % liklihood
There's 101 ways to do it, but here's another option: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
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')
}
-
- 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
Brilliant, thanks, that works perfectly. I had something very similar but made a few school boy errors so it didnt work, this is perfect thoughfapnip wrote: ↑Sun Jun 06, 2021 5:22 pmThere's 101 ways to do it, but here's another option: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
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') }
Try anything once!
-
- 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
That is a simple workaround, thanks for the idea. For my tease though I would end up with a lot of pages!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.
Try anything once!
-
- 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
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 helpBatman314 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:
Hope it helps!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)
-Batman314
Try anything once!
Who is online
Users browsing this forum: damon3, freak, milobee and 23 guests