Regular expressions
The examples I gave used:
^ - start of line
$ - end of line
Just leave them out if that is not what you want.
eg.
^Nick$ - "Nick" alone on the line
^Nick - "Nick" at the start of the lione
Nick$ - "Nick" at the end of the line
Nick - "Nick" anywhere on the line
Wildcards in timers
Quote:
I know how to use addtimer, but what if i wanted to put a wildcard into it
world.addtimer "blah", 0, 0, 2, "(need to punt wildcard here)", 5, ""
I'm not sure what you mean here. A timer goes off after so many seconds, you don't put a wildcard in it. However if you mean the wildcard from the trigger, here is an example. Say you have a trigger that matches on a monster name, eg.
* attacks you!
Then in this case the monster name is wildcard #1. So, to make a timer that says "kick dragon" after 2 seconds (assuming that the monster is a dragon) you would do this:
sub OnAttack (TriggerName, TriggerLine, Wildcards)
World.addtimer "my_timer", 0, 0, 2, "kick " + Wildcards (1), 5, ""
end sub
By using "+" you concatenate together two strings, in this case "kick" and the contents of wildcard 1.
Wildcards in aliases
Quote:
Same goes for an alias I need to make
Alias:
^(.*)= (.*) (.*)$
Punch right=rp @attacker
You would do a similar thing there ...
sub OnAliasCreation (TriggerName, Triggerline, arrWildCards)
world.AddAlias ("alias_" + cstr (world.getuniquenumber), arrWildCards (1), arrWildCards (2) + arrWildCards (3), 1 + 1024, "");
end sub
What the above is doing is:
Alias name: alias_22 (just a unique name for it)
Match on: Wildcard 1
Send: Wildcard 2 + Wildcard 3
Flags: Enabled + Replace any existing one of the same name
Script: None
|