!Adventures and gif alerts

commands
phantombot

#1

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…


Audio hook in bot response
#2

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.

            stories.push({
                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);
                    temp.push({
                        title: stories[i].title,
                        lines: stories[i].lines,
                        alert: stories[i].alert
                    });
                }
            } else {
                //$.consoleLn('normal::' + stories[i].title);
                temp.push({
                    title: stories[i].title,
                    lines: stories[i].lines,
                    alert: stories[i].alert
                });

...

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

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.


#4

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?


#5

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).


#6

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.


#7

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.

Cheers


#8

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


#9

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