Tiberivs Posted October 8, 2009 Share Posted October 8, 2009 (edited) I am unsure of how to pass variables such as $makeBarrels from the GUI to the loops that they are referred to in. I'm thinking some of the experts around here have the answer on the tip of their tongue : ) expandcollapse popup;FullAutoCraft ;Author Joseph Richter (joseph.richter1@gmail.com) #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> Gui() Func Gui() Local $go, $msg, $count, $makeBarrels, $makeKits, $repeat, $kits GUICreate("FullAutoCraft") $makeBarrels = GUICtrlCreateRadio("Projectile Pistol Barrels", 10, 10, 120, 20) $makeKits = GUICtrlCreateRadio("WDG Crafing kits", 10, 40, 120, 20) $repeat = GuiCtrlCreateInput("# To Craft", 10, 70, 120, 20) $kits = GuiCtrlCreateInput("# Of Kits", 10, 100, 120, 20) $go = GuiCtrlCreateButton("Start", 10, 130, 120, 20) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $go Then ExitLoop If $msg = $GUI_EVENT_CLOSE Then Exit WEnd GuiDelete() ;WinWaitActive("SwgClient") Sleep(5000) While $count <= $repeat And $makeBarrels = 1 If $kits = 1 Then Send( "{1}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 175, 175, 400, 200) Sleep(1500) MouseClickDrag("left", 175, 175, 525, 200) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf If $kits = 2 Then Send( "{2}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 175, 175, 400, 200) Sleep(1500) MouseClickDrag("left", 175, 175, 525, 200) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf If $kits = 3 Then Send( "{3}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 175, 175, 400, 200) Sleep(1500) MouseClickDrag("left", 175, 175, 525, 200) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf If $kits = 4 Then Send( "{4}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 175, 175, 400, 200) Sleep(1500) MouseClickDrag("left", 175, 175, 525, 200) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf WEnd While $count <= $repeat And $makeKits = 1 If $kits = 1 Then Send( "{1}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 250, 200, 400, 200) Sleep(1500) MouseClickDrag("left", 250, 200, 525, 200) Sleep(1500) MouseClickDrag("left", 115, 275, 400, 350) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf If $kits = 2 Then Send( "{2}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 250, 200, 400, 200) Sleep(1500) MouseClickDrag("left", 250, 200, 525, 200) Sleep(1500) MouseClickDrag("left", 115, 275, 400, 350) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf If $kits = 3 Then Send( "{3}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 250, 200, 400, 200) Sleep(1500) MouseClickDrag("left", 250, 200, 525, 200) Sleep(1500) MouseClickDrag("left", 115, 275, 400, 350) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf If $kits = 4 Then Send( "{4}" ) Sleep(1000) Send( "{5}" ) Sleep(2000) MouseClickDrag("left", 250, 200, 400, 200) Sleep(1500) MouseClickDrag("left", 250, 200, 525, 200) Sleep(1500) MouseClickDrag("left", 115, 275, 400, 350) Sleep(1500) Send( "{6}" ) Sleep(2000) $count = $count + 1 EndIf WEnd EndFunc Exit Edited October 8, 2009 by Tiberivs Link to comment Share on other sites More sharing options...
dantay9 Posted October 8, 2009 Share Posted October 8, 2009 (edited) I cleaned up the code a bit for you. Switch loops are much easier to read and also to add on to. I also found a bit of code that was repetitive, so that can be put outside the switch statement or even in its own function. I think what you are looking for is GuiCtrlRead. Here is the code I have: expandcollapse popup;FullAutoCraft ;Author Joseph Richter (joseph.richter1@gmail.com) #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> Gui() Func Gui() Local $go, $msg, $count, $makeBarrels, $makeKits, $repeat, $kits GUICreate("My GUI radio") $BarrelsButton = GUICtrlCreateRadio("Projectile Pistol Barrels", 10, 10, 120, 20) $KitsButton = GUICtrlCreateRadio("WDG Crafing kits", 10, 40, 120, 20) $repeat = GUICtrlCreateInput("# To Craft", 10, 70, 120, 20) $kits = GUICtrlCreateInput("# Of Kits", 10, 100, 120, 20) $go = GUICtrlCreateButton("Start", 10, 130, 120, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $go ;if BarrelsButton is checked, makebarrels will be set to $GUI_UNCHECKED (4), if it is, $GUI_CHECKED (1) $makeBarrels = GUICtrlRead($BarrelsButton) $makeKits = GUICtrlRead($KitsButton) ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUIDelete() ;WinWaitActive("SwgClient") Sleep(5000) While $count <= $repeat And $makeBarrels = $GUI_CHECKED Switch $kits Case 1 Send("{1}") Case 2 Send("{2}") Case 3 Send("{3}") Case 4 Send("{4}") EndSwitch ;this part is the same for each case of kits so we can put it here and shorten the code Sleep(1000) Send("{5}") Sleep(2000) MouseClickDrag("left", 175, 175, 400, 200) Sleep(1500) MouseClickDrag("left", 175, 175, 525, 200) Sleep(1500) Send("{6}") Sleep(2000) $count += 1 WEnd While $count <= $repeat And $makeKits = $GUI_CHECKED Switch $kits Case 1 Send("{1}") Case 2 Send("{2}") Case 3 Send("{3}") Case 4 Send("{4}") EndSwitch ;same thing as above Sleep(1000) Send("{5}") Sleep(2000) MouseClickDrag("left", 250, 200, 400, 200) Sleep(1500) MouseClickDrag("left", 250, 200, 525, 200) Sleep(1500) MouseClickDrag("left", 115, 275, 400, 350) Sleep(1500) Send("{6}") Sleep(2000) $count += 1 WEnd EndFunc ;==>Gui Edited October 8, 2009 by dantay9 Link to comment Share on other sites More sharing options...
Tiberivs Posted October 8, 2009 Author Share Posted October 8, 2009 Thanks, your help is highly appreciated. You have thoroughly answered my question, and the code optimization is very welcome. I suppose you can tell I am still novice at programming, this would be because I am still taking computer science in high school, haha. I'll try implementing these changes to ensure that the macro will run as intended. Link to comment Share on other sites More sharing options...
Tiberivs Posted October 8, 2009 Author Share Posted October 8, 2009 (edited) I have run the script; there is one problem that exposed itself. That being, the variable $kits and $repeat are not having their values passed, and there are no conditions for them in each switch. I see it is possible to pass bool values through GUI, but can I do the same for int? If $kit = 4, use case 4. If $repeat = 20, repeat the loop 20 times. Thanks for the help as always. Edit: I just remembered this... It is complicated for me to explain, but $kit also determines how many times the loop is performed, but each time the loop is performed, $kit executes a unique command. I think I can fix this on my own after the original problem is resolved though. I'll use something like, $origkit, and everytime the loop runs ill add 1 to $kit until it equals $origkit, then reset the value for $kit. You can just overlook this edit Edited October 8, 2009 by Tiberivs Link to comment Share on other sites More sharing options...
Tiberivs Posted October 8, 2009 Author Share Posted October 8, 2009 (edited) Anyways, here is what I added to the end of each loop in order too fix that problem. This is in response to the edit I made on the previous post. If $kits < $origKits Then $kits += 1 If $kits = $origKits Then $kits = 1 I also realized that you had already included the conditions in each case. It was just hard for me to see at first due to my untrained eye. The problems still persist, where I do not know how to pass int data from Gui to the loops. I look at some other methods in the meantime to see if I cannot find something suitable. Edited October 8, 2009 by Tiberivs Link to comment Share on other sites More sharing options...
Tiberivs Posted October 8, 2009 Author Share Posted October 8, 2009 (edited) Okay, got everything working flawlessly, even added in "lag mode". I discovered that the GUICtrlRead() returned not just a bool, but the actual value of the variable; I was wrong to assume otherwise. From this point on, I'll build on what we got so far by adding new features and options. Take a look at the "Credits" comment at the heading of the script. Oh, and sorry for the quadruple post,,, Is that acceptable on these forums? expandcollapse popup;FullAutoCraft1 ;Main Developer: Joseph "Tiberivs" Richter (joseph.richter1@gmail.com)" ;Contributers: "dantay9 from autoitscript.com" #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> $count = 0 $kits = 0 $origKits = 0 $repeat = 0 $makeBarrels = 0 $makeKits = 0 $lag = 0 $fix1 = 0 $makeKnives = 0 $Quadidism = 0 $xQuadidism = 0 $yQuadidism = 0 $Quadunezo = 0 $xQuadunezo = 0 $yQuadunezo = 0 $xResSlot1 = 35 $yResSlot1 = 115 $xResSlot2 = 70 $yResSlot2 = 115 $xResSlot3 = 100 $yResSlot3 = 115 $xResSlot4 = 135 $yResSlot4 = 115 $xResSlot5 = 170 $yResSlot5 = 115 $xResSlot6 = 0 $yResSlot6 = 0 $xResSlot7 = 0 $yResSlot7 = 0 $xResSlot8 = 0 $yResSlot8 = 0 $xSlot1 = 450 $ySlot1 = 135 $xSlot2 = 560 $ySlot2 = 135 $xSlot3 = 450 $ySlot3 = 260 $xSlot4 = 0 $ySlot4 = 0 Gui() AssignSlots() Macro() Func Gui() Local $go, $msg, $r, $k, $l, $tempQuadidism, $tempQuadunezo, $f1, $KnifeButton GUICreate("FullAutoCraft") $BarrelsButton = GUICtrlCreateRadio("Projectile Pistol Barrel", 10, 10, 120, 20) $KitsButton = GUICtrlCreateRadio("WDG Crafing Kits", 10, 40, 120, 20) $KnifeButton = GUICtrlCreateRadio("Survival Knives", 10, 70, 120, 20) $r = GUICtrlCreateInput("# To Craft", 10, 100, 120, 20) $k = GUICtrlCreateInput("# Of Kits", 10, 130, 120, 20) $l = GUICtrlCreateCheckbox("Use Lag Mode?", 10, 160, 120, 20) $f1 = GUICtrlCreateCheckbox("Use Fix1?", 10, 190, 120, 20) GUICtrlCreateLabel("Quadidism Slot #", 10, 250, 120, 20) $tempQuadidism = GuiCtrlCreateInput("1", 10, 270, 120, 20) GuiCtrlCreateUpDown(-1) GUICtrlCreateLabel("Quadunezo Slot #", 10, 300, 120, 20) $tempQuadunezo = GuiCtrlCreateInput("1", 10, 320, 120, 20) GuiCtrlCreateUpDown(-1) $go = GUICtrlCreateButton("Start", 10, 380, 120, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $go $makeBarrels = GUICtrlRead($BarrelsButton) $makeKits = GUICtrlRead($KitsButton) $repeat = GUICtrlRead($r) $origKits = GUICtrlRead($k) $lag = GUICtrlRead($l) $Quadidism = GUICtrlRead($tempQuadidism) $Quadunezo = GUICtrlRead($tempQuadunezo) $makeKnives = GUICtrlRead($KnifeButton) $fix1 = GUICtrlRead($f1) ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUIDelete() EndFunc Func waitShort() Switch $lag case $GUI_CHECKED Sleep(2000) case $GUI_UNCHECKED Sleep(1000) EndSwitch EndFunc Func waitLong() Switch $lag case $GUI_CHECKED Sleep(6000) case $GUI_UNCHECKED Sleep(3000) EndSwitch EndFunc Func nextCraftingStage() Switch $fix1 case $GUI_CHECKED MouseClick("left", 890, 750) case $GUI_UNCHECKED Send("{F5}") ;Send("{ENTER} /nextCraftingStage'{ENTER}") EndSwitch EndFunc Func makeItem() Switch $fix1 case $GUI_CHECKED MouseClick("left", 890, 750) waitLong() MouseClick("left", 890, 750) waitLong() MouseClick("left", 890, 750) case $GUI_UNCHECKED Send("{F6}") ;Send("{ENTER} /nextCraftingStage;{ENTER}") ;waitLong() ;Send("{ENTER} /nextCraftingStage;{ENTER}") ;waitLong() ;Send("{ENTER} /nextCraftingStage;{ENTER}") EndSwitch EndFunc Func AssignSlots() Switch $Quadidism case 1 $xQuadidism = $xResSlot1 $yQuadidism = $yResSlot1 case 2 $xQuadidism = $xResSlot2 $yQuadidism = $yResSlot2 case 3 $xQuadidism = $xResSlot3 $yQuadidism = $yResSlot3 case 4 $xQuadidism = $xResSlot4 $yQuadidism = $yResSlot4 case 5 $xQuadidism = $xResSlot5 $yQuadidism = $yResSlot5 case 6 $xQuadidism = $xResSlot6 $yQuadidism = $yResSlot6 case 7 $xQuadidism = $xResSlot7 $yQuadidism = $yResSlot7 case 8 $xQuadidism = $xResSlot8 $yQuadidism = $yResSlot8 EndSwitch Switch $Quadunezo case 1 $xQuadunezo = $xResSlot1 $yQuadunezo = $yResSlot1 case 2 $xQuadunezo = $xResSlot2 $yQuadunezo = $yResSlot2 case 3 $xQuadunezo = $xResSlot3 $yQuadunezo = $yResSlot3 case 4 $xQuadunezo = $xResSlot4 $yQuadunezo = $yResSlot4 case 5 $xQuadunezo = $xResSlot5 $yQuadunezo = $yResSlot5 case 6 $xQuadunezo = $xResSlot6 $yQuadunezo = $yResSlot6 case 7 $xQuadunezo = $xResSlot7 $yQuadunezo = $yResSlot7 case 8 $xQuadunezo = $xResSlot8 $yQuadunezo = $yResSlot8 EndSwitch EndFunc Func Macro() ;WinWaitActive("SwgClient") Sleep(5000) $kits = 1 While $count <= $repeat And $makeBarrels = $GUI_CHECKED Switch $kits Case 1 Send("{1}") Case 2 Send("{2}") Case 3 Send("{3}") Case 4 Send("{4}") Case 5 Send("{5}") Case 6 Send("{6}") Case 7 Send("{7}") Case 8 Send("{8}") EndSwitch waitLong() nextCraftingStage() waitLong() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot1, $ySlot1) waitShort() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot2, $ySlot2) waitLong() makeItem() waitLong() $count += 1 If $kits < $origKits Then $kits += 1 If $kits = $origKits Then $kits = 1 WEnd While $count <= $repeat And $makeKits = $GUI_CHECKED Switch $kits Case 1 Send("{1}") Case 2 Send("{2}") Case 3 Send("{3}") Case 4 Send("{4}") Case 5 Send("{5}") Case 6 Send("{6}") Case 7 Send("{7}") Case 8 Send("{8}") EndSwitch waitLong() nextCraftingStage() waitLong() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot1, $ySlot1) waitShort() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot2, $ySlot2) waitShort() MouseClickDrag("left", $xQuadunezo, $yQuadunezo, $xSlot3, $ySlot3) waitLong() makeItem() waitLong() $count += 1 If $kits < $origKits Then $kits += 1 If $kits = $origKits Then $kits = 1 WEnd EndFunc Edited October 9, 2009 by Tiberivs Link to comment Share on other sites More sharing options...
Tiberivs Posted October 13, 2009 Author Share Posted October 13, 2009 (edited) Added an update to the code. I only care to post it on here just incase someone else can benefit from examining it. I only have alittle bit more to go before the script is complete. expandcollapse popup;FullAutoCraft1 ;Latest Update: 10-13-09 ;Main Developer: Joseph Richter (fac.dev1@gmail.com) ;Contributers: "dantay9 from autoitscript.com" ; Instructions ; -------------------- ; 1. Launch SWG in borderless window mode at 1024 x 768 resolution ; 2. Stretch all 4 crafting windows to maximum width and height ; 3. Go to options->interface, set inventory icon size to minimum ; 4. Perform 1 successful craft of the item you plan on crafting with this macro; this sets the default ; 5. Create a macro with this line and place it on tooltip 5; ; /ui action defaultButton; ; 6. Create another macro with these lines and place on tooltip 6; ; /nextCraftingStage; ; /nextCraftingStage; ; /nextCraftingStage; ; /nextCraftingStage; ; /createPrototype Practice No Item; ; /createPrototype Practice No Item; ; 7. Go to control options and ensure toolsip hotkeys are set to numbers 1-9. ; 8. Obtain FullAutoCraft.exe and set value to your desire. ; Notes about UI ; -------------------- ; Lag mod forces the macro to work at a slower pace to compensate for when the server is bogged down ; Fix #1 is used for those who have been unsuccessful at setting up macro 5 and 6, using this fix will solve the problem ; The UI will be receiving a much needed overhaul soon, so that users will be less likely to input incorrect settings ; Please send feedback regarding this script to the email provided above, whether it be regarding bugs or improvement potential #include <GuiConstantsEx.au3> #include <AVIConstants.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> $count = 0 $kits = 0 $origKits = 0 $repeat = 0 $makeBarrels = 0 $makeKits = 0 $lag = 0 $fix1 = 0 $makeKnives = 0 $custom = 0 $numSlots = 0 $empty = 0 $resToUse1 = 0 $resToUse2 = 0 $resToUse3 = 0 $resToUse4 = 0 $xresToUse1 = 0 $yresToUse1 = 0 $xresToUse2 = 0 $yresToUse2 = 0 $xresToUse3 = 0 $yresToUse3 = 0 $xresToUse4 = 0 $yresToUse4 = 0 $Quadidism = 0 $xQuadidism = 0 $yQuadidism = 0 $Quadunezo = 0 $xQuadunezo = 0 $yQuadunezo = 0 $xResSlot1 = 35 $yResSlot1 = 115 $xResSlot2 = 70 $yResSlot2 = 115 $xResSlot3 = 100 $yResSlot3 = 115 $xResSlot4 = 135 $yResSlot4 = 115 $xResSlot5 = 170 $yResSlot5 = 115 $xResSlot6 = 0 $yResSlot6 = 0 $xResSlot7 = 0 $yResSlot7 = 0 $xResSlot8 = 0 $yResSlot8 = 0 $xSlot1 = 450 $ySlot1 = 135 $xSlot2 = 560 $ySlot2 = 135 $xSlot3 = 450 $ySlot3 = 260 $xSlot4 = 0 $ySlot4 = 0 Gui() AssignResourcesToUse() AssignSlots() ;WinWaitActive("SwgClient") Macro() Func Gui() Local $go, $msg, $r, $k, $l, $tempQuadidism, $tempQuadunezo, $f1, $KnifeButton, $use1, $use2, $use3, $use4, $c, $slots, $emp GUICreate("FullAutoCraft") $BarrelsButton = GUICtrlCreateRadio("Projectile Pistol Barrel", 10, 10, 120, 20) $KitsButton = GUICtrlCreateRadio("WDG Crafing Kits", 10, 30, 120, 20) $KnifeButton = GUICtrlCreateRadio("Survival Knives", 10, 50, 120, 20) $c = GUICtrlCreateRadio("Craft Custom Item?", 10, 70, 120, 20) $r = GUICtrlCreateInput("# To Craft", 10, 100, 120, 20) $k = GUICtrlCreateInput("# Of Kits", 10, 130, 120, 20) $l = GUICtrlCreateCheckbox("Use Lag Mode?", 10, 160, 120, 20) $f1 = GUICtrlCreateCheckbox("Use Fix1?", 10, 190, 120, 20) GUICtrlCreateLabel("Quadidism Slot #", 10, 250, 120, 20) $tempQuadidism = GUICtrlCreateInput("1", 10, 270, 120, 20) GuiCtrlCreateUpDown(-1) GUICtrlCreateLabel("Quadunezo Slot #", 10, 300, 120, 20) $tempQuadunezo = GUICtrlCreateInput("1", 10, 320, 120, 20) GuiCtrlCreateUpDown(-1) GUICtrlCreateLabel("Resource to use in Slot 1:", 160, 10, 140, 20) $use1 = GUICtrlCreateCombo("", 160, 30, 120, 20) GUICtrlSetData(-1, "Empty|Quadidism|Quadunezo", "Empty") GUICtrlCreateLabel("Resource to use in Slot 2:", 160, 70, 140, 20) $use2 = GUICtrlCreateCombo("", 160, 90, 120, 20) GUICtrlSetData(-1, "Empty|Quadidism|Quadunezo", "Empty") GUICtrlCreateLabel("Resource to use in Slot 3:", 160, 130, 140, 20) $use3 = GUICtrlCreateCombo("", 160, 150, 120, 20) GUICtrlSetData(-1, "Empty|Quadidism|Quadunezo", "Empty") GUICtrlCreateLabel("Resource to use in Slot 4:", 160, 190, 140, 20) $use4 = GUICtrlCreateCombo("", 160, 210, 120, 20) GUICtrlSetData(-1, "Empty|Quadidism|Quadunezo", "Empty") GUICtrlCreateLabel("Number of slots to use?", 160, 270, 140, 20) $slots = GUICtrlCreateInput("1", 160, 290, 120, 20) GuiCtrlCreateUpDown(-1) $go = GUICtrlCreateButton("Start", 10, 380, 120, 20) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $go $makeBarrels = GUICtrlRead($BarrelsButton) $makeKits = GUICtrlRead($KitsButton) $repeat = GUICtrlRead($r) $origKits = GUICtrlRead($k) $lag = GUICtrlRead($l) $Quadidism = GUICtrlRead($tempQuadidism) $Quadunezo = GUICtrlRead($tempQuadunezo) $makeKnives = GUICtrlRead($KnifeButton) $fix1 = GUICtrlRead($f1) $resToUse1 = GUICtrlRead($use1) $resToUse2 = GUICtrlRead($use2) $resToUse3 = GUICtrlRead($use3) $resToUse4 = GUICtrlRead($use4) $custom = GUICtrlREad($c) $slots = GUICtrlRead($numSlots) ExitLoop Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUIDelete() EndFunc Func waitShort() Switch $lag case $GUI_CHECKED Sleep(2000) case $GUI_UNCHECKED Sleep(1000) EndSwitch EndFunc Func waitLong() Switch $lag case $GUI_CHECKED Sleep(6000) case $GUI_UNCHECKED Sleep(3000) EndSwitch EndFunc Func nextCraftingStage() Switch $fix1 case $GUI_CHECKED MouseClick("left", 890, 750) case $GUI_UNCHECKED Send("{5}") ;Send("{ENTER} /action ui defaultButton'{ENTER}") EndSwitch EndFunc Func makeItem() Switch $fix1 case $GUI_CHECKED MouseClick("left", 890, 750) waitLong() MouseClick("left", 890, 750) waitLong() MouseClick("left", 890, 750) case $GUI_UNCHECKED Send("{6}") ;Send("{ENTER} /nextCraftingStage;{ENTER}") ;waitLong() ;Send("{ENTER} /nextCraftingStage;{ENTER}") ;waitLong() ;Send("{ENTER} /nextCraftingStage;{ENTER}") EndSwitch EndFunc Func AssignSlots() Switch $Quadidism case 1 $xQuadidism = $xResSlot1 $yQuadidism = $yResSlot1 case 2 $xQuadidism = $xResSlot2 $yQuadidism = $yResSlot2 case 3 $xQuadidism = $xResSlot3 $yQuadidism = $yResSlot3 case 4 $xQuadidism = $xResSlot4 $yQuadidism = $yResSlot4 case 5 $xQuadidism = $xResSlot5 $yQuadidism = $yResSlot5 case 6 $xQuadidism = $xResSlot6 $yQuadidism = $yResSlot6 case 7 $xQuadidism = $xResSlot7 $yQuadidism = $yResSlot7 case 8 $xQuadidism = $xResSlot8 $yQuadidism = $yResSlot8 EndSwitch Switch $Quadunezo case 1 $xQuadunezo = $xResSlot1 $yQuadunezo = $yResSlot1 case 2 $xQuadunezo = $xResSlot2 $yQuadunezo = $yResSlot2 case 3 $xQuadunezo = $xResSlot3 $yQuadunezo = $yResSlot3 case 4 $xQuadunezo = $xResSlot4 $yQuadunezo = $yResSlot4 case 5 $xQuadunezo = $xResSlot5 $yQuadunezo = $yResSlot5 case 6 $xQuadunezo = $xResSlot6 $yQuadunezo = $yResSlot6 case 7 $xQuadunezo = $xResSlot7 $yQuadunezo = $yResSlot7 case 8 $xQuadunezo = $xResSlot8 $yQuadunezo = $yResSlot8 EndSwitch EndFunc Func AssignResourcesToUse() Switch $resToUse1 case "Quadidism" $xresToUse1 = $Quadidism $yresToUse1 = $Quadidism case "Quadunezo" $xresToUse1 = $Quadunezo $yresToUse1 = $Quadunezo case "Empty" $xresToUse1 = 0 $yresToUse1 = 0 EndSwitch Switch $resToUse2 case "Quadidism" $xresToUse2 = $Quadidism $yresToUse2 = $Quadidism case "Quadunezo" $xresToUse2 = $Quadunezo $yresToUse2 = $Quadunezo case "Empty" $xresToUse2 = 0 $yresToUse2 = 0 EndSwitch Switch $resToUse3 case "Quadidism" $xresToUse3 = $Quadidism $yresToUse3 = $Quadidism case "Quadunezo" $xresToUse3 = $Quadunezo $yresToUse3 = $Quadunezo case "Empty" $xresToUse3 = 0 $yresToUse3 = 0 EndSwitch Switch $resToUse4 case "Quadidism" $xresToUse4 = $Quadidism $yresToUse4 = $Quadidism case "Quadunezo" $xresToUse4 = $Quadunezo $yresToUse4 = $Quadunezo case "Empty" $xresToUse4 = 0 $yresToUse4 = 0 EndSwitch EndFunc Func UseKit() Switch $kits Case 1 Send("{1}") Case 2 Send("{2}") Case 3 Send("{3}") Case 4 Send("{4}") Case 5 Send("{5}") Case 6 Send("{6}") Case 7 Send("{7}") Case 8 Send("{8}") EndSwitch EndFunc Func Macro() Sleep(5000) $kits = 1 While $count <= $repeat And $custom = $GUI_CHECKED UseKit() waitLong() nextCraftingStage() waitLong() If $numSlots = 1 Then MouseClickDrag("left", $xResToUse1, $yResToUse1, $xSlot1, $ySlot1) If $numSlots = 1 Then waitShort() If $numSlots = 2 Then MouseClickDrag("left", $xResToUse2, $yResToUse2, $xSlot2, $ySlot2) If $numSlots = 2 Then waitShort() If $numSlots = 3 Then MouseClickDrag("left", $xResToUse3, $yResToUse3, $xSlot3, $ySlot3) If $numSlots = 3 Then waitShort() If $numSlots = 4 Then MouseClickDrag("left", $xResToUse4, $yResToUse4, $xSlot4, $ySlot4) If $numSlots = 4 Then waitLong() makeItem() waitLong() $count += 1 If $kits < $origKits Then $kits += 1 If $kits = $origKits Then $kits = 1 WEnd While $count <= $repeat And $makeBarrels = $GUI_CHECKED UseKit() waitLong() nextCraftingStage() waitLong() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot1, $ySlot1) waitShort() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot2, $ySlot2) waitLong() makeItem() waitLong() $count += 1 If $kits < $origKits Then $kits += 1 If $kits = $origKits Then $kits = 1 WEnd While $count <= $repeat And $makeKits = $GUI_CHECKED UseKit() waitLong() nextCraftingStage() waitLong() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot1, $ySlot1) waitShort() MouseClickDrag("left", $xQuadidism, $yQuadidism, $xSlot2, $ySlot2) waitShort() MouseClickDrag("left", $xQuadunezo, $yQuadunezo, $xSlot3, $ySlot3) waitLong() makeItem() waitLong() $count += 1 If $kits < $origKits Then $kits += 1 If $kits = $origKits Then $kits = 1 WEnd EndFunc Edited October 13, 2009 by Tiberivs Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now