Then it's the HTML5 client. Which is good news! At the bottom right, you've got a "help" icon. Click it, and you have a scripting guide and some examples to the left.
Regular expressions are used when matching stuff. There are a couple of things to note about them:
Anything you want to save for use in the script should be placed in parentheses. Otherwise it will only be used to match.
You can match variable strings by using wildcards. A period matches any character. Brackets can be used to specify which characters should be matched.
Along with wildcards, you can also use modifiers to decide how much you want to match. By default, they match one character. If you place + after the wildcard, you match one or more. An asterisk behind it means none or more.
Example: My prompt might look like "100h, 100m, 10000e, 10p, 10000w ex-". I want to get the health out of that (ignoring that there are easier ways). I thus create a trigger that looks like this:
I use brackets to specify that I'm looking for characters between 0 and 9 (i.e. any digit). Behind I put a + to say I want one or more digit. Further, I place them in parentheses because I actually want to use the values.
I couldn't think of anything fancy to do though, so all that trigger does is this:
print("Health: "+args[1]);
Which just prints out the first matched captured value (i.e. my health). If I wanted to use my mana, I'd use args[2] etc.
Comments
Anything you want to save for use in the script should be placed in parentheses. Otherwise it will only be used to match.
You can match variable strings by using wildcards. A period matches any character. Brackets can be used to specify which characters should be matched.
Along with wildcards, you can also use modifiers to decide how much you want to match. By default, they match one character. If you place + after the wildcard, you match one or more. An asterisk behind it means none or more.
Example: My prompt might look like "100h, 100m, 10000e, 10p, 10000w ex-". I want to get the health out of that (ignoring that there are easier ways). I thus create a trigger that looks like this:
"([0-9]+)h, ([0-9]+)m, ([0-9]+)e, ([0-9]+)p, ([0-9]+)w"
I use brackets to specify that I'm looking for characters between 0 and 9 (i.e. any digit). Behind I put a + to say I want one or more digit. Further, I place them in parentheses because I actually want to use the values.
I couldn't think of anything fancy to do though, so all that trigger does is this:
print("Health: "+args[1]);
Which just prints out the first matched captured value (i.e. my health). If I wanted to use my mana, I'd use args[2] etc.
Note that this is a _very_ boiled down version of what you can do with regex. If you want to see it all (and then some), have a look at http://en.wikipedia.org/wiki/Regular_expression