Advanced Trigger Manipulation with Javscript

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

Advanced Trigger Manipulation with Javscript

Post by Vlek » 24 Apr 2015 02:50

Triggers generally are set and then forgot about, but, in the cases where one would like to have multiple settings for one trigger or, in some very annoying instances, when one would like a trigger to only perform a task in a specific case and then completely ignore all others, there's a way to set and re-set one's triggers programmatically. The method hinges on having functions set within one's userdata that are called by the trigger, and, when one wants to set, reset, or unset a trigger, one simply has to make the associated userdata function an empty one.

Lets see what that might look like:

Alias that pre-loads the userdata trigger functions:
Pattern: load

Code: Select all

gwc.userdata.triggers = {
    no_such_creature: function(){},
    too_heavy: function(){},
    you_killed: function(){}

Trigger for "You killed "

Code: Select all


After that, you would then have a "profile"-like alias that sets the triggers for a given situation:

Alias that loads situational trigger usage:
Pattern: orc_killer

Code: Select all

gwc.userdata.triggers.no_such_creature = function(){
   gwc.connection.send('kill orc');

Now, whenever one kills something, it will immediately try to attack an orc in the area. This is very useful for individuals that know for a fact that they will be needing specific responses for a special case that they are doing that they will have to either turn off or completely alter in the near future. This has the added bonus of using the "load" alias in order to remove any loaded profiles without having to do so by hand. Any number of profiles can then be made and be used to quickswap triggers.

Post Reply