Global Mu Online

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
luonline
Posts: 21
Joined: Thu May 15, 2008 1:57 pm

Global Mu Online

#1 Post by luonline » Mon Sep 01, 2008 12:23 pm

Hi!
I've been using MiniMacro and MicroMacro for writing my own simple bots (autopick, autobuff, etc.). Until now... :(
But, since last GameGuard update, my bots run slowly. I mean, if Mu is running, my bots run slowly, but if I close Mu, bots run perfectly.
Users of others bots, like PJ or ChaosBot, haven't found any problem after renaming their executables, as shown here: http://www.mpcforum.com/showthread.php?t=228100.
Any suggestions?
Thanks in advance.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Global Mu Online

#2 Post by Administrator » Mon Sep 01, 2008 1:47 pm

It could just be a priority issue. Try setting setPriority(priority.high) to allow MicroMacro to have first dibs on processor time.

luonline
Posts: 21
Joined: Thu May 15, 2008 1:57 pm

Re: Global Mu Online

#3 Post by luonline » Mon Sep 01, 2008 2:51 pm

Hi!
elverion wrote:It could just be a priority issue. Try setting setPriority(priority.high) to allow MicroMacro to have first dibs on processor time.
I don't think so... I just uploaded here: http://solarimpact.servegame.com/phpBB3 ... ?f=3&t=123.
Maybe I'm making another mistake...
Thanx.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Global Mu Online

#4 Post by Administrator » Mon Sep 01, 2008 3:18 pm

Your while loop is pretty cluttered. This could cause it to run slow if another program is consuming large amounts of the CPU.

Code: Select all

    if (usa_autoparty and autoparty_ativo) then
      --para o timer, para nao executar esta rotina antes do tempo
      unregisterTimer("ativaAutoparty");
      autoParty();
      autoparty_ativo = false;
      registerTimer("ativaAutoparty", minutesToTimer(TEMPO_AUTOPARTY), ativaAutoparty);
    end
This kind of code should probably go before the while loop, as it only needs to be executed once. Calling registerTimer() will make the function be automatically called every once in awhile, so there is no need to constantly check if it's ready or not. You also do not need to unregister the timer and reregister it, this is done automatically, and calling these manually just adds extra work to be done. Now, instead of flipping things around and making it more complicated than it needs to be, we can call autoParty() directly, instead of ativaAutoparty().

Code: Select all

-- put this just before your while loop
if( usa_autoparty and autoparty_ativo ) then
  registerTimer("ativaAutoparty", minutesToTimer(TEMPO_AUTOPARTY), autoParty);
end
You could basically clear out your whole while loop using this approach. One other thing I noticed is that you're not making a call to coroutine.yield() directly inside of your while loop. This could potentially make things appear slower, as the timers may not be getting the time they need to processes. You do, however, use myrest() to make a call to yrest() and coroutine.yield() inside of your subfunctions.

If you're using MicroMacro 0.98, you do not need to manually call coroutine.yield() along-side of yrest() to make sure it calls it at least once. This is done automatically now, so you can just use yrest() directly. Now your while loop can look like this:

Code: Select all

while(true) do
  yrest(1);
end
So now your timers will be getting the time they need, and your while loop will waste less CPU power. It's hard to say if this will fix your problem or not without trying.

luonline
Posts: 21
Joined: Thu May 15, 2008 1:57 pm

Re: Global Mu Online

#5 Post by luonline » Mon Sep 01, 2008 6:24 pm

First of all, thanks for all suggestions. And I'll try to explain my code...
elverion wrote:Your while loop is pretty cluttered. This could cause it to run slow if another program is consuming large amounts of the CPU.
Maybe it's cluttered because that script is suitable for many kinds of MU chars.
elverion wrote:

Code: Select all

    if (usa_autoparty and autoparty_ativo) then
      --para o timer, para nao executar esta rotina antes do tempo
      unregisterTimer("ativaAutoparty");
      autoParty();
      autoparty_ativo = false;
      registerTimer("ativaAutoparty", minutesToTimer(TEMPO_AUTOPARTY), ativaAutoparty);
    end

