Call option doesn't correctly recognize macro params

This section is created for developers and non-developers who think that he/she has a good (and realistic) idea that might contribute to the OpenKore community.

Moderator: Moderators

mooleh659
Noob
Noob
Posts: 18
Joined: 02 May 2012, 02:51
Noob?: No

Call option doesn't correctly recognize macro params

#1 Post by mooleh659 »

I have a macro config, which basically functions like this:

Code: Select all

automacro healRequest {
   pubm /(H|h)(ea|i)l pl(s|z)/, 5
   call {
     call healPlayer -- $.lastpub
   } 
}

macro healPlayer {
  $playerID = @player($.param1)
  do sp 28 $playerID
}
But the macro won't function correctly. I logged $.param1, seems to be null. I ran the healPlayer macro directly from the console, didn't have a problem.

I tried a different approach:

Code: Select all

automacro healRequest {
   pubm /(H|h)(ea|i)l pl(s|z)/, 5
   call {
      do macro healPlayer -- $.lastpub
   }
}
But it won't run because the plugin prefers the call instruction to be used instead.

Any other ideas so we can pass parameters to macros in automacros? I don't want to paste every instruction on every automacro, since I will be setting different triggers to perform the same command, and the macro itself might become huge.
EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: Call option doesn't correctly recognize macro params

#2 Post by EternalHarvest »

Macro call console command isn't the same as macro call instruction internally, the latter seems to not support arguments.

Meanwhile, you can save arguments to your custom variable before calling.