Page 1 of 1

MM Window Closes Automatically

Posted: Mon Jul 08, 2013 6:02 pm
by grande
First, want to say I did a forum search for "closes" and then searched text for "mm". I'm hunting for an answer to why the MM window would close by itself. I understand I get various errors which may result in the client crashing but shouldn't the MM window remain open? It would be so much easier to pick up where things left off if the mm window remained open. Usually it does remain open but more often lately the MM window closes by itself. Thanks for any thoughts on the topic.

I'm using MM for rombot... the rom script.

Re: MM Window Closes Automatically

Posted: Mon Jul 08, 2013 10:49 pm
by Administrator
It shouldn't be closing by itself, no. It could be crashing, but I doubt it. Chances are, it is part of the auto logout script or something along those lines that causes it to exit. I think rock5 or lisa would probably know more about this than myself.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 12:25 am
by lisa
I couldn't find anything in default bot that would close a MM window, there is for closing the game window but not MM window.

I think Rock did work on that sort of thing in his login userfunction, I guess it is possible something in there is doing it but yeah I couldn't find anything in default bot to close MM so I would say there is something in a userfunction causing it.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 12:27 am
by rock5
It is set up so that when the client crashes and the bot detects it, it terminates the client then shuts down micromacro. I don't know why it does this. It's been this way since Nov 2011 when Administrator added it. I agree with you, micromacro should remain open. I seem to remember bringing it up once but I also couldn't find the post. If it's up to me I would change it so it doesn't close micromacro.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 12:36 am
by lisa
Hmm never had that happen with a crash, u can insta crash game easy.

Just make a macro using

Code: Select all

/script GetCraftItem(5,6,177)
Just tested it then and it is still trying to kill the same mob constantly even though the game crashed and has the crash report window.

It eventually got to 11 unstick tries and closed game successfully.

Code: Select all

Clearing target.
Unstick tries 11 greater then maximum allowed unstick tries 10.
07/09/13 15:37:55  Auto-logging out.
SUCCESS: The process with PID 4388 has been terminated.
Runes of Magic process successfully closed.
Did not find any crashed game clients.
3:37pm - Exiting: Auto-logout
Dumping profile data
Could just be timing of the crash I guess.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 12:43 am
by rock5
That output didn't detect a crash. When it does you would get a messages like this.

Code: Select all

Found a crashed game client and killed it. (PID %d)
This instance of MicroMacro will automatically terminate in 30 seconds.
Press ENTER to end the script and prevent termination.
Instead of

Code: Select all

Did not find any crashed game clients
It's in the errorCallback function. Line 338 in functions.lua.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 1:31 am
by rock5
I see what the problem is. For that code to be triggered the client needs to crash and the bot needs to error. Unfortunately the bot doesn't always error. Maybe there should be a check for client crash during the regular bot loop. Or maybe just a crash check added to the unstick functions.

BTW you can simulate the error by doing what you did Lisa (start a waypoint such as rbassist and enter "/script GetCraftItem(5,6,177)") then pressing ctrl-l to terminate the script. Then the client will close and you will get those error messages and MM will also close after 30s.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 2:01 am
by Administrator
I wouldn't be opposed to disabling it (I think it is just a call to os.exit()?). If I remember correctly, that was a feature you guys had requested.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 2:57 am
by rock5
How about the idea of checking for crashed clients during unsticks. I don't think unsticks will always close the client, maybe only if CLOSE_WHEN_STUCK is true, but I think it should always terminate the client if a crash is detected. I was thinking maybe make a function that checks if the client crashed and closes it, then call that in errorCallback and when unsticking. I don't like that it doesn't check if the attached client is the crashed one so I'd probably add a getWindowParent in there too.

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 3:48 pm
by Administrator
Sounds fine to me. I think the issue with detecting crashed clients was that sometimes the window would freeze for about 30 seconds before it actually crashed. MicroMacro would notice the unresponsiveness and check for the crash before it actually happened. Not sure what to do about that. I guess you can continue to keep checking for some time before eventually giving up (if no crash is detected).

Re: MM Window Closes Automatically

Posted: Tue Jul 09, 2013 9:20 pm
by grande
Hey there.. just wanted to pop in here and say thanks for discussing this. I think I'm at about 70% understanding level LOL. So I'll continue to watch and maybe learn a little. Looking forward to seeing how this develops.

Take care!

Re: MM Window Closes Automatically

Posted: Wed Jul 10, 2013 12:10 am
by rock5
Administrator wrote: I think the issue with detecting crashed clients was that sometimes the window would freeze for about 30 seconds before it actually crashed. MicroMacro would notice the unresponsiveness and check for the crash before it actually happened. Not sure what to do about that.
Ah so you are saying that the bot might error before the crash report appears? I'm not sure what we could do about that unless we could find another crashing indicator. I don't think we can just wait an arbitrary amount of time because a character could end up dying. How about the ping rate? I've noticed sometimes that when the client is about to crash the ping rate goes through the roof. Of course the client might be crashing because it has lost communication with the server, hence the high ping. If it is crashing for some other reason the ping may not go up. But then again maybe those times that take 30s to crash are always about communication.

Re: MM Window Closes Automatically

Posted: Tue Jul 16, 2013 11:53 am
by rock5
I've been working on this. I created the function which I called 'isClientCrashed'. Used it in the error callback. I tried it in the unstick but I noticed that when I crashed the client it was easy to end up trying to repeat a task that never stops. So I put the crash check at the top of the main bot loop and it seem to work fine. Seems like whatever it's doing as soon as you crash the client it closes. I'm just wondering though, whether doing a findWindowsList every bot loop would be ok. It seems to take between 2-3ms on my system.

Re: MM Window Closes Automatically

Posted: Tue Jul 16, 2013 3:16 pm
by Administrator
It should be acceptable, but you might be able to get it to only check once every 10th loop or something if it becomes a problem.