Page 2 of 2

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Wed May 11, 2011 11:12 pm
by rock5
Administrator wrote:Well, that is annoying. "Crash Report" is a bit too general for me. Can you double check the class name?

Code: Select all

local win = findWindow("Crash Report");
local class = getWindowClassname(win);
printf("Class: %s\n", class);
I got The same number.

Code: Select all

Class: #32770
Even if there was a way to make sure that it is a Runes of Magic crash, you still need to know which game client crashed if you have more than one running, wouldn't you? Isn't there any way to see what process opened the crash window? That's what you need to know which game crashed.

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Wed May 11, 2011 11:32 pm
by rock5
I had a bit of a look at the process functions and it looks like it would work.

During the "selectGame()" function it gets the 'process' but eventually discards it. Couldn't it save it then when checking if the game has crashed do something like;

Code: Select all

if findProcess("Crash Report") == process then
   -- The game has crashed. Force close it.
end

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 12:17 am
by Administrator
Well, you could always check to make sure that the window is still valid. If not, then assume it was the one that crashed.

Code: Select all

if( findWindow("Crash Report", "#32770") and not windowValid(getWin()) ) then
 -- This must be the client that crashed.
end

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 1:12 am
by rock5
How do you check to see if a window is still valid? When the crash report window appears the client window is still there.

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 1:49 am
by Administrator
Oh, hmm, that would prevent windowValid() from working, then. Does spy++ or Winspector have a function to check for parents? If so, that could be used.

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 3:33 am
by rock5
I don't know, do they?

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 5:27 am
by Administrator
Doesn't look like Winspector does. I do not have spy++.

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 6:29 am
by rock5
There is something about Parent on this tab. Is this what you want?

Re: REQUEST: Crash detection at line 574 in functions.lua

Posted: Thu May 12, 2011 8:11 am
by Administrator
That's it! Seems like the parent window handle is, in fact, the client's window that has crashed. I'll just have to add a function to MicroMacro to make use of this.

Go ahead and give the attached executable a try. The function is getWindowParent(). It returns nil if it does not have a parent or some error occured.

Code: Select all

local crashReport = findWindow("Crash Report", "#32770"); -- Something crashed
local crashedClientWin = getWindowParent(crashReport);
if( crashedClientWin == getWin() ) then
  -- The client we are controlling crashed; do something
end