This kind of code should probably go before the while loop, as it only needs to be executed once. Calling registerTimer() will make the function be automatically called every once in awhile, so there is no need to constantly check if it's ready or not. You also do not need to unregister the timer and reregister it, this is done automatically, and calling these manually just adds extra work to be done.
Let's suppose that TEMPO_AUTOPARTY is set to 1 minute and the effective running time of autoParty() is 2 minutes. I stoped "ativaAutoparty" timer to avoid that autoParty() could be triggered while it's already running.
elverion wrote:Now, instead of flipping things around and making it more complicated than it needs to be, we can call autoParty() directly, instead of ativaAutoparty().
I prefer to call autoParty() by myself, avoiding to get it triggered automatically while another function is running, for example autoDrop(). BTW, autoPick() is called directly by its timer, but it doesn't mess with other functions, as it only presses the space bar and doesn't interact with any item of the GUI, like inventory, menus, etc.
elverion wrote:

Code: Select all

-- put this just before your while loop
if( usa_autoparty and autoparty_ativo ) then
  registerTimer("ativaAutoparty", minutesToTimer(TEMPO_AUTOPARTY), autoParty);
end

You could basically clear out your whole while loop using this approach.
I hope that I made myself clear and I could explain my approach...
elverion wrote:One other thing I noticed is that you're not making a call to coroutine.yield() directly inside of your while loop. This could potentially make things appear slower, as the timers may not be getting the time they need to processes. You do, however, use myrest() to make a call to yrest() and coroutine.yield() inside of your subfunctions.

If you're using MicroMacro 0.98, you do not need to manually call coroutine.yield() along-side of yrest() to make sure it calls it at least once. This is done automatically now, so you can just use yrest() directly. Now your while loop can look like this:

Code: Select all

while(true) do
  yrest(1);
end
OK, I will fix it.
elverion wrote:So now your timers will be getting the time they need, and your while loop will waste less CPU power. It's hard to say if this will fix your problem or not without trying.
I don't know... It worked great before GG update. Is it possible that GG is slowing down some programs based on their behavior?
Once again, I enjoyed all your contribs.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Global Mu Online

#6 Post by Administrator » Mon Sep 01, 2008 6:48 pm

Yes, it is possible. Using setPriority() as previously stated should give you higher priority, and therefor it should run at normal speed again.

luonline
Posts: 21
Joined: Thu May 15, 2008 1:57 pm

Re: Global Mu Online

#7 Post by luonline » Mon Sep 01, 2008 7:09 pm

elverion wrote:Yes, it is possible. Using setPriority() as previously stated should give you higher priority, and therefor it should run at normal speed again.
But, unfortunatelly, I already did it... See:

Code: Select all

function main()
  attach(win);
  setPriority(priority.high);
And it doesn't work.
Anyone else use MU+Micromacro?
Thanx in advance.

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Global Mu Online

#8 Post by Administrator » Mon Sep 01, 2008 8:11 pm

Try renaming micromacro.exe to JoyToKey.exe. That sometimes works.

luonline
Posts: 21
Joined: Thu May 15, 2008 1:57 pm

Re: Global Mu Online

#9 Post by luonline » Mon Sep 01, 2008 9:32 pm

elverion wrote:Try renaming micromacro.exe to JoyToKey.exe. That sometimes works.
With this name, nothing happens, not even slowly... :cry:
But, I just realized a crazy thing: I got DC (disconnect) from the game and, when I logged on again (without restarting micromacro), my bot run perfectly!
Strange, hun?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Global Mu Online

#10 Post by Administrator » Mon Sep 01, 2008 10:19 pm

As long as it works, it works, I guess. I'll look into it further when I get some time.

luonline
Posts: 21
Joined: Thu May 15, 2008 1:57 pm

Re: Global Mu Online

#11 Post by luonline » Tue Sep 02, 2008 7:31 am

elverion wrote:As long as it works, it works, I guess. I'll look into it further when I get some time.
:D
OK, I'd aprecciate it. And I will do some tests here...

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests