Page 1 of 1

EOS Code Enquiry

Posted: Fri Sep 24, 2021 11:42 pm
by IreliaDenial
Hi Code geek,

I am writing a tease these days and wondering is it possible to show the pictures/play the audio by a function.

Say, in the File/Galleries, I have two images and two different audio tracks:

"test.jpg""test_premium.jpg"
"Easy.mp3""Hard.mps"

Now, I would like to write two functions somehow like this:

function showImage(ImageID, isPremium) {
if isPremium = 0
show ImageID.jpg
else
show ImageID + "_premium.jpg"
}

function playAudio(AudioID) {
if var difficulty = 0
play "Easy.mp3"
if var difficulty = 1
play "Hard.mp3"
}

I've realized there are some API provided in the EOS editor but I'm somehow new to the coding. and, I didn't find such one to implement the show/play module above. Anyone have any ideas or suggestions?

IreliaDenial

Re: EOS Code Enquiry

Posted: Sat Sep 25, 2021 8:57 am
by Thamrill
Hi, for the audio it's possible, albeit a bit convoluted.
I saw it done in someone's tease (I can't remember the author): they added all sounds action at the start, making them continue across pages, stopping them immediately by script.
Then using the sound API they played the sound by id and stopped them when not needed, so that they would rewind.

For images, I think it's not possible, and that it requires specific IF ACTIONS, and is not doable using the API.

~Thamrill

Re: EOS Code Enquiry

Posted: Tue Sep 28, 2021 3:22 am
by IreliaDenial
Thamrill wrote: Sat Sep 25, 2021 8:57 am Hi, for the audio it's possible, albeit a bit convoluted.
I saw it done in someone's tease (I can't remember the author): they added all sounds action at the start, making them continue across pages, stopping them immediately by script.
Then using the sound API they played the sound by id and stopped them when not needed, so that they would rewind.

For images, I think it's not possible, and that it requires specific IF ACTIONS, and is not doable using the API.

~Thamrill
Ah, I see. Sad to know that image cannot be applied by Eval function
Thank you for the help!

regards,
IreliaDenial

Re: EOS Code Enquiry

Posted: Sun Oct 03, 2021 7:48 pm
by fapnip
IreliaDenial wrote: Tue Sep 28, 2021 3:22 am Ah, I see. Sad to know that image cannot be applied by Eval function
About the best you can do in an eval in Eos is goto a page that has the image you want, like:

Code: Select all

pages.goto('my-image-page')
Or, use OpenEOS, where you can change images via script at runtime.