MM creates & calls a macro dynamically?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
wps
Posts: 74
Joined: Tue Feb 05, 2013 11:11 am

MM creates & calls a macro dynamically?

#1 Post by wps » Sat Apr 27, 2013 1:58 am

I found the in game macro efficiency is better than mm script.
I has trouble when some other player is competing the NPC chatting with me.

I guest he/she is using macro.

So I tried this macro, and it's faster than the same implement in MM.
I guest there is some communication overhead between MM and client.

Code: Select all

/run ChoiceOption(1);
/wait 0.2
/run ChoiceOption(1);
Is there any possibility that we could create a macro dynamically,
and call it in script?
After the script finished, delete the macro automatically.

Thanks.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MM creates & calls a macro dynamically?

#2 Post by rock5 » Sat Apr 27, 2013 4:34 am

Normally you can do a bunch of commands in one script which is made easier with the new "RoMCode" function, thus avoiding the overhead of multiple commands but "wait" is a slash command so I don't know if it's possible to do except in a separate command. It might be possible to write a function that uses the macro writing functions and write the macro then press the macro key but it would require that the macro be in your action bar.

I just tested this, it worked.

Code: Select all

	local command = "/run ChoiceOption(6);\n/wait 2\n/run ChoiceOption(1);"
	writeToMacro(commandMacro, command, COMMAND_MACRO_NAME)
	keyboardPress(key.VK_0)
It assumes you have the macro in the 10th actionbar slot. Note: "\n" means "new line". You could easily make it into a function that accepts any set of commands as an argument.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: MM creates & calls a macro dynamically?

#3 Post by lisa » Sat Apr 27, 2013 4:49 am

beat me to it, I was going to say you will need to use next line in order to use the /wait in the middle of a macro using MM, otherwise it just won't work. since the /wait in the example is only 0.2 you could probably do it without the wait. It all depends on ping and such.
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

wps
Posts: 74
Joined: Tue Feb 05, 2013 11:11 am

Re: MM creates & calls a macro dynamically?

#4 Post by wps » Mon Apr 29, 2013 9:10 am

Firstly, I checked the function.lua and macro.lua.
It looks like the macro should be able to run by SendMacro or ROMScript,
but it is not.

I finally got time to try Rock's solution today, and it works.

However, I don't understand why we have to drag the macro to action bar 0 first.
I tried

Code: Select all

keyboardPress(settings.profile.hotkeys.MACRO.key);
and

Code: Select all

keyboardHold(settings.profile.hotkeys.MACRO.key);
rest(100)
keyboardRelease(settings.profile.hotkeys.MACRO.key);
.
They don't work.

Is there anything I misunderstood?

Thanks for your helping.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: MM creates & calls a macro dynamically?

#5 Post by rock5 » Mon Apr 29, 2013 10:23 am

Basically, pressing the "commandmacro" key (F9) doesn't execute the macro directly, it reads the macro and executes the commands found there as a function or code. In the case of slash commands it assumes it's a one line slash command and uses the ExecuteMacroLine command to execute it. This fails if the macro has multiple slash commands. I just fixed it to execute the lines separately but it executed all lines instantly, the /wait 2 had no affect. I suspect that running a macro normally causes it to wait for each line to complete before continuing to the next line but executing them with the ExecuteMacroLine function doesn't wait or maybe "wait" just doesn't work with that function. So, at least for macros that include the "wait" command, you will still need to use the action bar key.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

wps
Posts: 74
Joined: Tue Feb 05, 2013 11:11 am

Re: MM creates & calls a macro dynamically?

#6 Post by wps » Mon Apr 29, 2013 10:57 am

Thanks Rock.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest