Combination! ( ) trigger help

Post Reply
MrDude
Posts: 1
Joined: Thu Sep 18, 2014 9:02 am

Combination! ( ) trigger help

Post by MrDude »

I'm trying to take the actions given in the ( ) of the pattern line and execute them one by one, all at once. The amount of moves in the ( ) can range from 1 to 9, I believe. Usually looks like this

Combination! ( rp r lp r s s )

I want it to see that and automatically input:
right punch
roundhouse
left punch
roundhouse
sweep
sweep

Thanks for the help in advance!

User avatar
Belgarath
Posts: 232
Joined: Fri Jul 26, 2013 7:19 am
Discord: macjabeth#7149

Re: Combination! ( ) trigger help

Post by Belgarath »

Hope this helps:
Code: [show] | [select all] lua
-- define combo table reference
combos = {
  rp = "right punch",
  r = "roundhouse",
  lp = "left punch",
  s = "sweep",
}

-- trigger: ^Combination! \( (.+) \)$
local c = matches[2]:split(" ")
local str = ""
for i,v in ipairs(c) do
  str = str .. combos[v]
end

selectCaptureGroup(2)
replace(str)
deselect()
There might be a better way to do it, but this was off the top of my head.

Post Reply