Eos API Questions

Post all technical issues and questions here. We'll gladly help you wherever we can.
Post Reply
JohnDoe91741
Curious Newbie
Curious Newbie
Posts: 2
Joined: Fri Mar 06, 2020 11:14 pm

Eos API Questions

Post by JohnDoe91741 »

Hi there,

I'm currently exploring the features of the Eos editor, and I have some questions about what exactly I am able to do programmatically in Eos.

For example, am I able to set images via the API? And if so, what would a path look like? Let's assume I have a gallery called foo with an image bar.jpg. Is it possible to do something like: pages.setImage('foo/bar.jpg')?

In a similar vein, can I set the option labels and their corresponding target pages for a choice programmatically?

And finally, can I construct a timer programmatically, in terms of the duration, visual style and behaviour?

These features, which essentially allow you to build a page via the API, would be very helpful since they would greatly decrease the number of pre-defined (i.e. static) pages required to capture randomized behaviour.

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

Re: Eos API Questions

Post by kerkersklave »

There is no such API to build pages. You can however build pages were certain parts are determined by JavaScript code.
You can have eval actions at many places to modify variables etc., this works also for the actions of choices.
You can use JavaScript to calculate the duration of a timer.

You cannot use JavaScript for the name of an image or the options of choices.
I solved the issue with the images using a massive if-then-else-cascade. I wanted a page were 1 of about 100 images was shown based on certain conditions. So there are just 1 hundred ifs with respective image actions.

As this is very time consuming to do in the editor, I just exported the JSON opended it in a text-editor and generated the if statements. I might even have used some script to do that. The structure of the JSON file is very easy to understand, so generating it is also an option for more complicated things.
JohnDoe91741
Curious Newbie
Curious Newbie
Posts: 2
Joined: Fri Mar 06, 2020 11:14 pm

Re: Eos API Questions

Post by JohnDoe91741 »

Thank you for the reply!

I tried your approach with an eval, followed by an if-then-else construction. This is a good option to avoid having many static pages, but the downside is that your 'dynamic' pages become very messy very quickly :-(

Could you share the JS code for setting a timer's duration? That would be much appreciated.
User avatar
lolol2
Explorer At Heart
Explorer At Heart
Posts: 507
Joined: Mon Feb 20, 2017 10:33 am
Gender: Male
Sexual Orientation: Straight

Re: Eos API Questions

Post by lolol2 »

I also miss the option to set images and audio from the script part and use variables to build up the names. Would be so much more flexible to show stuff based on conditions. :-(
kerkersklave wrote: Thu Mar 26, 2020 1:37 pm I wanted a page were 1 of about 100 images was shown based on certain conditions. So there are just 1 hundred ifs with respective image actions.
Why not having one if/else loop to check the condition, if it not match just show a random pic out of the galery with the other 99 pics. When the condition match then show the one special image.

Or do I get this wrong?
My creations:
Spoiler: show

[Tutorial] Building your own DIY E-Stim Stereo Device

Videos:
06/2020 - Estim Sync Hero Vol. 01

Teases:
04/2020 - Estim Mansion under Quarantine
12/2019 - Estim Challenge
12/2018 - Estim Distraction
03/2018 - The Estim Tower - Endless Mode
01/2018 - The Estim Tower
05/2017 - The Estim Mansion
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 556
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: Eos API Questions

Post by kerkersklave »

lolol2 wrote: Thu Mar 26, 2020 5:06 pm Or do I get this wrong?
Well, what I wanted to do is to randomly generate a maze. So I basically had one page that was shown over and over again and kept track of the location of the user. But of course I wanted to show the same picture each time when you came back to a room.
So I could not just select a random one each time but had to randomize in the beginning and then pic the picture from a list.
The only way to achieve that is to have a if-branch for each picture.
kerkersklave
Explorer At Heart
Explorer At Heart
Posts: 556
Joined: Sun Jul 06, 2014 2:11 pm
Gender: Male
Sexual Orientation: Open to new ideas!
I am a: Slave

Re: Eos API Questions

Post by kerkersklave »

JohnDoe91741 wrote: Thu Mar 26, 2020 1:58 pm I tried your approach with an eval, followed by an if-then-else construction. This is a good option to avoid having many static pages, but the downside is that your 'dynamic' pages become very messy very quickly :-(
I put the whole thing into one if with "true" as condition. So it does not show in the main action list of the page. This way I could still edit that page without scrolling to all these ifs. It is not ideal but it is a hack.
JohnDoe91741 wrote: Thu Mar 26, 2020 1:58 pm Could you share the JS code for setting a timer's duration? That would be much appreciated.
You have to do it in the settings of the timer. There, you can switch to JavaScript expressions for the duration.

The reason for there being no API to change pictures and images is apparently that the viewer is doing some preloading of the next pages, so it has to know what these are. Of course my approach makes it preload all images immediately. And indeed there is a little pause before visiting that page the first time.
alexfayer
Explorer
Explorer
Posts: 42
Joined: Sun Jan 04, 2015 7:22 pm
Gender: Male
Sexual Orientation: Straight

Re: Eos API Questions

Post by alexfayer »

It would be great if we could preload the picture manually and then set it later via code.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests