Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

8 Pages123>»
[TOOL] Ranger Crash Recovery
Jammo2k5
#1 Posted : Saturday, February 07, 2015 8:05:54 PM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
Firstly OiJkN is my partner on this project and any errors and bug fixes he has the knowledge to help just as much as me.

There comes a time when you set your bot to work over night to wake up in the morning with no games played because hearthstone has crashed.
Well i wrote a simple script to recover the bot automatically but also shuts hearthstone down when the bot is stopped on one of your conditions.

WARNING! This will delete the log files. I will add a backup option in the future.
Pressing Control + F10 will kill the script and reload it in a paused state in case if misbehavior.


This has been rewrote to be a lot more stable and work more on the logs of HearthRanger rather then looking at the console manually.
Unzip the zip file into the Hearthranger directory so the Ranger Recovery.exe and the Ranger Recovery Folder is in the folder with HearthRanger.exe.

Features
- Will restart Hearthstone and the bot when it stops without an auto stop condition triggered.
- Will shutdown hearthstone and the bot when an auto stop condition has been met.
- Breaks to split games to act more human.
- Status indicator (see what the bot is doing).
- Support for DPI Scaled Windows
- Support for launching via Task Scheduler or other times program using command line argument -r to auto start the script as it loads.

Ver 1.6 Download

Place the file Ranger Recovery.exe and the folder named Ranger Recovery in the HearthRanger root folder.
Setup file paths in the GUI and Set your settings.
Run the Ranger Recovery.exe and let it play.
May need Admin privileges to run.

Please report any problems here.

Future update ideas i have are:
- Backup and restore logs.
- 2 tiers of breaks so you can have set off times every day.
- Remove need for save settings button (only needed now to change settings while running not closing)
- Your suggestions.

Please post all feedback here in the thread and any feature requests too.

Running Ranger recovery automatically:


Changelog:
17 users thanked Jammo2k5 for this useful post.
Golddieb on 2/8/2015(UTC), masterwai on 2/22/2015(UTC), Yoin on 3/1/2015(UTC), Pizzon on 3/22/2015(UTC), rfalmeida on 4/18/2015(UTC), Exorcistf1 on 4/25/2015(UTC), Smartstone on 4/27/2015(UTC), etronpoilu on 5/18/2015(UTC), Weizhen77 on 6/5/2015(UTC), HawkenX on 6/24/2015(UTC), phillipe_kazuza on 10/1/2015(UTC), mesusiveva on 10/20/2015(UTC), BlackOak on 10/21/2015(UTC), Haiiro13 on 11/22/2015(UTC), raddyn on 12/8/2015(UTC), gabriel1791 on 12/30/2015(UTC), Rider on 3/2/2016(UTC)
Golddieb
#2 Posted : Sunday, February 08, 2015 3:31:52 AM(UTC)

Rank: Advanced Member

Groups: Registered
Posts: 147

Thanks: 39 times
Was thanked: 49 time(s) in 38 post(s)
Thanks, I'll give it a try. ;)

What language is it btw?
rfalmeida
#6 Posted : Wednesday, February 25, 2015 2:45:07 PM(UTC)
Rank: Member

Groups: Registered
Posts: 26

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Hello!

I just downloaded run it but when I run it appears something like: " Error: Failed attempt to launch program or document: Action <"Battle.net.lnk"> "

but the program is running on my system trail.

So, it's really running or not? I mean, when my HS crash, it'll recover?

Thnks for any support
rfalmeida
#8 Posted : Thursday, February 26, 2015 6:16:23 AM(UTC)
Rank: Member

Groups: Registered
Posts: 26

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
I'll try again later when I get home.

rfalmeida
#9 Posted : Thursday, February 26, 2015 4:25:32 PM(UTC)
Rank: Member

Groups: Registered
Posts: 26

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Ok the error gone but it will not start my HS when it crashes?
Jammo2k5
#10 Posted : Thursday, February 26, 2015 4:37:58 PM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
Ok sorry guys not done any work on this recently.

here is the code i wrote. As i say its very dirty and works on the console of the hearthranger program so it needs to be on top at all times.

Code:
#SingleInstance, Force ; Determines whether a script is allowed to run again when it is already running.
; ^ Force, replaces the old instance automatically.
#Persistent ; Keeps a script permanently running, until user terminates it.
#InstallKeybdHook ; Forces the unconditional installation of the keyboard hook.
#UseHook, On ; Forces the use of the hook to implement all or some keyboard hotkeys.
#Include FindClick.ahk

randstart = 0
UserConfig_a = o20,TransBlack
playing = 0
process,close,Hearthranger.exe
process,close,Hearthstone.exe
process,close,Battle.net.exe
random,randstart,0,360
sleep randstart
started = 0
Run "Battle.net.lnk"


