Adding Audio

General discussion about the Genesis Web Client located at

Moderator: Eowul

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.
Post Reply
User avatar
Posts: 71
Joined: 06 Apr 2014 07:40

Adding Audio

Post by Vlek » 20 Apr 2015 06:15

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: Select all = {
  enabled: 1,
  ding:new Audio('')
Trigger that plays a sound whenever you receive a newbie (ntell) message:
Pattern: Newbie (regular text is fine here)

Code: Select all

if ( ){;
Alias to turn the music off:
Pattern: music_off

Code: Select all = 0;
gwc.output.append("Sound effects OFF");
Alias to turn the music on:
Pattern: music_on

Code: Select all = 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.

Post Reply