!Adventures and gif alerts

Wanted to see if anyone here has or can provide some help with this. Wanted to make a command if possible to trigger a gif alert with a audio hooks whenever a new adventure triggers. To precise i want a certain gift for each story.

Once I have that i can figure out how to make the adventures trigger automatically every 30 minutes or so…

I would probably add a new language entry type to the Adventure System and have that kick off an alert. Like…

$.lang.register('adventuresystem.stories.1.alert', 'alert_string');

Push that to a new variable when the stories are loaded.

                game: ($.lang.exists('adventuresystem.stories.' + storyId + '.game') ? $.lang.get('adventuresystem.stories.' + storyId + '.game') : null),
                title: $.lang.get('adventuresystem.stories.' + storyId + '.title'),
                lines: lines,
                alert: $.lang.get('adventuresystem.stories.' + storyId + '.alert'),

In runStory() store the audiohook where the temp entries are built up. Extract that out like the title is as story.title to announce the start of the adventure. Run the alert directly after the title is displayed:

                if (game.equalsIgnoreCase(stories[i].game)) {
                    //$.consoleLn('gamespec::' + stories[i].title);
                        title: stories[i].title,
                        lines: stories[i].lines,
                        alert: stories[i].alert
            } else {
                //$.consoleLn('normal::' + stories[i].title);
                    title: stories[i].title,
                    lines: stories[i].lines,
                    alert: stories[i].alert


$.say($.lang.get('adventuresystem.runstory', story.title, currentAdventure.users.length));

If you also want to use an audiohook and not rely upon an audio file that is paired up with a GIF then you could add code to also handle audiohook at the same time. Since a GIF can have a related MP3 file though, it should achieve the desired effect.

I didn’t write this code out and test it. Should work, but can’t promise.

Ok everything looks correct. Question: would the gif / alert that i want to specify calling from the lang file? Also is there any formatting i need to do (such as file location or special characters) i need to call the alert in the lang file?

Whatever you would put in (alert …) is what you would put there. When an (alert) tag is used, the text in the tag, other than alert, is passed to the function I listed (alertImage).

ok so in the lang file i can simply have adventuresystem.stories.1.alert and the var would be like banana.gif to pull the banana gif file and audio ( the stock gif and sound)

Everything else looks self explanatory as you are adding the new call and trigger for the “alert”. Its just the variable string im not quite sure i got. Ill try this out tonight with the banana.gif and see where i messed up.

You nailed it. 'banana.gif' or 'banana.gif,4' or 'banana.gif,4,background:#000;top:50%'. Depending on if you want to pass a length or additional CSS.

Hopefully that is good to go, like I said, I didn’t actually code/test it. It could possibly use a check to make sure that there is actually an alert to send, as that may cause an issue, but if you are aiming to add GIF alerts to every story, shouldn’t be a problem.


banana.gif,4,background:#000;top:50% will not be working, you need to put a volume between the duration and css, like this:

1 Like

I will update the outdated documentation we have that I copied from.

Apologies for bumping an old topic… Trying to get this working to have an alert per chapter… .

I added the following in stories.push but it seems to still only show 1 alert per story:

           alert: $.lang.get('adventuresystem.stories.' + storyId + '.chapter.' + chapterId + '.alert'), 

Any ideas?