;Findclick("update.png","!a funcupdate")
FindClick("play.png","!a w")
sleep 500
FindClick("play.png","!a")

Run "../Hearthranger.exe"
sleep 10000
FindClick("startbot.png","o20 stay1 funcstartbot w")
mousemove,0,0
loop
{
StayOnTop()
sleep 10000
FindClick("startgame.png","funcrestart !a")
FindClick("botstopped.png","funcbotstopped !a")
}



StayOnTop()
{
FindClick("ontopf.png","!a")
}

botstopped()
{
FindClick("botfinished0.png","!a funcclosedown")
sleep 500
FindClick("botstopped.png","!a funcrestart")
}

closedown()
{
process,close,Hearthranger.exe
process,close,Hearthstone.exe
process,close,Battle.net.exe
exitapp
}

restart()
{
process,close,Hearthranger.exe
process,close,Hearthstone.exe
process,close,Battle.net.exe
reload
}

update()
{
FindClick("update.png","!a")
}

playgame()
{
global
FindClick("play.png","!a")
playing = 1
}

startbot()
{
global
loop
{
FindClick("started.png","!a funcstarted")
FindClick("startbot.png","o20 stay1")
if started = 1
{
break
}
}
}

started()
{
global
Started = 1
}


It also uses an AHK library called findclick that can be found easily when searching on google.
As i say it needs a lot of work but i don't have the time with deadlines coming up and such.
oijkn
#11 Posted : Friday, February 27, 2015 11:54:37 AM(UTC)
oijkn


Rank: Advanced Member

Groups: HSModerator, Registered
Posts: 473
Man
Location: 127.0.0.1

Thanks: 76 times
Was thanked: 271 time(s) in 93 post(s)
Hi,

Well i managed to unpack the exe code and then i worked a little in the code.

What i have done :

* fixed : the launch game (multi language) / need to replace the play.png picture by this
* fixed : run the script from the root of HR (only pictures are stored in the Ranger Recovery directory)
* added process Silver.exe
* little reorganize the code

From my different tests when the game is closed/crashed the script code doesn't launch the game again. So if some skilled coder want to help me he's welcome :)

Regards.

code modded by Oijkn
Jammo2k5
#12 Posted : Saturday, February 28, 2015 12:36:21 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
Really wanted to keep the FindClick Library separate. It's not my code and like keeping libraries and my own code separate.

But in other news i have an idea. We can use the log to trigger bot actions.
Get the script to check the log every so often and then take actions according to what is seen.
I will work on this now and post results of what i can achieve.

This will mean cleaning the log files every time the bot is started so the right log file can be accessed.
Jammo2k5
#13 Posted : Saturday, February 28, 2015 4:26:24 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
OK OP has been updated. Pretty much a rewrite of the script. a lot more robust now.
Thanks Oijkn for the play image. (I was being a bit simple on that one)
oijkn
#14 Posted : Saturday, February 28, 2015 7:30:07 AM(UTC)
oijkn


Rank: Advanced Member

Groups: HSModerator, Registered
Posts: 473
Man
Location: 127.0.0.1

Thanks: 76 times
Was thanked: 271 time(s) in 93 post(s)
Hi Jammo2k5,

Sorry for the whole code ! next time i will give only your proper code and not the FindClick.

For the new update i will give it a try and tell you my feedback :)

Regards.

Jammo2k5
#15 Posted : Saturday, February 28, 2015 8:15:41 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
oijkn;24144 wrote:
Hi Jammo2k5,

Sorry for the whole code ! next time i will give only your proper code and not the FindClick.

For the new update i will give it a try and tell you my feedback :)

Regards.



Thanks :)

Working on the GUI and the Breaks between games system now. It's alomost done just a few niggles need to be worked on. then ill upload for testing.
oijkn
#16 Posted : Saturday, February 28, 2015 8:21:40 AM(UTC)
oijkn


Rank: Advanced Member

Groups: HSModerator, Registered
Posts: 473
Man
Location: 127.0.0.1

Thanks: 76 times
Was thanked: 271 time(s) in 93 post(s)
Well good news !!

I have updated your code and adding some features :

