Advertisement
Guest User

Chancity Dank Cellar

a guest
Jun 17th, 2012
473
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 21.79 KB | None | 0 0
  1. #include <ImageSearch.au3>
  2.      #include <File.au3>
  3.      #include <Date.au3>
  4. Global $Paused
  5.         Global $ingamewait
  6.         Global $wintitle="Diablo III"
  7.         Global $winhandle=Wingethandle($wintitle)
  8.         Global $runtimeHour, $runtimeMins, $runtimeSecs, $runtime, $sruntime
  9.         Global $runtimeinit = TimerInit()
  10.         Global $CellerRunTime = TimerInit()
  11.         Global $CheckGame = WinGetClientSize("[CLASS:D3 Main Window Class]")
  12.  
  13.  
  14.     Opt('MouseCoordMode', 2)
  15.     Opt('PixelCoordMode', 2)
  16.  
  17.     HotKeySet("=","Leave")  ;script started by pressing =
  18.     HotKeySet("-", "Pause") ;script paused by pressing -
  19.     HotKeySet("x", "Stop") ;script stopped by pressing x
  20.     $go = True
  21.     $default_resolutionX = 1920
  22.     $default_resolutionY = 1080
  23.     $x_ratio = @Desktopwidth / $default_resolutionX
  24.     $y_ratio = @Desktopheight / $default_resolutionY
  25.  
  26.     ;ImageSearch Looting Variables
  27.     $ImgLoot = False ; set this to true if you want to use ImageSearch looting system. False will revert to old PixelSearch method
  28.     $directory = "E:\pics\" ; CHANGE THIS! Point it to the directory with the imagesearch pngs
  29.     $totalItems = 17 ; This needs to match the number of pngs you are loading
  30.     Global $pick[$totalItems]
  31.     $currentArrayItem = 0
  32.     $gX = 0
  33.     $gY = 0
  34.     $gX0 = 0
  35.     $gY0 = 0
  36.  
  37.     $pick[0] = "uare.png|40"
  38.     $pick[1] = "tome.png|40"
  39.     $pick[2] = "legendaryA.png|20"
  40.     $pick[3] = "legendaryE.png|20"
  41.     $pick[4] = "legendaryI.png|10"
  42.     $pick[5] = "legendaryO.png|20"
  43.     $pick[6] = "legendaryU.png|20"
  44.     $pick[7] = "setA.png|30"
  45.     $pick[8] = "setE.png|30"
  46.     $pick[9] = "setU.png|30"
  47.     $pick[10] = "setO.png|30"
  48.     $pick[11] = "setI.png|30"
  49.     $pick[12] = "rareA.png|20" ; comment/delete these and adjust $totalItems to disable rare looting
  50.     $pick[13] = "rareE.png|20"
  51.     $pick[14] = "rareI.png|20"
  52.     $pick[15] = "rareO.png|20"
  53.     $pick[16] = "rareU.png|20" ; end comment
  54.  
  55.     $LootGems = True ; Old Methods set to true if you don't want to use imagesearch
  56.     $LootRares = True ; Old Methods set to true if you don't want to use imagesearch
  57.  
  58.  
  59.     $Amethyst = 0xAC7FFF
  60.     $Ruby = 0xB01D2D
  61.     $Emerald = 0x58EE33
  62.     $Topaz = 0xFFFF59
  63.     $yellow = 0xFFF000 ; yellow color code (repair icon)
  64.     $red = 0xD90000 ; red color code (repair icon)
  65.  
  66.     $Timer = false ; set this to true and the bot will randomly wait (5% chance) in town for 30-60 seconds before starting over
  67.     $walktime = 3600 ; time in ms the script waits for you to enter and load the cellar. Slow this down for slower move speeds and loading times
  68.     $loadtime = 4500 ; time in ms the script waits for the game to load before it starts pathfinding. Slow this down for slower hard drives
  69.     $tptime = 6900 ; time in ms the script waits for teleport before exiting the game
  70.  
  71.     $Leave = False
  72.     $Dead = False
  73.     $Window = False
  74.     $Logout = False
  75.     $i = 0
  76.     $CellarClickFail=False
  77.  
  78.     ;Logging Var
  79.     $Deaths=0
  80.     $Repairs=0
  81.     $Found=0
  82.     $NotFound=0
  83.     $RunNum=0
  84.  
  85.     Call("RestartRun")
  86.     Func RestartRun()
  87.        While $go
  88.               if($Leave) Then
  89.                   $CellerRunTime = TimerInit()
  90.                   $RunNum = $Found + $NotFound
  91.                     $Repairp = $Repairs / $RunNum
  92.                     $DeathsP = $Deaths / $RunNum
  93.                     $FoundP = $Found /  $RunNum
  94.                     $NotfoundP = $NotFound / $RunNum
  95.                   ToolTip("Cellars Found: " & $Found & " (" & Round($FoundP * 100,.00) & "%" & ")" & @CRLF & "Cellars Not Found: " & $NotFound & " (" & Round($NotFoundP * 100,.00) & "%" & ")"& _
  96.                   @CRLF & "Deaths: " & $Deaths &  " (" & Round($DeathsP * 100,.00) & "%" & ")"& @CRLF & "Repairs: " & $Repairs &  " (" & Round($RepairP * 100,.00) & "%" & ")", 20, 20, "Run Time: " & Call("Update_Time",$runtimeinit), 1)
  97.                      $i = 0
  98.                      Call("CheckExit")
  99.                      Sleep(850) ;had to add this since the icon doesn't show up RIGHT away in game
  100.                      Call("CheckDead")
  101.                      Call("CheckRepair")
  102.                      If $Window Then
  103.                             Call("InputReqScrn")
  104.                             $Window = False
  105.                             ExitLoop
  106.                      ElseIf $Dead or $Logout Then
  107.                             ExitLoop
  108.                         EndIf
  109.                         MouseClick("middle", Round(0 * $x_ratio),Round(250 * $y_ratio)) ;starts the main run
  110.                                          Send("{3 down}")
  111.                                          Sleep(1900)
  112.                                          Send("{3 up}")
  113.                                          send("1")
  114.                         MouseMove(Round(255*$x_ratio),Round(290*$y_ratio),1) ;moves cursor over to the cellar so the proper blue pixel becomes highlighted
  115.                          Sleep(500)
  116.                      Sleep(250)
  117.                      Call("CheckDead")
  118.                      If $Window Then
  119.                             Call("InputReqScrn")
  120.                             $Window = False
  121.                             ExitLoop
  122.                      ElseIf $Dead or $Logout Then
  123.                             ExitLoop
  124.                         EndIf
  125.                     $Pixel2 = PixelSearch(0,0, Round(600*$x_ratio), Round(400*$y_ratio),0x334FB7,3) ;checks for open cellar (in a 600x400 box from the top left - where it should always be)
  126.                                    If Not @error Then
  127.                                        MouseClick("left",Round(255*$x_ratio),Round(290*$y_ratio)) ;Entrance to cellar
  128.                                         Cellarwait()
  129.                                         If $CellarClickFail=true Then
  130.                                             ExitLoop
  131.                                             Endif
  132.                                         MouseClick("middle",Round(20*$x_ratio),Round(708*$y_ratio)) ;moves to doorway leading to rare inside cellar
  133.                                         Sleep(3100)
  134.                                         MouseMove(Round(440*$x_ratio),Round(80*$y_ratio),1) ;hovers over the rare Sarkoth
  135.                                         Send(4)
  136.                                         Sleep(600)
  137.                                         Send("{SHIFTDOWN}")
  138.                                         MouseDown("right") ;attack middle
  139.                                         Sleep(3300)
  140.                                         ;MouseMove(Round(521 * $x_ratio),Round(260 * $y_ratio),1) ;attack left, add more sleep time if you can't kill minion on left
  141.                                         MouseUP("right")
  142.                                         ;MouseClick("right",Round(620*$x_ratio),Round(20*$y_ratio),2) ;break the table & chair
  143.                                         Sleep(10)
  144.                                         Send("{SHIFTUP}")
  145.                                         MouseClick("right",694,929) ;cancel archon
  146.                                         Sleep(400)
  147.                                         MouseClick("middle",Round(564*$x_ratio),Round(222*$y_ratio)) ;location of sarkoth after death
  148.                                         Sleep(1600)
  149.                                         MouseClick("middle",Round(650*$x_ratio),Round(523*$y_ratio)) ;move to left top corner for gold
  150.                                         sleep(1100)
  151.                                         MouseClick("middle",Round(1320*$x_ratio),Round(315*$y_ratio)) ;move to right top corner for gold
  152.                                         sleep(1100)
  153.                                         MouseClick("middle",Round(880*$x_ratio),Round(748*$y_ratio)) ;move to middle before looting
  154.                                         Call("CheckLoot")
  155.                                         Send("t")
  156.                                         Sleep($tptime)
  157.                                         Call("RandomSleep")
  158.                                         Call("CheckDead")
  159.                                       If Not $Logout And Not $Dead And Not $Window Then
  160.                                              Sleep(300)
  161.                                              Send("{ESCAPE}") ;menu
  162.                                              Sleep(200)
  163.                                              Call("Logs","killed")
  164.                                              MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  165.                                              Sleep($loadtime)
  166.                                              Call("CheckDead")
  167.                                              If Not $Logout Then
  168.                                                     Call("InputReqScrn")
  169.                                              EndIf
  170.                                       Else
  171.                                              Call("InputReqScrn")
  172.                                              $Window = False ; reset the flag so it doesn't think a window is always up
  173.                                       EndIf
  174.                                   Else
  175.                                       OhShit()
  176.                                       If Not $Logout And Not $Dead And Not $Window Then
  177.                                              Sleep(300)
  178.                                              Send("{ESCAPE}") ;menu
  179.                                              Sleep(200)
  180.                                              Call("CheckDead")
  181.                                              MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  182.                                              Sleep($loadtime)
  183.                                              Call("CheckDead")
  184.                                              If Not $Logout Then
  185.                                                 Call("InputReqScrn")
  186.                                              EndIf
  187.                                       Else
  188.                                              Call("InputReqScrn")
  189.                                              $Window = False ; reset the flag so it doesn't think a window is always up
  190.                                          EndIf
  191.  
  192.                             EndIf
  193.               EndIf
  194.           If $CellarClickFail=true Then
  195.                Sleep(300)
  196.                                              Send("{ESCAPE}") ;menu
  197.                                              Sleep(200)
  198.                                              Call("CheckDead")
  199.                                              MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  200.                                              Sleep($loadtime)
  201.                                              Call("CheckDead")
  202.                                              If Not $Logout Then
  203.                                                 Call("InputReqScrn")
  204.                                             EndIf
  205.                                             $CellarClickFail=False
  206.                                             RestartRun()
  207.                                         EndIf
  208.                                         WEnd
  209.        Call("InputReqScrn")
  210.   EndFunc
  211.  
  212.     Func CheckDead()
  213.     Call("CheckWindow")
  214.     $YouHaveDied = PixelSearch(Round(620*$x_ratio), Round(325*$y_ratio), Round(625*$x_ratio), Round(330*$y_ratio), 0xFFFFFF) ; checks for white text "YOU HAVE DIED"
  215.     If Not @error Then
  216.        If Not $Window Then
  217.               $Dead = True
  218.               Call("Logs","dead")
  219.               Sleep(100)
  220.               Send("{Escape}")
  221.               Sleep(10)
  222.               MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  223.               Sleep(11000)
  224.               Call("InputReqScrn")
  225.        Else
  226.               Call("InputReqScrn")
  227.               $Dead = False
  228.        EndIf
  229.     Else
  230.        $Dead = False
  231.     EndIf
  232.     $LogoutTimerCancel = PixelSearch(Round(900*$x_ratio), Round(240*$y_ratio), Round(1010*$x_ratio), Round(290*$y_ratio), 0x993827) ; checks for cancel button on logout timer
  233.     If Not @error Then
  234.        Sleep(11000)
  235.        Sleep($loadtime)
  236.        If Not $Window Then
  237.               $Dead = True
  238.               $Logout = True
  239.               Sleep($loadtime)
  240.               Call("InputReqScrn")
  241.           Else
  242.               Call("InputReqScrn")
  243.               $Logout = False
  244.        EndIf
  245.     Else
  246.        $Logout = False
  247.     EndIf
  248. EndFunc
  249.  
  250.  
  251.     Func CheckWindow()
  252.     $CloseButton = PixelSearch(Round(1570*$x_ratio), Round(110*$y_ratio), Round(1590*$x_ratio), Round(120*$y_ratio), 0x8C2300) ; checks for the red color of the "X" on an open window
  253.     If Not @error Then
  254.        Sleep(200)
  255.        Send("{SPACE}") ;close any open windows
  256.        $Window = True
  257.     Else
  258.        $Window = False
  259.     EndIf
  260.     EndFunc
  261.  
  262.     Func CheckExit()
  263.     $ExitButton = PixelSearch(Round(1190*$x_ratio), Round(400*$y_ratio), Round(1200*$x_ratio), Round(440*$y_ratio), 0x14100E) ; checks for the grey border of the exit prompt
  264.     If Not @error Then
  265.        Send("{ESCAPE}")
  266.        Sleep(100)
  267.        Send("{SPACE}") ;close any open windows
  268.        Sleep(200)
  269.        MouseMove(1,1) ; reset cursor position before checking for button
  270.        $Resume = Hex(PixelGetColor(Round(140*$x_ratio), Round(420*$y_ratio)), 6) ; checks if resume button can be pressed
  271.        If $Resume == "400900" Or $Resume == "380900" Then
  272.               Sleep(200)
  273.               Call("InputReqScrn")
  274.        EndIf
  275.     EndIf
  276.     EndFunc
  277.  
  278.     Func CheckRepair()
  279.     $RepairArea = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $yellow)
  280.        If Not @error Then
  281.               Call("DoRepair")
  282.        EndIf
  283.     $RepairAreaRed = PixelSearch(Round(1480*$x_ratio), 0, Round(1570*$x_ratio), Round(100*$y_ratio), $red)
  284.        If Not @error Then
  285.               Call("DoRepair")
  286.        EndIf
  287.     EndFunc
  288.  
  289.     Func DoRepair()
  290.     $Repairs=$Repairs+1
  291.     Sleep(100)
  292.     Send("t")
  293.     Sleep($tptime)
  294.     MouseClick("left", Round(1480*$x_ratio),Round(281*$y_ratio)) ;begin movement towards merchant
  295.     Sleep(1900)
  296.     MouseClick("left", Round(1316*$x_ratio),Round(206*$y_ratio)) ;moves to get merchant in screen
  297.     Sleep(1900)
  298.     MouseClick("left", Round(845*$x_ratio),Round(225*$y_ratio)) ;NPC Merchant to the right of cain's home
  299.     Sleep(1200)
  300.     MouseClick("left", Round(521*$x_ratio),Round(506*$y_ratio)) ;button to open up repair menu
  301.     Sleep(400)
  302.     MouseClick("left", Round(260*$x_ratio),Round(595*$y_ratio)) ;button to pay for repairs
  303.     Sleep(200)
  304.     Call("CheckDead")
  305.     If Not $Dead and Not $Logout Then
  306.        Send("{ESCAPE}") ;closes repair tab
  307.        Sleep(100)
  308.        Send("{ESCAPE}") ;menu
  309.        Sleep(10)
  310.        MouseClick("left", Round(960*$x_ratio),Round(580*$y_ratio)) ;button to leave game
  311.         Call("Logs","repair")
  312.        Sleep($loadtime)
  313.        Call("InputReqScrn")
  314.     EndIf
  315.     EndFunc
  316.  
  317.     Func CheckLoot()
  318.         Sleep(Random(500,2000))
  319.         $SetLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0x02CE01, 2) ; set loot
  320.         If Not @error Then
  321.            MouseClick ('left', $SetLoot[0], $SetLoot[1])
  322.            Sleep(Random(800,1200))
  323.            $i+= 1
  324.            If $i <= 6 Then
  325.                   Call("CheckLoot")
  326.            EndIf
  327.         EndIf
  328.         If $LootRares Then
  329.            $RareLoot = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), 0xBBBB00, 2) ; rare loot (darker for compatibility)
  330.            If Not @error Then
  331.                   MouseClick ('left', $RareLoot[0], $RareLoot[1])
  332.                   Sleep(Random(700,900))
  333.                   $i+= 1
  334.                   If $i <= 6 Then
  335.                          Call("CheckLoot")
  336.                   EndIf
  337.               EndIf
  338.           Else
  339.                 Call("pickItems")
  340.        EndIf
  341.  
  342.         If $LootGems Then
  343.            $AmethystDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Amethyst,8)
  344.            If Not @error Then
  345.                   MouseClick("left", $AmethystDrop[0], $AmethystDrop[1])
  346.                   Sleep(Random(900,1400))
  347.                   $i+= 1
  348.                   If $i <= 10 Then
  349.                          Call("CheckLoot")
  350.                   EndIf
  351.            EndIf
  352.            $RubyDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Ruby,6)
  353.            If Not @error Then
  354.                   MouseClick("left", $RubyDrop[0], $RubyDrop[1])
  355.                   Sleep(Random(900,1400))
  356.                   $i+= 1
  357.                   If $i <= 10 Then
  358.                          Call("CheckLoot")
  359.                   EndIf
  360.            EndIf
  361.            $EmeraldDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Emerald,11)
  362.            If Not @error Then
  363.                   MouseClick("left", $EmeraldDrop[0], $EmeraldDrop[1])
  364.                   Sleep(Random(900,1400))
  365.                   $i+= 1
  366.                   If $i <= 10 Then
  367.                          Call("CheckLoot")
  368.                   EndIf
  369.            EndIf
  370.            $TopazDrop = PixelSearch(Round(400*$x_ratio), 0, Round(1690*$x_ratio), Round(900*$y_ratio), $Topaz,2)
  371.            If Not 1 = 1 Then ; change to 'If Not @error Then' if you want to search for topazes
  372.                   MouseClick("left", $TopazDrop[0], $TopazDrop[1])
  373.                   Sleep(Random(900,1400))
  374.                   $i+= 1
  375.                   If $i <= 10 Then
  376.                          Call("CheckLoot")
  377.                   EndIf
  378.               EndIf
  379.        EndIf
  380.    EndFunc
  381.  
  382.    Func OhShit()
  383.        mousemove(962,518,1)
  384.                                       Send("4")
  385.                                       Sleep(620)
  386.                                       send("2")
  387.                                       Sleep(400)
  388.                                       send("{SHIFTDOWN}")
  389.                                       sleep(200)
  390.                                       Mouseclick("left")
  391.                                       sleep(300)
  392.                                       send("{SHIFTUP}")
  393.                                       sleep(400)
  394.                                       Send("t")
  395.                                       Sleep($tptime)
  396.                                       Call("CheckDead")
  397.                                       Call("RandomSleep")
  398.                                       Call("Logs","notpresent")
  399.        EndFunc
  400.  
  401.  
  402.  
  403. Func pickItems()
  404. $currentArrayItem = 0
  405. For $gI = 0 to ($totalItems - 1)
  406.    $array = StringSplit($pick[$gI],"|")
  407.    $file = $array[1]
  408.    $accuracy = $array[2]
  409.    $urlString = $directory & $file
  410.    $Target = _ImageSearchArea($urlString,1,0,0,Round(1920*$x_ratio),Round(1080*$y_ratio),$gX,$gY,$accuracy)
  411.    While $i <= 12 ; max: 13 gems and pieces of gear to loot
  412.           If $Target And ($gX > 15) And ($gY > 15) Then
  413.                  ;MsgBox(4096,"Debug",$urlString & " " & $gX & "-" & $gY)
  414.                  MouseClick("left", $gX, $gY, 1, 0)
  415.                  Sleep(Random(1200,1400))
  416.                  MouseMove(14,14,0) ;Reset cursor position, it doesn't need to hover
  417.                  Sleep(5)
  418.                  $Target = _ImageSearchArea($urlString,1,0,0,Round(1920*$x_ratio),Round(1080*$y_ratio),$gX,$gY,$accuracy)
  419.                  $i+= 1
  420.           Else
  421.                  ExitLoop
  422.           EndIf
  423.    WEnd
  424. Next
  425. EndFunc
  426.  
  427.  
  428.    Func InputReqScrn()
  429.    Menuwait()
  430.    MouseClick("left", Round(198*$x_ratio),Round(417*$y_ratio)) ;button to resume game from main menu
  431.    Ingamewait()
  432.    $Target = _ImageSearchArea($directory & "DisconnectError.png",1,0,0,@DesktopHeight,@DesktopWidth,$gX0,$gY0,0)
  433.         If $Target And ($gX > 15) And ($gY > 15) Then
  434.             sleep(1500)
  435.                     MouseClick("left", Round(960*$y_ratio), Round(635*$x_ratio), 50 ,10)
  436.                     Sleep(Random(1000, 2000))
  437.               MouseClick("left", Round(198*$x_ratio),Round(417*$y_ratio)) ;button to resume game from main menu
  438.               $gX0 = 0
  439.               $gY0 = 0
  440.               Ingamewait()
  441.         EndIf
  442.     EndFunc
  443.  
  444.  Func Menuwait()
  445.         $menuwait=0
  446.         Do
  447.           sleep(100)
  448.           $menuwait=$menuwait+1
  449.           PixelSearch(1630*$x_ratio ,990*$y_ratio, 1660*$x_ratio ,1030*$y_ratio, 0xAF681B, 20, 1, $winhandle) ; this function waits for that helmet button to appear on the lower right of the main menu
  450.    Until (Not @Error OR $menuwait=100)
  451.  
  452.    If $menuwait=100 Then
  453.                 send("{ESC}")
  454.                 sleep(2000)
  455.                 send("{ESC}")
  456.           $menuwait=0
  457.    EndIf
  458.    $menuwait=0
  459.         sleep(100)
  460.  EndFunc
  461.  
  462. Func Ingamewait()
  463. Do
  464.         sleep(100)
  465.         $ingamewait=$ingamewait+1
  466.         PixelSearch(1100*$x_ratio ,1000*$y_ratio,1140*$x_ratio ,1060*$y_ratio, 0x426AFA, 20, 1, $winhandle) ; this function waits until the blue townportalbutton appears to recognize that we are ingame
  467.  Until (Not @Error OR $ingamewait=100)
  468. $ingamewait=0
  469. sleep(200)
  470. EndFunc
  471.  
  472.  
  473.  
  474. Func Cellarwait()
  475.         $menuwait=0
  476.         Do
  477.           sleep(100)
  478.           $menuwait=$menuwait+1
  479.           PixelSearch(811*$x_ratio ,222*$y_ratio, 900*$x_ratio ,320*$y_ratio, 0xFDFD34, 40, 1, $winhandle) ; This function waits until the light of the lamp next to the entrance appears
  480.       Until (Not @Error OR $menuwait=100)
  481.       If $menuwait=100 Then
  482.           OhShit()
  483.           $CellarClickFail=True
  484.          $menuwait=0
  485.          EndIf
  486.      EndFunc
  487.  
  488.  
  489.     Func RandomSleep()
  490.         if ($timer) then
  491.               Sleep(Random(2000,240000))
  492.               EndIf
  493.           EndFunc
  494.  
  495. Func Logs($LogStats)
  496.     $Sarkothkill=Iniread("Sarkoth.ini","Misc","Sarkothkill",0)
  497.     $Sarkothnotfound=Iniread("Sarkoth.ini","Misc","Sarkothnotfound",0)
  498.     $Died=Iniread("Sarkoth.ini","Misc","Died",0)
  499.     $Repair=Iniread("Sarkoth.ini","Misc","Repair",0)
  500.     $RunNum = $Found + $NotFound
  501.     $Repairp = $Repairs / $RunNum
  502.     $DeathsP = $Deaths / $RunNum
  503.     $FoundP = $Found /  $RunNum
  504.     $NotfoundP = $NotFound / $RunNum
  505.  
  506.     If $LogStats = "repair" Then
  507.             _FileWriteLog("Botlog.txt", "Repaired Items, it took " & Call("Update_Time",$CellerRunTime))
  508.             $Repairs=$Repairs+1
  509.             $Repair=$Repair+1
  510.             $NotFound=$NotFound+1
  511.             $Sarkothnotfound=$Sarkothnotfound+1
  512.             IniWrite("Sarkoth.ini","Misc","Died",$Repair)
  513.             IniWrite("Sarkoth.ini","Misc","Sarkothnotfound",$Sarkothnotfound)
  514.     ElseIf $LogStats = "dead" then
  515.             _FileWriteLog("Botlog.txt", "Oh my you have died, it took " & Call("Update_Time",$CellerRunTime))
  516.             $Died=$Died+1
  517.             $Sarkothnotfound=$Sarkothnotfound+1
  518.             $Deaths=$Deaths+1
  519.             $NotFound=$NotFound+1
  520.             IniWrite("Sarkoth.ini","Misc","Died",$Died)
  521.             IniWrite("Sarkoth.ini","Misc","Sarkothnotfound",$Sarkothnotfound)
  522.     ElseIf $LogStats = "killed" then
  523.             _FileWriteLog("Botlog.txt", "Sarkoth down, it took " & Call("Update_Time",$CellerRunTime))
  524.             $Sarkothkill=$Sarkothkill+1
  525.             $Found=$Found+1
  526.             IniWrite("Sarkoth.ini","Misc","Sarkothkill",$Sarkothkill)
  527.     ElseIf $LogStats = "notpresent" then
  528.             _FileWriteLog("Botlog.txt", "Cellar Not Found, it took " & Call("Update_Time",$CellerRunTime))
  529.             $Sarkothnotfound=$Sarkothnotfound+1
  530.             $Notfound=$NotFound+1
  531.             IniWrite("Sarkoth.ini","Misc","Sarkothnotfound",$Sarkothnotfound)
  532.         ElseIf $LogStats = "stoped" Then
  533.             _FileWriteLog("Botlog.txt",  @CRLF & "************************************************" & @CRLF & _
  534.             "Chancity's Dank Celler" & @CRLF & "Run has completed in:  " & Call("Update_Time",$runtimeinit) & @CRLF & _
  535.             "Total Cellars Found: " & $Found & " (" & Round($FoundP * 100,.00) & "%" & ")" & @CRLF & "Total Cellars Not Found: " & $NotFound & " (" & Round($NotFoundP * 100,.00) & "%" & ")" & @CRLF & "Totals Deaths: " & $Deaths &  " (" & Round($DeathsP * 100,.00) & "%" & ")" & @CRLF & _
  536.             "Total Repairs: " & $Repairs &  " (" & Round($RepairP * 100,.00) & "%" & ")" & @CRLF & "************************************************")
  537.             Endif
  538. EndFunc
  539.  
  540. Func Update_Time($time)
  541.     _TicksToTime(Int(TimerDiff($time)), $runtimeHour, $runtimeMins, $runtimeSecs)
  542.     $runtime = StringFormat("%02i:%02i:%02i", $runtimeHour, $runtimeMins, $runtimeSecs)
  543.     Return $runtime
  544. EndFunc   ;==>Update_Time
  545.  
  546.     Func Pause()
  547.        $Leave = False
  548.     EndFunc
  549.  
  550.     Func Stop() ;to allow the script to stop
  551.         Call("Logs","stoped")
  552.         Exit
  553.     EndFunc
  554.  
  555.     Func Leave()
  556.        $Leave = True
  557.     EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement