john-science / DecafMUD

Web-based MUD Client for the Discworld MUD
MIT License
2 stars 2 forks source link

Better Triggers Functionality #12

Open john-science opened 5 years ago

john-science commented 5 years ago

Thanks be to Quow, I have learned that most good MUD clients allow for visual and audio triggers. As it happens, my "word highlighting" feature is just a visual trigger. It sounds like my feature is not varied enough though. I need to be able to support:

  1. triggering on phrases, not just words
  2. User-selected colors for visual triggers
  3. User-selected (short, simple) audio clips to play upon trigger
  4. Since the above takes longer for the user to enter, I should use localStorage to try and persist the user-created triggers for as long as possible.

I see this changing the popup for triggers to a cascading list, something like

* [BOX TO ENTER TEXT] [color drop down] [audio drop down]   X
* [BOX TO ENTER TEXT] [color drop down] [audio drop down]   X
  [+]
john-science commented 5 years ago

I took a first pass at this, implementing:

The only thing I haven't implemented yet is: optional sounds for the triggers.

john-science commented 5 years ago

Okay, as far as audio triggers go, it looks like HTML5 has an <AUDIO> tag that is widely supported. (Al browsers have good support, except of course for IE, IE didn't start supporting until v9.)

Now I just need to find some open-source/freeware sound clips:

john-science commented 5 years ago

It turns out there are lots of places to get "free" 8-bit sound effects:

I am thinking 8-bit because (a) I want very fast sound clips and (b) I want to make this app as light-weight as possible for the users.

You can even make your own: https://www.bfxr.net/

QUESTION

Is there any way I can ensure the user doesn't have to download the file unless they need it?

john-science commented 5 years ago

Okay, the primary features here are built: we have visual and audio triggers. Awesome.

I find matching words using RegEx, which means there could be minor variations in what words get found across browsers and versions of JavaScript. These should be minor though.

The only thing to do now is more carefully play with the colors and sounds that are available: polish the look and feel of the new feature.