Feature update – new syntax for *wait, custom events

Here’s what’s new:

*wait syntax update

We have updated the way you tell GuidedTrack how long to *wait. This change will not make your running programs break, but if you edit a program that contains this keyword you will get an error message prompting you to use the new syntax. 

In the example below, the program waits 4 seconds before displaying the button:  

Basically, now there is a period between the number and the word “seconds” or “minutes”. The changes we have made now allow you to:

WAIT A FRACTION OF A SECOND
Do you want your program to display an image exactly for 0.7 seconds? Just enter it!

USE VARIABLES TO SPECIFY DELAYS
You do not need to set the wait time when writing your program, it can be generated at runtime. In the example below, the user enters the number of seconds to wait:

WAIT A COMBINATION OF MINUTES AND SECONDS
If you know how many minutes and seconds you want your program to wait, you can do the conversion to seconds or skip it and write it this way:
*wait: 2.minutes + 4.seconds

WAIT FOREVER
This is especially useful when your program has navigational elements other than questions and buttons – i.e. when you are using the keyword *navigation or clickable *components.  Using *wait without any duration will stop the navigation indefinitely (without ending the run of the program) until a navigation element or *component is clicked. See the syntax below:

This is how this program looks, and this is what it looks like without *wait.

Custom events

We introduced the keyword *events with the attribute *startup to have your GuidedTrack program do something every time that a user returns to it. Now we have enhanced its functionality so that you can trigger custom events using JavaScript. This is a super powerful tool that allows you to control the program navigation using events and even send data from JavaScript to GuidedTrack. 

This feature is only for when embedding your program on a website and you will need to have a working knowledge of HTML and JavaScript.

Here is a simple program that uses custom events:

The program above has an event called “loadFinalPage”. In order to trigger this event, you would have a script in the page where the program is embedded that would look like this:

jQuery(window).trigger(‘loadFinalPage’, {“message”:”going to final page”, “message2″:”because a button was clicked”})

Note that the event’s name in the JavaScript code matches the name in your program!

When the JavaScript event occurs, the GuidedTrack code under the event runs immediately. See also how the JavaScript code passes an array of data that gets stored in the association it so that you can read this data from within the program. So, if the event loadFinalPage is triggered as shown above, the sample program will display message1 and message2 and then go to the label final_page no matter where the navigation was at that point.

Also, know that your program can have different events, you just need to create them as shown above.