HTML5 Generic Curing Script

imageCan someone help me fix this script? (Ignoring illusions and blance etc for now)
Thanks.



Comments

  • You might want to add $ after the period, and backslash the period, though I'm not sure if that's needed for the HTML5 client.

    I'm not familiar enough with the script the HTML5 client uses to troubleshoot your script, though it looks fine to me.

  • Thanks. I'm 90% %w won't be recognized inside the javascript code,  (The html5 client uses Javascript for everything)  but I can't figure out what the correct syntax is.

    So the regex line should look like this?

    ^You have been afflicted with {%w}\.$ ?
  • edited September 2014
    Reading the help file more closely, I think the regex needs to be either :

    ^You are afflicted with (\w+).$
    or

    ^You are afflicted with (\w+)\.$

    However, I'm having a hard time parsing this paragraph here:
    • Functions called by a command receive an args variable, which contains the individual words used after the function name, accessed using args[0], args[1],. ....
    • Functions called in a trigger receive information about the match - args.text, args.match, args.prefix, args.suffix, args.backrefs[1], ...
    • Scripts receive the backrefs (args[0]., args[1],. args[2], ...) and the current_package variable indicating the active package (see below).

    I have not managed to get "functions" to work at all yet, so I'm just using "scripts" for now.
  • You can think of functions as script-aliases. You write a function that will contain a set of scripts - you can then call the function up in other triggers, and it will execute those scripts without you needing to copy/paste the whole wall of script into every trigger that you want it in. Arguments (args in the documentation) are basically variables that you send to the function, and which the scripts you write within that function can use as variables.

  • edited September 2014
    I've tried both putting the code in  function() { code here }, and without it, but I can't get them to actually execute *shrug*
    But even then, I'm not sure if I'm supposed to use args.match or args.backrefs[1] in place of %w. 

Sign In or Register to comment.