View unanswered posts | View active topics It is currently 16 Oct 2018 07:55

Forum rules


- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.



Reply to topic  [ 1 post ] 
Adding Audio 
Author Message
Wanderer
User avatar

Joined: 06 Apr 2014 07:40
Posts: 71
Adding audio to triggers and aliases:
It was a happy coincidence to find other threads that ask for the feature that I had also thought of and figured out. The basics of the method is to use links to audio files on the web, create javascript audio objects with them, store them in their own userdata object, and then use the play method on them when the trigger or alias occurs. If you would like to switch them on and off, I'd suggest creating a variable in the music object that holds true or false and checking the state of that variable to figure out whether to play the sound in your trigger.

Here is an example of what my proposed method might look like. Remember, each of these must be set as javascript and not raw code. If you load new sounds to your music object, you must re-run your alias for the music object in order to actually use them otherwise you're going to get an error.

Alias that initializes the music userdata object:
Pattern: load_music
Code:
gwc.userdata.music = {
  enabled: 1,
  ding:new Audio('http://soundjax.com/reddo/19328%5Eding.mp3')
};


Trigger that plays a sound whenever you receive a newbie (ntell) message:
Pattern: Newbie (regular text is fine here)
Code:
if ( gwc.userdata.music.enabled ){
  gwc.userdata.music.ding.play();
}


Alias to turn the music off:
Pattern: music_off
Code:
gwc.userdata.music.enabled = 0;
gwc.output.append("Sound effects OFF");


Alias to turn the music on:
Pattern: music_on
Code:
gwc.userdata.music.enabled = 1;
gwc.output.append("Sound effects ON");



Now, remember, this is only a single music file set for one specific case. However, you can add any file you'd like that you can find online, append it to the list of songs in your music object, and set new triggers for those as well. If you find good sounds, please share them.

_________________
Args Explained - Adv. Trigger Manip - Adding Audio


20 Apr 2015 06:15
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.