View unanswered posts | View active topics It is currently 12 Dec 2017 08:15

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  [ 6 posts ] 
Question about responsible use 
Author Message
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree
There's a couple of things that I want to do that would require a universal trigger (followed by a dynamic regex within the script), but I'm concerned about implementing this because I'm not 100% clear on the script interpretation. I suspect and hope that scripts are executed on the client machine, but I want to confirm that this is the case before writing such a script, since I imagine it could place undue strain on the server otherwise.

Am I good to go?

10 Feb 2016 10:17
I'm curious about what you mean, I hope someone replies to explain the reply you seek as I'm curious about triggers and stuff.

10 Feb 2016 11:37
Site Admin
User avatar

Joined: 04 Mar 2010 01:14
Posts: 265
Web Client scripts are client side so you'r fine as long as you don't send too many commands to the server.
You might run into issues with the trigger being auto-disabled if it fires too often.

10 Feb 2016 11:52
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree
Cool. Thanks, cotillion. It should only fire once per line and will only perform gwc.output.replace() calls, so no server spamming.

How does the auto-disable trigger? Is it just trigger count per some amount of time, or... ?

The script I have in mind would trigger on every line, so it could be an issue.

Actually, to be concise, what I'm planning to do is throw a handful of one-word strings (character names) into an array on userdata and then have the trigger highlight them when they appear. The issue being that the actual trigger can't read from userdata AFAIK, so it would have to be a universal trigger and then I would run a string.replace within the script in a foreach that iterates the array. (Or I'll probably look up JS regex to see if I can just compose a single regex as a string and run it through replace)


Aerylina-leafschade, the web client triggers/aliases can run short JavaScript programs. I was just checking to make sure that the script was being run on my machine locally and not on the Genesis server. If it were being run on the server then it would have been irresponsible to run a compute-heavy script like the one that I'm planning. I don't think that my script alone would have caused trouble, but if everyone used a similar script it would generate a lot of extra work for the server.

Some info if you're curious about triggers and aliases:

*When writing a plain alias you can use $1, $2, $3 to refer to arguments provided:
alias for "test"
"say TESTING: $1"
Then during play type: "test helooooo"
The command sent to the server should be "say TESTING: helooooo"

*When using a regex trigger the match is args[0] and the capture groups are args[1...?].
*If you're not familiar with regex syntax you can learn it here:
*And test/debug here:

*Special functionality is exposed through the gwc object:
- gwc.connection.send("fart"); //send the 'fart' command to the server (your character will fart)
- gwc.output.append("HELLO WORLD"); //append 'HELLO WORLD' to your local output (I think nothing gets sent to the server.)
- gwc.output.color("magenta"); //set the text color of the previous line to magenta. (
- gwc.output.color("#00FF00", "white"); //set the color of the previous line to green on a white background (
- gwc.output.replace("orc", "kitten"); //replace the word "orc" with the word "kitten" (on your display only)

Trigger on regex: .*?coin.*
var str = args[0].replace(/(coins|coin)/g, '<span style="background-color: rgb(64,64,64); color: yellow;">$1</span>');
gwc.output.replace(args[0], str, true);

The words 'coin' and 'coins' will have a grey background and yellow text. Note the use of the 'g' regex option to allow multiple replacements in a single line (since the word may appear more than once in the line).

- gwc.userdata
This object is persistent and linked to your scripts/account. Script data is per user and stored on the server, so you can change machines and your scripts will still be available to you (if you're using the web client). The gwc.userdata object can be used to store variables for use between alias and trigger scripts. For example, you could write an alias 'disembarking' and have it do:

gwc.userdata.disembarking = !gwc.userdata.disembarking;
var str = "Auto-Disembark Set To: ";
if(gwc.userdata.disembarking) { str += "on";  }
else                          { str += "off"; }

Then you can set up a trigger for "leaves the ship" and have it run:
if(gwc.userdata.disembarking) { gwc.connection.send("disembark"); }

Now you can use the command "disembarking" from the command line to turn the behavior on and off. When it's on you will automatically leave a ship when you see someone else leave (like the captain when you arrive at the destination).

Some words from Cherek about the GWC API and about GMCP: viewtopic.php?f=37&t=2947

Be bold and experiment!

Last edited by Mayobe on 10 Feb 2016 15:07, edited 1 time in total.

10 Feb 2016 14:44
-reads everything- dayum.

I haven't programmed like that since 1999 web design. 0.0

10 Feb 2016 15:05
User avatar

Joined: 23 Jan 2016 08:28
Posts: 133
Location: Bree

10 Feb 2016 15:08
Display posts from previous:  Sort by  
Reply to topic   [ 6 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.