Advertisement
Guest User

Ler_GG Scene switcher

a guest
Apr 25th, 2015
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.86 KB | None | 0 0
  1. ;-------------------------------------------------
  2. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  3. ;@ Author: @Ler_GG
  4. ;@ Release Date: 25.04.2015
  5. ;@ Purpose: Switches between scenes while
  6. ;@ streaming. Also supports auto
  7. ;@ accept for Matchmaking.
  8. ;@ Additionaly, it gets the
  9. ;@ current MMR from Dotabuff and
  10. ;@ writes it into a .txt so it
  11. ;@ can be included on stream.
  12. ;@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  13. ;-------------------------------------------------
  14.  
  15.  
  16. ;-------------------------------------------
  17. ; @@@@@@@ INCLUDES @@@@@@@@@@@@@@@@@@@@@@@@@
  18. ;-------------------------------------------
  19. #include <Array.au3>
  20. #include <Constants.au3>
  21. #include <IE.au3>
  22. #include <WindowsConstants.au3>
  23.  
  24. ;-------------------------------------------
  25. ; @@@@@@@ CHECKSUMS @@@@@@@@@@@@@@@@@@@@@@@@
  26. ;-------------------------------------------
  27. Global $gameCheckSum_HUD_Standard = 520875552
  28. Global $gameCheckSum_HUD_ManaPool = 451971833
  29. Global $loginChecksumEU = 4166368323
  30. Global $GameFoundChecksum = 1781316133
  31. Global $apCheckSum_HUD_Standard = 3735100832
  32. Global $cmCheckSum = 3350032685
  33.  
  34. ;-------------------------------------------
  35. ; @@@@@@@ VARIABLES @@@@@@@@@@@@@@@@@@@@@@@@
  36. ;-------------------------------------------
  37. Global $bStateLogin = True
  38. Global $bStateGame = True
  39. Global $nresetTimer = 0
  40. Global $oIE
  41.  
  42. ;-------------------------------------------
  43. ; @@@@@@@ MAIN @@@@@@@@@@@@@@@@@@@@@@@@@@@@@
  44. ;-------------------------------------------
  45.  
  46. ; Initial rating on startup
  47. _getRating()
  48.  
  49. ; Main loop
  50. While 1
  51.  
  52. ; Sleep to lower CPU load.
  53. Sleep(1000)
  54.  
  55. ; Updates MMR every 10 minutes.
  56. $nresetTimer = $nresetTimer + 1
  57. If $nresetTimer = 600 Then
  58. _getRating()
  59. $nresetTimer = 0
  60. EndIf
  61.  
  62. ; Updates neccesary checksums
  63. $currentCheckSum = PixelChecksum(1608, 14, 1713, 31)
  64. $cmCheckS = PixelChecksum(551, 205, 659, 219)
  65. $apCheckS = PixelChecksum(372, 9, 524, 32)
  66. $GameFound = PixelChecksum(640, 410, 660, 430)
  67.  
  68. ; Automatically clicks accept game button.
  69. If $GameFound = $GameFoundChecksum Then
  70. MouseClick("left", 660, 430)
  71. EndIf
  72.  
  73. ; Checks for Main menu
  74. If $currentCheckSum = $loginChecksumEU Or $apCheckS = $apCheckSum_HUD_Standard Or $cmCheckS = $cmCheckSum And $bStateLogin = True Then
  75. Send("{F6}", 0)
  76. Sleep(100)
  77. Send("{F7}", 0)
  78. $bStateLogin = False
  79. $bStateGame = True
  80. EndIf
  81.  
  82. ; Checks if Ingame
  83. $currentCheckSum = PixelChecksum(1687, 9, 1744, 28)
  84. If $currentCheckSum = $gameCheckSum_HUD_Standard And $bStateGame = True Or $currentCheckSum = $gameCheckSum_HUD_ManaPool And $bStateGame = True Then
  85. Send("{F7}", 0)
  86. Sleep(100)
  87. Send("{F6}", 0)
  88. $bStateGame = False
  89. $bStateLogin = True
  90. EndIf
  91.  
  92. WEnd
  93.  
  94. ;-------------------------------------------
  95. ; @@@@@@@ FUNCTIONS @@@@@@@@@@@@@@@@@@@@@@@@
  96. ;-------------------------------------------
  97.  
  98. ;-------------------------------------------
  99. ; Function: _getRating()
  100. ;
  101. ; Usage: - Parses html body of Dotabuff
  102. ; to determine the actual mmr
  103. ; value.
  104. ;-------------------------------------------
  105. Func _getRating()
  106.  
  107. ; Opens IE Invisible
  108. $oIE = _IECreate("about:blank", 0, 0)
  109.  
  110. ; Navigates to Dotabuff Profile
  111. _IENavigate($oIE, "http://www.dotabuff.com/players/115909501")
  112.  
  113. ; Returns all digits in the html body with the format 0000 in an array.
  114. ; Index 0 is the solo MMR when logged in.
  115. $stringMMR = StringRegExp(_IEBodyReadText($oIE), "\d\d\d\d", 1)
  116. _writeMMRData($stringMMR)
  117.  
  118. ;~ MsgBox(0,"MMR",$stringMMR[0])
  119.  
  120. ; Closes IE
  121. _IEQuit($oIE)
  122.  
  123. EndFunc ;==>_getRating
  124.  
  125. ;-------------------------------------------
  126. ; Function: _writeMMRData()
  127. ; Usage:
  128. ; - Writes an array into a file.
  129. ; Variables:
  130. ; - $aData: Array to write into file.
  131. ;-------------------------------------------
  132. Func _writeMMRData($aData)
  133. FileOpen("mmr.txt", 2)
  134. FileWrite("mmr.txt", $aData[0])
  135. FileClose("mmr.txt")
  136. EndFunc ;==>_writeMMRData
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement