Page 1 of 2

Character dies when client crashes.

Posted: Sat Jan 08, 2011 8:24 pm
by rock5
I've been noticing that when I return to my PC and find the client has crashed, that the character has invariably died also. But if I'm there when the client crashes and finish closing the client, later when I log back in the character is still alive.

I deduce from this that when the client crashes, the server thinks you are still connected and mobs attack you until you are dead. It would be good that when the bot can't communicate with the client anymore there was an option to force shutdown the client.

I see the unsticking function calls the 'logout' function which can close the client and there is a TASKKILL command there but it only executes if there is no macro hotkey defined.

Is it possible to have an option to force shutdown the client when logout is called?

Re: Character dies when client crashes.

Posted: Sat Jan 08, 2011 9:03 pm
by Alkaiser
I strongly second this notion. I've died countless times in this way... spent a mint of tokens undoing the damage.

Re: Character dies when client crashes.

Posted: Sat Jan 08, 2011 10:42 pm
by rock5
I could probably do this myself but I'm not 100% sure how it should work.

Let's see...
1. player:logout() should work as before taking you to the character selection screen.
2. I guess we still want the profile option "LOGOUT_WHEN_STUCK".
3. We need an option to say how it should log out when stuck. Something like,
LOGOUT_WHEN_STUCK_TYPE = "normal" -- just returns to the character selection (default value)
LOGOUT_WHEN_STUCK_TYPE = "close" -- attempts to just close the client normally
LOGOUT_WHEN_STUCK_TYPE = "force" -- forces the client to close with TASKKILL.

And I'd probably leave the 'LOGOUT_SHUTDOWN' option as it is.

How does that sound?

Re: Character dies when client crashes.

Posted: Sun Jan 09, 2011 10:44 pm
by Alkaiser
A somewhat related problem that I have experienced is the blasted chat box. I often minimize ROM while botting and do other things on my computer. Sometimes the chat box pops up unseen where it gets filled with zeros, obviously the bot trying to use the macro - effectively disabling the bot. Is there a way for the bot to check to see if the chat box is open and to close it if it gets opened while the bot is running?

Re: Character dies when client crashes.

Posted: Sun Jan 09, 2011 10:49 pm
by Alkaiser
rock5 wrote:I could probably do this myself but I'm not 100% sure how it should work.

Let's see...
1. player:logout() should work as before taking you to the character selection screen.
2. I guess we still want the profile option "LOGOUT_WHEN_STUCK".
3. We need an option to say how it should log out when stuck. Something like,
LOGOUT_WHEN_STUCK_TYPE = "normal" -- just returns to the character selection (default value)
LOGOUT_WHEN_STUCK_TYPE = "close" -- attempts to just close the client normally
LOGOUT_WHEN_STUCK_TYPE = "force" -- forces the client to close with TASKKILL.

And I'd probably leave the 'LOGOUT_SHUTDOWN' option as it is.

How does that sound?
That sounds good. In case of a crash ... probably want to "force" it. Though, I wonder how long the server waits before pulling your character out when it happens.

Re: Character dies when client crashes.

Posted: Sun Jan 09, 2011 11:04 pm
by rock5
Alkaiser wrote:A somewhat related problem that I have experienced is the blasted chat box. I often minimize ROM while botting and do other things on my computer. Sometimes the chat box pops up unseen where it gets filled with zeros, obviously the bot trying to use the macro - effectively disabling the bot. Is there a way for the bot to check to see if the chat box is open and to close it if it gets opened while the bot is running?
Not really relevant to loggin out. If we could detect that, we would just close the chat and continue.

Instead of detecting it, maybe we could make it part of the recovery routine to press the ESC key. If I'm not mistaken that should close most things. But only as a last resort as it might bring up the system menu.

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 12:57 am
by rock5
I'm working on this now.

I think I can simplify it further by just adding the 1 option to close the client when stuck. It will just use the forced command.

I'm at a loss as to what to call it. All the logout options start with LOGOUT so I thought LOGOUT_CLOSE but it's a 'when stuck' option so it should be something like LOGOUT_WHEN_STUCK_CLOSE but that's a bit long and a bit unclear. An obvious name would be CLOSE_WHEN_STUCK but that doesn't follow the other logout option names. Maybe LOGOUT_CLOSE_WHEN_STUCK, it's still long but more clear.

