Hello,
I'd like to have my character on Imperian while bashing pick up the corpses and gold dropped after i have killed them.
Is this one that is more easier as a trigger??
i.e.
"You have slain (\w+)"
send ("get (\w+)")
send ("get gold")
or as an alias
^gcorpse$
commands:
send ("get corpse")
send ("get gold")
or, pick them up if i do IH, then do "gg" which will pick up gold and corpses..
alias: ^gg$
send ("ih")
bit lost, and a bit new to programming in LUA
Trigger or Alias??
-
- Posts: 19
- Joined: Mon Aug 02, 2010 4:35 pm
- Location: A deserted Island
Re: Trigger or Alias??
pattern: "You have slain (\w+)" (Don't forget to select perl regex pattern otherwise (\w+) will not work as expected!)
script:
send ("get " .. matches[2] )
send ("get gold")
(\w+) is perl regex lingo and makes no sense in Lua scripts. In your scripts you'll need to refer to the capture groups via the matches[n] table where matches[2] is the content of the first capture group, matches[3] the content of the second etc. (matches[1] is the complete match of your regex expression)
script:
send ("get " .. matches[2] )
send ("get gold")
(\w+) is perl regex lingo and makes no sense in Lua scripts. In your scripts you'll need to refer to the capture groups via the matches[n] table where matches[2] is the content of the first capture group, matches[3] the content of the second etc. (matches[1] is the complete match of your regex expression)
-
- Posts: 19
- Joined: Mon Aug 02, 2010 4:35 pm
- Location: A deserted Island
Re: Trigger or Alias??
okay.
so for the matches[n], how would i set them up?? as a separate alias set up for target??
A bit confused.
so for the matches[n], how would i set them up?? as a separate alias set up for target??
A bit confused.
Re: Trigger or Alias??
the matches table is provided for you by the trigger. When it matches
^You have slain (.+)$
then essentially everything after "You have slain " is captured as matches[2]
If you have multiple matches, such as with
^(\d+)h, (\d+)m
then the health would be matches[2] and the mana would be matches[3]
^You have slain (.+)$
then essentially everything after "You have slain " is captured as matches[2]
If you have multiple matches, such as with
^(\d+)h, (\d+)m
then the health would be matches[2] and the mana would be matches[3]
-
- Posts: 19
- Joined: Mon Aug 02, 2010 4:35 pm
- Location: A deserted Island
Re: Trigger or Alias??
thanks a lot!!