PlayfulGuy wrote: Wed Apr 07, 2021 2:18 am
How much javascript do you use in your tease? The biggest challenge I have had converting EOS to Guideme is converting javascript to work. The two platforms have different interfaces and libraries available and some need for translation is inevitable.
Though EOS is a better environment in some ways, so it may actually be easier to translate from Guideme to EOS.
PG
The main use of Javascript in the tease in playing ogg-files at a certain volume. I'm also using it to change the text while on the same page and to block/unblock buttons (but I could do that in basic XML to by jumping to the next page when the buttons need to become available). In the future, I'd like to use Javascript for basic global variable stuff as well (like load a difficulty setting for the tease, or load the volume related to the difficulty setting).
This is an example of the most complex Javascript I'm using right now:
Code: Select all
<Text>Silence? I'm guessing you don't like it here then.</Text>
<Image id="others/AbigailMac1/AbigailMac1-11.jpg"/>
<Delay seconds="22" style="hidden" target="enc203-05"/>
<javascript>
<![CDATA[
function pageLoad() {
overRide.setAudio("_audio/104a.ogg","","","","","","","",70);
overRide.addTimer("6", "", "", "That's a shame, but maybe I can help you!", "", "", "");
overRide.addTimer("12", "", "", "Would you like me to help you?", "", "", "");
overRide.addTimer("13", "enablebuttons()", "", "", "", "", "");
overRide.addButton("enc203-05a", "No thanks!", "", "", "", "", "", "", true, "Btn203e");
overRide.addButton("enc203-05b", "Yes, please!", "", "", "", "", "", "", true, "Btn203f");
}
function enablebuttons() {
guide.enableButton("Btn203e");
guide.enableButton("Btn203f");
}]]>
</javascript>
</Page>
And also this:
Code: Select all
<javascript>
<![CDATA[
function pageLoad() {
overRide.setAudio("_audio/103a.ogg","","","","","","","",70);
if (guide.isSet("2301") || guide.isSet("2302")) {
overRide.addTimer("6", "", "others/AbigailMac1/AbigailMac1-12.jpg", "It is clear to me that your mind is in need of some minor corrections.", "", "", "");
overRide.addTimer("12", "", "", "Let's start right away.", "", "", "");
overRide.setDelay("enc203-07", "18", "", "", "", "", "");
}
else {
overRide.addTimer("6", "", "", "You seem to be in good mental health!", "", "", "");
overRide.addTimer("12", "", "", "I'll be slowly taking off the rest of my clothes and sending you relaxing waves. Enjoy!", "", "", "");
overRide.setDelay("enc203-06", "18", "", "", "", "", "");
}
}]]>
</javascript>
Hopefully this is not to complex :)