Advertisement
Guest User

Chancity Dank Cellar

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