* added silver.exe (if the exe exist that will run it)
* close the Battle.net after the game is running (we don't need it open)

You can find the mod Ranger Recovery_Oijkn.exe.

Regards.

PS : For my tests all works good here, thank you Jammo2k5 for your contributions !!
Jammo2k5
#17 Posted : Saturday, February 28, 2015 8:30:27 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
oijkn;24147 wrote:
Well good news !!

I have updated your code and adding some features :

* added silver.exe (if the exe exist that will run it)
* close the Battle.net after the game is running (we don't need it open)

You can find the mod Ranger Recovery_Oijkn.exe.

Regards.

PS : For my tests all works good here, thank you Jammo2k5 for your contributions !!


I will Add the silver.exe as an option in the GUI. As not everyone uses it.
oijkn
#18 Posted : Saturday, February 28, 2015 8:45:33 AM(UTC)
oijkn


Rank: Advanced Member

Groups: HSModerator, Registered
Posts: 473
Man
Location: 127.0.0.1

Thanks: 76 times
Was thanked: 271 time(s) in 93 post(s)
Ok thanks but in the code i check ifexist so if the user don't use it it's no a matter :)
Jammo2k5
#19 Posted : Saturday, February 28, 2015 8:53:27 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
oijkn;24149 wrote:
Ok thanks but in the code i check ifexist so if the user don't use it it's no a matter :)


Yeah that's fine. But i want my script to control all the options so the user can better select how they want the bot to be used.
Makes it easier for the end user and it was only 4 lines of code to add it in.

Added Beta version to the OP.
1 user thanked Jammo2k5 for this useful post.
JoyAdmin on 2/28/2015(UTC)
Jammo2k5
#20 Posted : Sunday, March 01, 2015 5:39:50 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
New Beta version in the OP.
Breaks may work. Not done any vigorous testing on them but they have worked from what i have seen. Any testers care to comment?
oijkn
#21 Posted : Sunday, March 01, 2015 7:18:56 AM(UTC)
oijkn


Rank: Advanced Member

Groups: HSModerator, Registered
Posts: 473
Man
Location: 127.0.0.1

Thanks: 76 times
Was thanked: 271 time(s) in 93 post(s)
Jammo2k5;24159 wrote:
New Beta version in the OP.
Breaks do not work yet however.


Hi,

The file is no more available ! Can you upload it again please, thanks.

Regards.

PS : I have some ideas to add.

Edit : Well I was able to download it.



After testing your last version, the silver option doesn't work. It doesn't launch the exe file.
I managed to fix it manually but the problem is when the silver.exe is launched by the script nothing happens while the game is running. I mean the silver.exe doesn't calculate the borad.
But if i run it directly from the explorer like as normal that works good ! Any idea ?

I have added some code to run as admin the script so we don't need anymore to do it manually.

Code:

RunAsAdmin()
{
  Loop, %0%  ; For each parameter:
    {
      param := %A_Index%  ; Fetch the contents of the variable whose name is contained in A_Index.
      params .= A_Space . param
    }
  ShellExecute := A_IsUnicode ? "shell32\ShellExecute":"shell32\ShellExecuteA"
      
  if not A_IsAdmin
  {
      If A_IsCompiled
         DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_ScriptFullPath, str, params , str, A_WorkingDir, int, 1)
      Else
         DllCall(ShellExecute, uint, 0, str, "RunAs", str, A_AhkPath, str, """" . A_ScriptFullPath . """" . A_Space . params, str, A_WorkingDir, int, 1)
      ExitApp
  }
}


Put this function at the top of the script, as simple as that.

Code:

RunAsAdmin()


Can you set in your code to close Battle.net after loading the game please.

Regards
ejje
#22 Posted : Sunday, March 01, 2015 1:26:48 PM(UTC)
ejje


Rank: Advanced Member

Groups: Registered
Posts: 34
Man

Thanks: 21 times
Was thanked: 4 time(s) in 4 post(s)
How do you make to recognize the game crash? I test forcing close of game when bot is running but do nothing. The Oijkn version relaunch bnet and HR multiple times and crash game and loop this sequence. I hope this will help, i think i miss any config to get this work.
oijkn
#25 Posted : Sunday, March 01, 2015 1:57:21 PM(UTC)
oijkn


Rank: Advanced Member

Groups: HSModerator, Registered
Posts: 473
Man
Location: 127.0.0.1

Thanks: 76 times
Was thanked: 271 time(s) in 93 post(s)
Hi,

For the moment i will no post more update of the works of Jammo2k5 because it's his script.

But if he want i can help him :)

For the moment i'm trying to debug the issue with silver.exe.

Regards.
Jammo2k5
#26 Posted : Monday, March 02, 2015 1:32:47 AM(UTC)
Jammo2k5


Rank: Advanced Member

Groups: Registered
Posts: 78
Location: UK

Thanks: 11 times
Was thanked: 48 time(s) in 28 post(s)
Ill post some more updates later when my girlfriend goes to uni.
8 Pages123>»
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.137 seconds.