Page 1 of 1
Crash without detection.
Posted: Thu Jan 01, 2015 11:07 am
by NonAnon
Hello.
Day before yesterday my bot for first time detected crash and re-initialized game. It was splendid!
I wonder if there is any way to make it common for me...
ATM every time my client Crash i get crash report, and click cancel OR
Sometimes i get error from windows that program doesn't respond so i kill by task manager.
Either ways i get in micromacro:
Code: Select all
The game client did not crash.
2015-01-01 17:01:05 - scripts\rom/login.lua:51: D:/micromacro/scripts/rom/classes/pawn.lua:156: bad argument #1 to 'readfunc' ((null))
or something about 1515 in function.lua about bad argument to "memoryReadBytePtr" but i didn't copy it... (function IsInGame)
Some help?
IF sth isn't clear because of my English, ask
Re: Crash without detection.
Posted: Thu Jan 01, 2015 12:01 pm
by BlubBlab
That happened around 5% of all the times because at exact that moment rombot is stuck with reading the memory unfortunately rombot can't see the windows error message because which process raised it is unknown.
I don't want to into much details perhaps we can add some code into MM2 perhaps a flag which turn the error into a message as a return value and we could see if we find some method to identify who had the error, there was some problems with the OS because they changed the method after XP but I think we could start to ignore this.
EDIT:For those windows report messages if it is an extra PC you can deactivate them the game will simple close than instead of trying to find a solution.
For the rest I need admin's input.
Re: Crash without detection.
Posted: Thu Jan 01, 2015 3:01 pm
by Administrator
The actual memory read operation should actually only throw a warning and not terminate the script. The problem here is that the function is receiving NULL input and that is throwing an error later in the script. To fix it, the variable 'proc' should be checked to see if it is still valid before each read.
Re: Crash without detection.
Posted: Thu Jan 01, 2015 3:32 pm
by BlubBlab
I don't see how can 'proc' be checked by the script it is userdata, the only way is by checking the return vales and reroute the error handling to the restart script which start ROM. But essentially I see it so that it is in care taking of the who call's the functions what return vales he/she/whoever gets
But when I see the code of MM2 it rise always an error?
If so maybe instead of adding args to the function , a function which switch a global boolean var would be much easier to implement and less confusing.
I did that twice now with adding args for debug troublesome especially when you have already optional args.
Re: Crash without detection.
Posted: Thu Jan 01, 2015 3:43 pm
by Administrator
BlubBlab wrote:But when I see the code of MM2 it rise always an error?
Memory read failures return nil and push an error event (to get the error string), but does not throw a Lua error to terminate the script. Memory write failures return a boolean that signals the success or failure, and also pushes an error event.
If so maybe instead of adding args to the function, a function which switch a global boolean var would be much easier to implement and less confusing.
I'm not sure I understand what you're saying here.
Re: Crash without detection.
Posted: Thu Jan 01, 2015 5:44 pm
by BlubBlab
Okay if the script continue it doesn't matter.
What I meant is in the MM2 CV modul and in another userfunction script for rombot I made it so that in Cv so that with the last argument as a boolean you flag if you want to see actually what the MM sees for debugging reasons and in the userfunction script the last argument in all those function says if when it fails should the script should and with an error or continue and return the error message.
After 2 times making things this way it doesn't seem efficient and properly for some people too confusing.
Re: Crash without detection.
Posted: Thu Jan 01, 2015 6:38 pm
by Administrator
Alternatively, just push the error message as an event, like this:
Code: Select all
pushLuaErrorEvent(L, "Something bad happened");
Just #include "error.h" to use this function.
Now in your script, you can do this:
Code: Select all
local displayErrors = true;
function macro.event(e, ...)
if( e == "error" and displayErrors ) then
print("[ERROR]: ", ...);
end
end
But we're getting off-topic here. As for checking if the handle is valid or not, I can't think of anything off the top of my head that wouldn't require modification to MicroMacro.
Re: Crash without detection.
Posted: Fri Jan 02, 2015 4:19 am
by NonAnon
Sorry to write, but due to my bad English/low IT knowledge I get lost, and i didn't event get if you are discussing about my problem in MM or how to solve(prevent) that in MM2.
Well, rather second I assume...
I get exactly what MM show on crash.
Code: Select all
The game client did not crash.
2015-01-02 10:14:23 - D:/micromacro/scripts/rom/functions.lua:15
15: bad argument #1 to 'memoryReadBytePtr' ((null))
So... Any ideas? :
Re: Crash without detection.
Posted: Fri Jan 02, 2015 4:39 am
by BlubBlab
Like we said it is a follow error so far I remember rombot does create a list of names for memory reading to simplify them, so you could simple check the return values if they are nil and restart rom if so.