UNOBTANIUM

Path of Exile RNG Challenge

May 22nd, 2015
536
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; Path of Exile RNG Challenge
  2. ; created by unobtanium
  3. ; 22.05.2015 20:43
  4.  
  5. ; Be sure you have Path of Exile running.
  6. ; I recommend running the game in window (borderless) mode,
  7. ; because Windows will open and close the game whenever you click a button (nothing i can do about it).
  8.  
  9. ; Press F8 to enable the program. A little button will appear on the left side (right under the chat).
  10. ; Click on it to open the Button Menu.
  11. ; You can choose from various randomizers.
  12. ; Some require additional information, like word length size or number value range.
  13. ; If something went out of control, press Ctrg + Alt + Delete to open up Task Manager and stop/reload the script.
  14. ; Have fun :)
  15.  
  16. ; Known Issue:
  17. ; The GUI sometimes flickers when a lot of updates are made. Just a minor, visual bug.
  18. ; Game drops to 30 fps if a video or stream is running on my second monitor. Closing the script with F8 fixes this.
  19.  
  20. ~F8::
  21. {
  22.     toggleGUIMenu()
  23.         Return
  24. }
  25.  
  26.  
  27.  
  28. toggleGUIMenu() {
  29.     openPOE()
  30.     IfWinExist, Path of Exile RNG Challenge
  31.     {
  32.         Gui, 1: Destroy
  33.         openPOE()
  34.         Return
  35.     } else {
  36.         openPOE()
  37.         WinGetPos,,,width,height
  38.         wx := 2
  39.         wy := (height*0.75)
  40.  
  41.         ;Main Button
  42.         Gui, 1: Font, s15, Arial
  43.         Gui, 1: -Caption +AlwaysOnTop +ToolWindow +E0x08000000
  44.         Gui, 1: Color, 000000
  45.         Gui, 1: Add, Button, X0 Y0 w50 h25, RNG
  46.         Gui, 1: Show, X%wx% Y%wy% H25 W50, Path of Exile RNG Challenge
  47.         WinGet, k_ID, ID, A
  48.         WinSet, AlwaysOnTop, On, ahk_id %k_ID%
  49.         WinSet, TransColor, FFFFFF 100, ahk_id %k_ID%
  50.         openPOE()
  51.         Return
  52.     }
  53.     Return
  54. }
  55.  
  56. ButtonRNG() {
  57.     openPOE()
  58.     IfWinExist, Path of Exile RNG Challenge Menu
  59.     {
  60.         Gui, 2: Destroy
  61.         openPOE()
  62.         Return
  63.     }  else {
  64.         openPOE()
  65.         WinGetPos,,,width,height
  66.         wx := (width/2-400)
  67.         wy := (height-100)
  68.         Gui, 2: Font, s15, Arial
  69.         Gui, 2: -Caption +AlwaysOnTop +ToolWindow +E0x08000000 +owner1
  70.         Gui, 2: Color, 000000
  71.         Gui, 2: Add, Button, X0 Y0 w100 h50 , Number
  72.         Gui, 2: Add, Button, X100 Y0 w100 h50, YesNo
  73.         Gui, 2: Add, Button, X200 Y0 w100 h50, Letter
  74.         Gui, 2: Add, Button, X300 Y0 w100 h50, Word
  75.         Gui, 2: Add, Button, X400 Y0 w100 h50, Character
  76.         Gui, 2: Add, Button, X500 Y0 w100 h50, Inventory
  77.         Gui, 2: Add, Button, X600 Y0 w100 h50, Flask
  78.         Gui, 2: Add, Button, X700 Y0 w100 h50, Node
  79.         Gui, 2: Show, X%wx% Y%wy% H50 W800 , Path of Exile RNG Challenge Menu
  80.         WinGet, k_ID, ID, A
  81.         WinSet, AlwaysOnTop, On, ahk_id %k_ID%
  82.         WinSet, TransColor, FFFFFF 150, ahk_id %k_ID%
  83.         openPOE()
  84.         Return
  85.     }
  86.     Return
  87. }
  88.  
  89. 2ButtonNumber:
  90. {
  91.     Gui, 2: Destroy
  92.     openPOE()
  93.     WinGetPos,,,width,height
  94.     winW := 225
  95.     winH := 150
  96.     x := (width/2)-(winW/2)
  97.     y := (winY/2)-(winH/2)
  98.     InputBox, start, Word Length, Enter the minimum value.,, %winW%, %winH%, %x%, %y%,,,1
  99.     if ErrorLevel {
  100.         Return
  101.     }
  102.     InputBox, endNum, Word Length, Enter the maximum number.,, %winW%, %winH%, %x%, %y%
  103.     if ErrorLevel {
  104.         Return
  105.     }
  106.     if (start > = endNum ) {
  107.         Return
  108.     }
  109.     randomizeNumber(start, endNum)
  110.     Return
  111. }
  112.  
  113. 2ButtonYesNo:
  114. {
  115.     Gui, 2: Destroy
  116.     randomizeYesNo()
  117.     openPOE()
  118.     Return
  119. }
  120.  
  121. 2ButtonLetter:
  122. {
  123.     Gui, 2: Destroy
  124.     MsgBox, After clicking OK you have two seconds to click where you want to have your letter displayed, before the letter gets randomized.
  125.     Sleep, 2500
  126.     randomizeLetter()
  127.     openPOE()
  128.     Return
  129. }
  130.  
  131. 2ButtonWord:
  132. {
  133.     Gui, 2: Destroy
  134.     openPOE()
  135.     WinGetPos,,,width,height
  136.     winW := 225
  137.     winH := 150
  138.     x := (width/2)-(winW/2)
  139.     y := (winY/2)-(winH/2)
  140.     InputBox, wordLength, Word Length, Enter the number of letters you want to randomize.,, %winW%, %winH%, %x%, %y%
  141.     if ErrorLevel {
  142.         Return
  143.     }
  144.     MsgBox, After clicking OK you have two seconds to click where you want to have your word displayed, before the word gets randomized.
  145.     Sleep, 2500
  146.     createWord(wordLength)
  147.     openPOE()
  148.     Return
  149. }
  150.  
  151. 2ButtonCharacter:
  152. {
  153.     Gui, 2: Destroy
  154.     randomizeCharacter()
  155.     openPOE()
  156.     Return
  157. }
  158.  
  159. 2ButtonInventory:
  160. {
  161.     Gui, 2: Destroy
  162.     randomizeInventory()
  163.     openPOE()
  164.     Return
  165. }
  166.  
  167. 2ButtonFlask:
  168. {
  169.     Gui 2: Destroy
  170.     randomizeFlasks()
  171.     openPOE()
  172.     Return
  173. }
  174.  
  175. 2ButtonNode:
  176. {
  177.     Gui, 2: Destroy
  178.     randomizeNode()
  179.     openPOE()
  180.     Return
  181. }
  182.  
  183.  
  184.  
  185.  
  186. ;Functions
  187. openInventory() {
  188.     SendInput, I
  189.     Return
  190. }
  191.  
  192. openSkillTree() {
  193.     SendInput, P
  194.     Return
  195. }
  196.  
  197. openPOE() {
  198.     IfWinExist, Path of Exile ahk_class Direct3DWindowClass
  199.         WinActivate, Path of Exile ahk_class Direct3DWindowClass
  200.     Return
  201. }
  202.  
  203.  
  204. randomizeYesNo() {
  205.     IfWinExist, Path of Exile ahk_class Direct3DWindowClass
  206.         WinActivate, Path of Exile ahk_class Direct3DWindowClass
  207.     delay := 100
  208.     counter := 0
  209.     WinGetPos,,,width
  210.     cx1 := (width/2-100)
  211.     cx2 := (width/2)
  212.     colorGreen := 009933
  213.     Random, selected, 0, 1
  214.     Loop {
  215.        
  216.         if (counter > 30) {
  217.             delay += 50
  218.         }
  219.         Random,end,0,1 == 1
  220.         if (counter > 40 and end == 1) {
  221.             if (selected == 0) {
  222.                 SplashImage 9:, B H60 W100 X%cx1% Y0 CWCC0000 C11 FM30 CTFFFFFF,,NO
  223.                 SplashImage 10:, B H60 W100 X%cx2% Y0 CW000000
  224.             } else {
  225.                 SplashImage 9:, B H60 W100 X%cx1% Y0 CW000000
  226.                 SplashImage 10:, B H60 W100 X%cx2% Y0 CW009933 C11 FM30 CTFFFFFF,,YES
  227.             }
  228.             Break
  229.         } else {
  230.             if (selected == 0) {
  231.                 SplashImage 9:, B H60 W100 X%cx1% Y0 CWCC0000 C11 FM30 CTFFFFFF,,NO
  232.                 SplashImage 10:, B H60 W100 X%cx2% Y0 CW000000 C11 FM30 CTFFFFFF,,YES
  233.             } else {
  234.                 SplashImage 9:, B H60 W100 X%cx1% Y0 CW000000 C11 FM30 CTFFFFFF,,NO
  235.                 SplashImage 10:, B H60 W100 X%cx2% Y0 CW009933 C11 FM30 CTFFFFFF,,YES
  236.             }
  237.         }
  238.         Sleep, %delay%
  239.         counter += 1
  240.         selected += 1
  241.         if (selected > 1) {
  242.             selected := 0
  243.         }
  244.     }
  245.     Sleep, 3000
  246.     SplashImage 9: Off
  247.     SplashImage 10: Off
  248.     Return 
  249. }
  250.  
  251.  
  252. randomizeNumber(start, end) {
  253.     IfWinExist, Path of Exile ahk_class Direct3DWindowClass
  254.         WinActivate, Path of Exile ahk_class Direct3DWindowClass
  255.     delay := 100
  256.     counter := 0
  257.     selected := 0
  258.     WinGetPos,,,width
  259.     cx := (width/2-75)
  260.     Loop {
  261.        
  262.         if (counter > 40) {
  263.             delay += 50
  264.         }
  265.         lastSelected := selected
  266.         while (lastSelected == selected) {
  267.             Random, selected, start, end
  268.         }
  269.         if (counter > 50) {
  270.             SplashImage 10:, B H60 W150 X%cx% Y0 CW009933 C11 FM30 CTFFFFFF,,%selected%
  271.             Break
  272.         } else {
  273.             SplashImage 10:, B H60 W150 X%cx% Y0 CWCC0000 C11 FM30 CTFFFFFF,,%selected%
  274.         }
  275.         Sleep, %delay%
  276.         counter += 1
  277.     }
  278.     Sleep, 3000
  279.     SplashImage 10: Off
  280.     Return
  281. }
  282.  
  283.  
  284.  
  285. createWordOrder(length) {
  286.     BlockInput, On
  287.     Loop, %length%
  288.     {
  289.         randomizeLetterOrder()
  290.         Sleep, 750
  291.     }
  292.     BlockInput, Off
  293.     Return
  294. }
  295.  
  296.  
  297. createWord(length) {
  298.     BlockInput, On
  299.     Loop, %length%
  300.     {
  301.         randomizeLetter()
  302.         Sleep, 750
  303.     }
  304.     BlockInput, Off
  305.     Return
  306. }
  307.  
  308.  
  309. randomizeLetterOrder() {
  310.     BlockInput, On
  311.     Random, start, 1, 26
  312.     delay := 30
  313.     counter := 0
  314.     i := start
  315.     Letters := []
  316.     Loop, 26
  317.     {
  318.         Letters[A_Index] := Chr(A_Index + 96)
  319.     }
  320.     Loop {
  321.         if (counter > 100) {
  322.             Break
  323.         }
  324.         if (counter > 0) {
  325.             SendInput, {Backspace}
  326.             Sleep, 1
  327.         }
  328.         if (counter > 70 and counter < 90) {
  329.             delay += 10
  330.         }
  331.         Letter := Letters[i]
  332.         SendInput, %Letter%
  333.         Sleep, %delay%
  334.         counter += 1
  335.         i += 1
  336.         if (i > 26) {
  337.             i := 1
  338.         }
  339.     }
  340.     BlockInput Off
  341.     Return
  342. }
  343.  
  344.  
  345. randomizeLetter() {
  346.     BlockInput, On
  347.     delay := 30
  348.     counter := 0
  349.     Letters := []
  350.     Loop, 26
  351.     {
  352.         Letters[A_Index] := Chr(A_Index + 96)
  353.     }
  354.     Loop {
  355.         if (counter > 100) {
  356.             Break
  357.         }
  358.         if (counter > 0) {
  359.             SendInput, {Backspace}
  360.             Sleep, 1
  361.         }
  362.         if (counter > 70 and counter < 90) {
  363.             delay += 10
  364.         }
  365.         Random, i, 1, 26
  366.         Letter := Letters[i]
  367.         SendInput, %Letter%
  368.         Sleep, %delay%
  369.         counter += 1
  370.     }
  371.     BlockInput Off
  372.     Return
  373. }
  374.  
  375.  
  376. randomizeCharacter() {
  377.     openPOE()
  378.    
  379.     WinGetPos,,,width,height
  380.     characterX := [0.32292*width, 0.37*width, 0.4375*width, 0.503*width, 0.5625*width, 0.625*width, 0.675*width]
  381.     characterY := [0.78703*height, 0.75*height, 0.73*height, 0.725*height, 0.73*height, 0.74*height, 0.78*height]
  382.  
  383.     Loop, 7 {
  384.         cx := characterX[a_index]
  385.         cy := characterY[a_index]
  386.         SplashImage %a_index%:, B H40 W40 X%cx% Y%cy% CWCC0000
  387.     }
  388.    
  389.     Sleep, 1000
  390.  
  391.     delay := 200
  392.     counter := 0
  393.     selected := 0
  394.     Loop {
  395.         if (counter > 40) {
  396.             Break
  397.         }
  398.         if (counter > 20) {
  399.             delay += 25
  400.         }
  401.         lastSelected := selected
  402.         while (lastSelected == selected) {
  403.             Random, selected, 1, 7
  404.         }
  405.         Loop, 7 {
  406.             cx := characterX[a_index]
  407.             cy := characterY[a_index]
  408.             if (selected == a_index) {
  409.                 SplashImage %a_index%:, B H40 W40 X%cx% Y%cy% CW009933
  410.  
  411.             } else {
  412.                 SplashImage %a_index%:, B H40 W40 X%cx% Y%cy% CWCC0000
  413.             }
  414.             cx := *width
  415.             cy := *height
  416.         }
  417.         Sleep, %delay%
  418.         counter += 1
  419.     }
  420.  
  421.     BlockInput On
  422.     Sleep, 1000
  423.    
  424.     cx := characterX[selected]
  425.     cy := characterY[selected]-100
  426.     MouseClick, L, %cx%, %cy%, 2, 0
  427.     Loop, 7 {
  428.         SplashImage %a_index%: Off
  429.     }
  430.     Sleep, 2
  431.     cx := 0.58*width
  432.     cy := 0.9259*height
  433.     MouseClick, L, %cx%, %cy%, 1, 0
  434.     BlockInput Off
  435.     Return
  436. }
  437.  
  438.  
  439. randomizeInventory() {
  440.     openPOE()
  441.    
  442.     WinGetPos,,,width,height
  443.     ;         Main Hand             Helmet              Off Hand            Plate               Gloves              Belt                Boots               Ring Left           Ring Right          Amulet
  444.     slotX := [(1322/1920)*width,    (1529/1920)*width,  (1735/1920)*width,  (1529/1920)*width,  (1400/1920)*width,  (1530/1920)*width,  (1660/1920)*width,  (1452/1920)*width,  (1657/1920)*width,  (1657/1920)*width]
  445.     slotY := [(120/1080)*height,    (105/1080)*height,  (120/1080)*height,  (225/1080)*height,  (341/1080)*height,  (395/1080)*height,  (340/1080)*height,  (276/1080)*height,  (276/1080)*height,  (211/1080)*height]
  446.     slotW := [0.0572*width,         0.057*width,        0.0572*width,       0.0572*width,       0.0572*width,       0.056*width,        0.0555*width,       0.03*width,         0.03*width,         0.03*width]
  447.     slotH := [0.2*height,           0.105*height,       0.2*height,         0.151*height,       0.105*height,       0.0542*height,      0.10452*height,     0.056*height,       0.056*height,       0.056*height]
  448.  
  449.     delay := 100
  450.     counter := 0
  451.     selected := 0
  452.     c = 009933
  453.     Loop {
  454.         if (counter > 40) {
  455.             c = CC0000
  456.         }
  457.         if (counter > 20) {
  458.             delay += 20
  459.         }
  460.         lastSelected := selected
  461.         while (lastSelected == selected) {
  462.             Random, selected, 1, 10
  463.         }
  464.         sx := slotX[selected]
  465.         sy := slotY[selected]
  466.         sw := slotW[selected]
  467.         sh := slotH[selected]
  468.         sy2 := sy+sh-5
  469.         sx4 := sx+sw
  470.         SplashImage 1:, B X%sx% Y%sy% W%sw% H5 CW%c%
  471.         SplashImage 2:, B X%sx% Y%sy2% W%sw% H5 CW%c%
  472.         SplashImage 3:, B X%sx% Y%sy% W5 H%sh% CW%c%
  473.         SplashImage 4:, B X%sx4% Y%sy% W5 H%sh% CW%c%
  474.         if (counter > 40) {
  475.             Break
  476.         }
  477.         Sleep, %delay%
  478.         counter += 1
  479.     }
  480.  
  481.     Sleep, 3000
  482.     Loop, 10 {
  483.         SplashImage %a_index%: Off
  484.     }
  485.     Return
  486. }
  487.  
  488.  
  489.  
  490. randomizeFlasks() {
  491.     openPOE()
  492.    
  493.     WinGetPos,,,width,height
  494.     slotZeroX := (1458/1920)*width
  495.     sy := (458/1080)*height
  496.     sw := 0.03*width
  497.     sh := 0.105*height
  498.  
  499.     delay := 100
  500.     counter := 0
  501.     selected := 0
  502.     c = 009933
  503.     Loop {
  504.         if (counter > 25) {
  505.             c = CC0000
  506.         }
  507.         if (counter > 10) {
  508.             delay += 20
  509.         }
  510.         lastSelected := selected
  511.         while (lastSelected == selected) {
  512.             Random, selected, 1, 5
  513.         }
  514.         sx := slotZeroX + (sw-5)*(selected-1)
  515.         sy2 := sy+sh-5
  516.         sx4 := sx+sw-selected
  517.         SplashImage 1:, B X%sx% Y%sy% W%sw% H5 CW%c%
  518.         SplashImage 2:, B X%sx% Y%sy2% W%sw% H5 CW%c%
  519.         SplashImage 3:, B X%sx% Y%sy% W5 H%sh% CW%c%
  520.         SplashImage 4:, B X%sx4% Y%sy% W5 H%sh% CW%c%
  521.         if (counter > 25) {
  522.             Break
  523.         }
  524.         Sleep, %delay%
  525.         counter += 1
  526.     }
  527.  
  528.     Sleep, 3000
  529.     Loop, 4 {
  530.         SplashImage %a_index%: Off
  531.     }
  532.     Return
  533. }
  534.  
  535.  
  536. randomizeNode() {
  537.     openPOE()
  538.  
  539.     nodeCounter := 0
  540.     nw := 45
  541.     nh := 50
  542.     WinGetPos,,,width,height
  543.     SplashImage 5:, B X200 Y200 W600 H30 CW000000 C11 FM10 CTFFFFFF,, "Mark all nodes by clicking on them. Press Enter to start randomizing."
  544.     c = 009933
  545.  
  546.     Loop {
  547.         if GetKeyState("Enter", "P")
  548.         {
  549.             KeyWait, Enter, L
  550.             SendInput, {ENTER}
  551.             Break
  552.         }
  553.         if GetKeyState("LButton", "P")
  554.         {
  555.             MouseGetPos, mousePosX, mousePosY
  556.             nodeCounter += 1
  557.             nodeX%nodeCounter% := mousePosX-25
  558.             nodeY%nodeCounter% := mousePosY-25
  559.             nx := nodeX%nodeCounter%
  560.             ny := nodeY%nodeCounter%
  561.             ny2 := ny+nh-5
  562.             nx4 := nx+nw
  563.             SplashImage 1:, B X%nx% Y%ny% W%nw% H5 CW%c%
  564.             SplashImage 2:, B X%nx% Y%ny2% W%nw% H5 CW%c%
  565.             SplashImage 3:, B X%nx% Y%ny% W5 H%nh% CW%c%
  566.             SplashImage 4:, B X%nx4% Y%ny% W5 H%nh% CW%c%
  567.             KeyWait, LButton, L
  568.         }
  569.         Sleep, 1
  570.     }
  571.  
  572.     SplashImage 5: Off
  573.     SplashImage 6: Off
  574.     if (nodeCounter <= 1)
  575.     {
  576.         Return
  577.     }
  578.  
  579.  
  580.  
  581.     counter := 0
  582.     delay := 100
  583.     selected := 0
  584.     Loop {
  585.         if (counter > 35) {
  586.             c = CC0000
  587.         }
  588.         if (counter > 10) {
  589.             delay += 20
  590.         }
  591.         lastSelected := selected
  592.         while (lastSelected == selected) {
  593.             Random, selected, 1, %nodeCounter%
  594.         }
  595.         nx := nodeX%selected%
  596.         ny := nodeY%selected%
  597.         ny2 := ny+nh-5
  598.         nx4 := nx+nw
  599.         SplashImage 1:, B X%nx% Y%ny% W%nw% H5 CW%c%
  600.         SplashImage 2:, B X%nx% Y%ny2% W%nw% H5 CW%c%
  601.         SplashImage 3:, B X%nx% Y%ny% W5 H%nh% CW%c%
  602.         SplashImage 4:, B X%nx4% Y%ny% W5 H%nh% CW%c%
  603.         if (counter > 35) {
  604.             Break
  605.         }
  606.         Sleep, %delay%
  607.         counter += 1
  608.     }
  609.  
  610.     Sleep, 3000
  611.     Loop, 4 {
  612.         SplashImage %a_index%: Off
  613.     }
  614.     Return
  615. }
Advertisement
Add Comment
Please, Sign In to add comment