Crash without detection.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
NonAnon
Posts: 22
Joined: Wed Aug 06, 2014 5:10 am

Crash without detection.

#1 Post by NonAnon » Thu Jan 01, 2015 11:07 am

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? :D

IF sth isn't clear because of my English, ask

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Crash without detection.

#2 Post by BlubBlab » Thu Jan 01, 2015 12:01 pm

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.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: Crash without detection.

#3 Post by Administrator » Thu Jan 01, 2015 3:01 pm

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.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Crash without detection.

#4 Post by BlubBlab » Thu Jan 01, 2015 3:32 pm

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.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: Crash without detection.

#5 Post by Administrator » Thu Jan 01, 2015 3:43 pm

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.

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Crash without detection.

#6 Post by BlubBlab » Thu Jan 01, 2015 5:44 pm

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.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

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

Re: Crash without detection.

#7 Post by Administrator » Thu Jan 01, 2015 6:38 pm

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.

NonAnon
Posts: 22
Joined: Wed Aug 06, 2014 5:10 am

Re: Crash without detection.

#8 Post by NonAnon » Fri Jan 02, 2015 4:19 am

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? :

User avatar
BlubBlab
Posts: 948
Joined: Fri Nov 30, 2012 11:33 pm
Location: My little Pony cafe

Re: Crash without detection.

#9 Post by BlubBlab » Fri Jan 02, 2015 4:39 am

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.
Jack-of-all-trades, but master-of-only of a few :D

My Reps:
https://github.com/BlubBlab/Micromacro-with-OpenCV (My version of MM2 with OpenCV and for MS Visual Studio)
https://github.com/BlubBlab/rom-bot (rombot with no stop WP and advanced human emulation mode and some other extensions)
https://github.com/BlubBlab/Micromacro-2-Bot-Framework ( A work in progress )
My Tools : viewtopic.php?f=10&t=6226

Post Reply

Who is online

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