|------------------------------------------------------------
| Name: Handin.mac
|------------------------------------------------------------
| Author: TheWarden (helped by DKAA)
|------------------------------------------------------------
| Example Uses:
| /macro handin.mac "gp" 2 destroy
| - Hands in 2 gold and destroys items you get.
|
| /macro handin.mac "Batwings" 3
| - Hands in 3 Batwings and keeps the items you get.
|------------------------------------------------------------
#Event TooFar "#*#You are too far away from #*#"
#Event NotWanted "#*#I have no need for this #*#"
#Event NoItems "#*#Invalid item slot #*#"
#Event NoItems "#*#Could not send notification to #*#"
Sub Main(string TheItem, int TheAmount, string DoDestroy)
|------------------------------------------------------------
| Declaring some stuff.
|------------------------------------------------------------
/declare Loopcount int local
/declare Timeout timer local
|------------------------------------------------------------
| A bunch of /if statements to start us out.
|------------------------------------------------------------
/if (!${Defined[TheItem]} || !${Defined[TheAmount]}) {
/call Syntax
}
/if (${TheAmount} == 0) {
/echo Rethink the amount, buddy. Ending macro.
/endmacro
}
:Start
/if (!${Target.ID}) {
/echo You have no target. Ending macro.
/endmacro
}
/if (!${Window[InventoryWindow]}) {
/keypress inventory
/delay 5
}
/if (${Cursor.ID}) {
/autoinv
/delay 5
}
|------------------------------------------------------------
| Determining the item.
|------------------------------------------------------------
/for Loopcount 1 to ${TheAmount}
/if (${TheItem.Equal[pp]}) {
/if (${Me.Platinum} < ${TheAmount}) {
/echo Not enough plat. Ending macro.
/keypress esc
/keypress esc
/endmacro
}
/ctrl /notify InventoryWindow IW_Money0 leftmouseup
} else /if (${TheItem.Equal[gp]}) {
/if (${Me.Gold} < ${TheAmount}) {
/echo Not enough gold. Ending macro.
/keypress esc
/keypress esc
/endmacro
}
/ctrl /notify InventoryWindow IW_Money1 leftmouseup
} else /if (${TheItem.Equal[sp]}) {
/if (${Me.Silver} < ${TheAmount}) {
/echo Not enough silver. Ending macro.
/keypress esc
/keypress esc
/endmacro
}
/ctrl /notify InventoryWindow IW_Money2 leftmouseup
} else /if (${TheItem.Equal[cp]}) {
/if (${Me.Copper} < ${TheAmount}) {
/echo Not enough copper. Ending macro.
/keypress esc
/keypress esc
/endmacro
}
/ctrl /notify InventoryWindow IW_Money3 leftmouseup
} else {
/ctrl /itemnotify ${FindItem[${TheItem}].InvSlot} leftmouseup
}
/doevents
/delay 5
/click left target
/doevents
:GiveWnd
/if (!${Window[GiveWnd].Open}) {
/goto :GiveWnd
}
/next Loopcount
/notify GiveWnd GVW_Give_Button leftmouseup
/doevents
/delay 5
:ClearCursor
/if (${Cursor.ID}) {
/if (${Defined[DoDestroy]} && ${DoDestroy.Equal[destroy]}) {
/destroy
} else {
/autoinv
}
/delay 5
/goto :ClearCursor
}
/goto :Start
:Lag
/echo Macro lagged out. Ending macro.
/endmacro
|------------------------------------------------------------
| Sub: Syntax
|------------------------------------------------------------
Sub Syntax
/echo You fucked up! Check the macro instructions. Ending macro.
/endmacro
|------------------------------------------------------------
| Event: NotWanted
|------------------------------------------------------------
Sub Event_TooFar
/echo NPC is too far away, get closer. Ending macro.
/autoinv
/autoinv
/keypress esc
/endmacro
|------------------------------------------------------------
| Event: NotWanted
|------------------------------------------------------------
Sub Event_NotWanted
/echo NPC doesn't want this item. Ending macro.
/autoinv
/autoinv
/keypress esc
/endmacro
|------------------------------------------------------------
| Event: NoItems
|------------------------------------------------------------
Sub Event_NoItems
/echo Ran out of items. Ending macro.
/keypress esc
/endmacro