EOS creating choice actions with script

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
User avatar
Moonwhore
Curious Newbie
Curious Newbie
Posts: 2
Joined: Sat Mar 26, 2022 12:24 am
Gender: Male
Sexual Orientation: Straight

EOS creating choice actions with script

Post by Moonwhore »

does any javascript pros know if it's possible to create choice actions with a script
basically i have a large set and want to choose a subset and make them options in a choice module, but there are a looot of combinations
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 709
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: EOS creating choice actions with script

Post by kerkersklave »

Could be give an example of what you want?

Choice actions can only have a fixed set of choices with fixed labels, you can just hide choices via a javascript condition. So you could make a big choice action listing all possible choices and enable just the subset you need. If there are two many options to do that you can give them generic names like A,B,C, use a say option to list the active choices. If there are too many active options to show them all you can use a text input and ask the reader to type in his choice.
User avatar
Moonwhore
Curious Newbie
Curious Newbie
Posts: 2
Joined: Sat Mar 26, 2022 12:24 am
Gender: Male
Sexual Orientation: Straight

Re: EOS creating choice actions with script

Post by Moonwhore »

well say the user is given a choice between 3 tasks, out of 25 total possible different tasks.
would be 2300 different combinations, way too obnoxious to manually create the modules for it
but maybe it's not possibe to do with a script idk.
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 creating choice actions with script

Post by Thamrill »

Unfortunately it's not directly possible. One alternative to achieve something similar is to have the choice action to have only options identifiers (e.g., "A", "B", "C") and have a "Say" action that can be procedurally written to associate a task to one of the options
Image

Image

Image
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 709
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: EOS creating choice actions with script

Post by kerkersklave »

Do you mean something like that: https://milovana.com/webteases/showteas ... d7eb3516cb
I made the example for 5 tasks, but it should be easy enough to scale up to 25.

Get source-code: https://milovana.com/webteases/geteossc ... d7eb3516cb
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1070
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: EOS creating choice actions with script

Post by PlayfulGuy »

kerkersklave wrote: Mon Sep 30, 2024 12:55 pm Do you mean something like that: https://milovana.com/webteases/showteas ... d7eb3516cb
I made the example for 5 tasks, but it should be easy enough to scale up to 25.

Get source-code: https://milovana.com/webteases/geteossc ... d7eb3516cb
Nice solution!

You could even add a function to the init module like recordTask(name, page) to build two lists, one that holds the task name and the other the name of the page that implements that task. Then you just step through the list of page names going to the next one in sequence to perform the tasks.

Good stuff!
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 709
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: EOS creating choice actions with script

Post by kerkersklave »

PlayfulGuy wrote: Tue Oct 01, 2024 2:55 pm You could even add a function to the init module like recordTask(name, page) to build two lists, one that holds the task name and the other the name of the page that implements that task. Then you just step through the list of page names going to the next one in sequence to perform the tasks.
Not sure what you want exactly. After the choice-step you've got a list currentChoices of the names of tasks. Do you want to use the goto-Action with a dynamic page name to go through the tasks? So you need a mapping from task names to page names, as you do not want to use the same name for both? In Javascript you can define a mapping like this:

Code: Select all

var taskToPage = {"task 1": "pageSomething", "task 2": "pageWhatever"}
and then look it up like this:

Code: Select all

taskToPage["task 1"]
User avatar
PlayfulGuy
Experimentor
Experimentor
Posts: 1070
Joined: Sat Jul 07, 2012 10:08 pm
Gender: Male
Sexual Orientation: Bisexual/Bi-Curious
I am a: Switch
Dom/me(s): No domme
Sub/Slave(s): No sub
Location: British Columbia, Canada

Re: EOS creating choice actions with script

Post by PlayfulGuy »

kerkersklave wrote: Wed Oct 02, 2024 4:55 pm
PlayfulGuy wrote: Tue Oct 01, 2024 2:55 pm You could even add a function to the init module like recordTask(name, page) to build two lists, one that holds the task name and the other the name of the page that implements that task. Then you just step through the list of page names going to the next one in sequence to perform the tasks.
Not sure what you want exactly. After the choice-step you've got a list currentChoices of the names of tasks. Do you want to use the goto-Action with a dynamic page name to go through the tasks? So you need a mapping from task names to page names, as you do not want to use the same name for both? In Javascript you can define a mapping like this:

Code: Select all

var taskToPage = {"task 1": "pageSomething", "task 2": "pageWhatever"}
and then look it up like this:

Code: Select all

taskToPage["task 1"]
I wasn't really asking anything there, I was complimenting you on your solution and observing that it opened further possibilities... The way I worded my reply was just awkward when I said "you could even add" with a generic "you", not meaning you specifically. Sorry about that. I try to be more clear in my replies but blew it there.

PG
Post Reply