Page 1 of 1

Gag Trigger

Posted: 04 Jun 2017 21:30
by Shanoga
I've been searching the forums over and over using different terms, but I can't see to find what I am looking for. Ultimately, I have two questions:
  • Is there a library of commands that work for GMCP trigger inputs or javascript outputs? I only know how to kind of use regexp and would love to find a list of commands that I can work with.
  • I am trying to write a simple trigger to gag certain lines that are just spam. Specifically, I am trying to block the shouts of the orcs at Sarn Ford.
For the second piece, I have gotten close. I have been able to use

Code: Select all

gwc.output.replace (/.*/,"")
to make each line go blank, but the blank line still prints and it still spams up my conversation window. Is there a way to completely stop the printing of a line in my main game window and/or the conversation window?

Re: Gag Trigger

Posted: 06 Jun 2017 18:33
by Kwevin
Shanoga wrote:Is there a library of commands that work for GMCP trigger inputs or javascript outputs? I only know how to kind of use regexp and would love to find a list of commands that I can work with.
I don't believe so, but if there was one that would be AWESOME!! And immensely helpful.

Re: Gag Trigger

Posted: 07 Jun 2017 21:05
by Tarax the Terrible
U mean like the sticky post here?
https://www.genesismud.org/forums/viewt ... =37&t=2947
Tell u all the possible gmcp cmds

And the gwc help files here
https://genesismud.org/play/help/scripts.html
Tells u the gwc commands u can use. And links to similar gmcp documentation.


So can't see anything to gag, apart from u could black it out, not as useful I know. And u already could do that with replace.
Think it would take the admin adding a new command to the gwc for a fully functioning gag

Or maybe some JavaScript genius to tell u a way of modifying the HTML via JavaScript
More than likely that is possible but you'd need to know how things work under the hood.
Probably a totally irrelevant example here
https://www.w3schools.com/code/tryit.as ... D9T6WMHKQI

Re: Gag Trigger

Posted: 08 Jun 2017 01:13
by Shanoga
Tarax the Terrible wrote:U mean like the sticky post here?
https://www.genesismud.org/forums/viewt ... =37&t=2947
Tell u all the possible gmcp cmds

And the gwc help files here
https://genesismud.org/play/help/scripts.html
Tells u the gwc commands u can use. And links to similar gmcp documentation.


So can't see anything to gag, apart from u could black it out, not as useful I know. And u already could do that with replace.
Think it would take the admin adding a new command to the gwc for a fully functioning gag

Or maybe some JavaScript genius to tell u a way of modifying the HTML via JavaScript
More than likely that is possible but you'd need to know how things work under the hood.
Probably a totally irrelevant example here
https://www.w3schools.com/code/tryit.as ... D9T6WMHKQI
I definitely looked at the sticky and the website help file first, but the library of commands was pretty small, so I figured there were more that I didn't know about. Then again, the commands are basically exclusive to Genesis and what has been produced by the wizards so I shouldn't have expected more. I'm thankful for what we do have.

I'll check out the w3schools link and see if I can frankenstein something together in lieu of using replace. I've been using javascript for a few things here and there.

Re: Gag Trigger

Posted: 14 Jul 2018 05:46
by Shanoga
So...I was messing around in the client a bit and trying to be more informed about how JavaScript works, specifically in the webclient. In digging around, I found a command that does exactly what I want, or close enough at least. There is a built-in function:

Code: Select all

gwc.output.replace(t,e,n)
The argument t is the text that you want to match, then argument e is the text you would like to put in its place.

For example, if I wanted to replace "You jump unexpectedly." with a blank, I would have a trigger that matches the text "You jump unexpectedly." and has the following JavaScript:

Code: Select all

gwc.output.replace("You jump unexpectedly.","");
This will make it so that if you type the command <jump> then instead of printing the standard response, you will simply get a blank line. I haven't found a way to completely eliminate the line yet...and this may not be possible. But at least SOME of the spam can be eliminated (or changed, if you'd like) using the command above. Cheers!

P.S. Oh, and as far as I can tell, the third argument is to change the color of the line. I haven't messed with it, though.