Gag Trigger

General discussion about the Genesis Web Client located at https://www.genesismud.org/play/

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
Shanoga
Wizard
Posts: 193
Joined: 03 Mar 2014 13:03
Location: US West

Gag Trigger

Post by Shanoga » 04 Jun 2017 21:30

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?

Kwevin
Veteran
Posts: 207
Joined: 21 Mar 2016 09:17

Re: Gag Trigger

Post by Kwevin » 06 Jun 2017 18:33

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.
Alea iacta est. Serius regredi est.

User avatar
Tarax the Terrible
Myth
Posts: 1331
Joined: 09 Mar 2010 20:33
Location: UK

Re: Gag Trigger

Post by Tarax the Terrible » 07 Jun 2017 21:05

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
http://genesisquests.pbworks.com/
Join up and help each other with Quests :)

User avatar
Shanoga
Wizard
Posts: 193
Joined: 03 Mar 2014 13:03
Location: US West

Re: Gag Trigger

Post by Shanoga » 08 Jun 2017 01:13

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.

User avatar
Shanoga
Wizard
Posts: 193
Joined: 03 Mar 2014 13:03
Location: US West

Re: Gag Trigger

Post by Shanoga » 14 Jul 2018 05:46

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.

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/