Any thoughts?

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 1:26 am
by lisa
LOGOUT_WHEN_CRASHED

I'm terrible when it comes to naming things lol

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 2:38 am
by rock5
lisa wrote:LOGOUT_WHEN_CRASHED
*giggle*... I don't know why I found that funny but I had a bit of a giggle at that.

But seriously, that's no good as the bot doesn't actually know if the client crashes, it just goes through the unstick routine until it gives up.

I already got it working. I ended up using 'CLOSE_WHEN_STUCK' as the option name. I've tested it by manually getting myself stuck. Works correctly. Next I'm going to run a waypoint file I have that often crashes the client (not sure why) and see if it closes the client ok. Then it will be ready to commit.

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 3:40 am
by lisa
nice work =)


I'm not sure why but I've never had crashing issues, only time I ever crash is when in seige with 40+ V 40+, less in seige and I don't crash but over 80 and crash every 5 mins.
Mind you I don't run more then 2 bots at a time, might have something to do with it.

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 3:36 pm
by Alkaiser
rock5 wrote:
Alkaiser wrote:A somewhat related problem that I have experienced is the blasted chat box. I often minimize ROM while botting and do other things on my computer. Sometimes the chat box pops up unseen where it gets filled with zeros, obviously the bot trying to use the macro - effectively disabling the bot. Is there a way for the bot to check to see if the chat box is open and to close it if it gets opened while the bot is running?
Not really relevant to loggin out. If we could detect that, we would just close the chat and continue.

Instead of detecting it, maybe we could make it part of the recovery routine to press the ESC key. If I'm not mistaken that should close most things. But only as a last resort as it might bring up the system menu.
What I mean by somewhat related is that the character dies due to loss of bot control.
lisa wrote:nice work =)


I'm not sure why but I've never had crashing issues, only time I ever crash is when in seige with 40+ V 40+, less in seige and I don't crash but over 80 and crash every 5 mins.
Mind you I don't run more then 2 bots at a time, might have something to do with it.
I've had no in-combat crashes since rock5 made that fix in the most recent version.

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 6:10 pm
by rock5
Alkaiser wrote: I've had no in-combat crashes since rock5 made that fix in the most recent version.
That's good to hear. :)

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 6:23 pm
by rock5
Ok, so I ran the waypoint file that always crashes to make sure the new options properly close the client when it crashes but of course it ran flawlessly all night :( . I guess I'll just release it as is with the testing I've already done.

One last issue to discuss. Normally I would leave the default behavior to what it was before the change ie. when you get stuck and logout is enabled, it returns to the character selection screen. But in this case I'm thinking the default should be to close the client, as peoples lives are at stake. :)

Does anyone have an opinion?

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 6:27 pm
by jduartedj
Save the baby seals! Force it by default!

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 10:46 pm
by Alkaiser
rock5 wrote:peoples lives are at stake.
jduartedj wrote:Save the baby seals! Force it by default!
Ha! Yeah, force it.

Re: Character dies when client crashes.

Posted: Mon Jan 10, 2011 10:59 pm
by lisa
jduartedj wrote:Save the baby seals! Force it by default!
agreed

Re: Character dies when client crashes.

Posted: Tue Jan 11, 2011 12:03 am
by rock5
Ok, default behavior will be to close the client when stuck. Only if CLOSE_WHEN_STUCK = false will it just logout to the character selections screen.

I'll release it soon.

Re: Character dies when client crashes.

Posted: Tue Jan 11, 2011 12:27 am
by rock5
Ok I've released the changes to revision 555.

Re: Character dies when client crashes.

Posted: Fri Jan 14, 2011 5:08 pm
by Alkaiser
Would it be reasonable to add the process termination function to CPawn:update() when it fails? I just had the bot crash on me with this error, and naturally, died.

Re: Character dies when client crashes.

Posted: Sat Jan 15, 2011 2:51 am
by rock5
Alkaiser wrote:Would it be reasonable to add the process termination function to CPawn:update() when it fails? I just had the bot crash on me with this error, and naturally, died.
That opens up a whole kettle of beans. Do you realize how many times the 'error' function command is used in the bot? Potentially at each of those error points we might want it to close the client.

So maybe what you want is a 'logout on error' option? That would require either, the 'error' function to check the 'logout on error' option and logout before erroring, or another error function has to be created to do that and all the error commands replaced with that.