I'm stuck on the Add Components Subroutine, and the Combine. Everything else works(for me)
I am pretty new at this and this is my first real "macro"
I used the move.inc from http://www.macroquest2.com/phpBB2/viewtopic.php?t=7207
If anyone can look at this and give me some pointers on how to smooth out my errors I would appreciate it.
Code: Select all
| Smithing Freebie
| Freesmith.mac
| Works on Abysmal Free Smithing Quest
| Version 1.0
| Date: 09-07-04
| By: ScubaSki
|
| You WILL need to in front of Snokin Breaksteel in Abysmal Sea for it to work
|
| Disclaimer:
| Code was used from other programers also from the MQ Forums.
|
| Snokin loc = 96.50,260.36,113.94
| Forge Loc = 175.08,253.02,113.94
| Next to Forge = 165.53,257.12,113.94
#include move.inc
#event CombineError "#*#There was no place to put that#*#"
#event CombineError "#*#You cannot combine these items in this container type!#*#"
#event CombineError "#*#did not accept these items#*#"
#event ContUsed "#*#Someone else is using that. Try again later.#*#"
Sub Main
/declare Comp[3] string outer
/declare ItemTurnIn String outer
:Start
/call GMCheck
/call GetItems
| Move to Forge
/call MovetoLoc 165.53,257.12,113.94
/echo At Forge
/call Docombine
|Move to Snokin
/call MovetoLoc 96.50,260.36,113.94
/echo At Snokin
/call GiveItems
/return
Sub GetItems
/declare i int outer
:Loop
/target Snokin
/face nolook Snokin
/nomodkey /say Silly Work
/delay 1s
/if (!${Window[InventoryWindow].Open}) /nomodkey /keypress inventory
/delay 2
| Inventory Components
/for i 1 to 3
/varset Comp[${i}] ${Cursor.Name}
/echo Item ${i} is ${Comp[${i}]}
/autoinv
/delay 2s
/next i
/return
Sub GiveItems
/target Snokin
/face nolook
/delay 1s
/cleanup
| Open Bag
/itemnotify ${Math.Calc[${FindItem[=${ItemTurnIn}].InvSlot.Pack}-21]} rightmouseup
:ItemLoop
| Click Item
/itemnotify ${FindItem[=${ItemTurnIn].InvSlot} leftmouseup
| Close Bag
/itemnotify ${Math.Calc[${FindItem[=${ItemTurnIn}].InvSlot.Pack}-21]} rightmouseup
| Open GiveWnd, and automatically place item in first give slot.
/click left target
| Checks that the window has been opened. (GiveWnd). This accounts for lag.
:givewindowcheck
/if (${Window}==FALSE) {
/goto :givewindowcheck
}
/nomodkey /notify GiveWnd GVW_Give_Button leftmouseup
| Delay for safety
/delay 1s
|Check for more items
/if (!${FindItem[=${ItemTurnIn}].ID}) {
/goto ItemLoop
}
/call ClosePacks
/return
Sub GMCheck
:gmcheck
/if (${Spawn[gm].ID}>0) {
/echo "Waiting on GM to leave zone."
/delay 10
/goto :gmcheck
}
/return
Sub Event_CombineError
/beep
/return
Sub Event_ContUsed
/echo Container in use. Waiting 30 seconds and trying again.
/delay 30s
/itemtarget "Forge"
/delay 1s
/nomodkey /click left item
/delay 2s
/doevents
/return
|---------------------------------------------------
| SUB: Do the Comines
|---------------------------------------------------
Sub DoCombine
/declare iSlot int local
/declare Counter int local
/doevents
|------------------------------------------------
| Open Forge.
|------------------------------------------------
/itemtarget Forge
/face item
/click left item
/delay 2s
/notify TradeSkillWnd ExperimentButton leftmouseup
|------------------------------------------------
| Clear Out Brew Barrel.
|------------------------------------------------
/echo Cleaning Out Forge...
/for iSlot 1 to 10
/shiftkey /itemnotify enviro${iSlot} leftmouseup
/if (${Cursor.ID}) {
/destroy
}
/next iSlot
|------------------------------------------------
| Open Inventory Window.
|------------------------------------------------
/if (${Window[Inventory].Open}==FALSE) {
/windowstate inventory open
}
|------------------------------------------------
| Open All 8 Packs.
|------------------------------------------------
/for iSlot 1 to 8
/if (${Window[Pack${iSlot}].Open}==FALSE) {
/itemnotify pack${iSlot} rightmouseup
}
/next iSlot
|------------------------------------------------
| Make Recipe.
|------------------------------------------------
/echo Making Recipe...
:MakeRecipe
/doevents
/call GMCheck
/for Counter 1 to 3
/if (${FindItem[${Comp[${Counter}]}].InvSlot}==NULL) /goto :Done
/ctrl /itemnotify ${FindItem[=${Comp[${Counter}]}].InvSlot} leftmouseup
/delay 2
/echo ${Comp[${Counter}]}
/itemnotify enviro${Counter} leftmouseup
/delay 2
/next Counter
/delay 2
/combine enviro
|------------------------------------------------
| Waiting for Combine to Finish.
|------------------------------------------------
:WaitCombine
/if (!${Cursor.ID}) {
/goto :WaitCombine
}
/combine enviro
|------------------------------------------------
| Clearing the Cursor.
|------------------------------------------------
:ClearCursor
/autoinventory
}
/delay 2
/if (!${Cursor.ID}) {
/goto :MakeRecipe
} else {
/goto :ClearCursor
}
|------------------------------------------------
| Done with Making Recipe.
|------------------------------------------------
:Done
/cleanup
/return

