-
Notifications
You must be signed in to change notification settings - Fork 19
/
turnin.mac
89 lines (74 loc) · 3.26 KB
/
turnin.mac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|------------------------------------------------------------------------]
| Bernat's Simple Turn-in Macro ]
| ]
| Author : Bernat ]
| File name : turn-in.mac ]
| Version : v1.0 2011-01-12 20:47 GMT+1 ]
| Usage : /macro turn-in itemname ]
| Example: /macro turn-in bone ]
| Example: /macro turn-in "bone chips" ]
| Description : This macro will turn in, as fast as possible and one ]
| by one, items whose partial name is given by ]
| parameter itemname, until running out. Bags ]
| containing the items must be open, and they must be ]
| placed in the first available bags (if bags 1 and 2 ]
| contain items but bag 1 is closed, macro will stop). ]
| For names with multiple words, use of quotes is ]
| required. ]
| Be careful of client usage while the macro is running, ]
| as this may result in macro stopping or wrong item ]
| being turned in. ]
|------------------------------------------------------------------------]
Sub Main(itemname, itemcount)
/declare i int local
/echo Turning in ${itemcount} items by the name of ${itemname}...
/if (${Cursor.ID}) {
/echo ERROR: Unexpected item at cursor.
/endmacro
}
:Loop
/for i 1 to ${itemcount}
/if (!${FindItem[${itemname}].ID}) {
/echo INFO: Ran out of items to turn in.
/endmacro
}
/if (${FindItem[${itemname}].InvSlot.Pack}) {
/if (!${Window[${FindItem[${itemname}].InvSlot.Pack.Name}].Open}) {
/itemnotify ${FindItem[${itemname}].InvSlot.Pack.Name} rightmouseup
/delay 5s ${Window[${FindItem[${itemname}].InvSlot.Pack.Name}].Open}
}
/if (!${Window[${FindItem[${itemname}].InvSlot.Pack.Name}].Open}) {
/echo ERROR: Timeout trying to open a pack.
/endmacro
}
}
/ctrl /itemnotify ${FindItem[${itemname}].InvSlot} leftmouseup
/delay 1m ${Cursor.ID}
/if (!${Cursor.ID}) {
/echo ERROR: Timeout trying to place an item at cursor.
/endmacro
}
/click left target
/delay 1m ${Window[GiveWnd].Open}
/if (!${Window[GiveWnd].Open}) {
/echo ERROR: Timeout trying to open GiveWnd.
/endmacro
}
/if (${Cursor.ID}) {
/echo ERROR: Unexpected item at cursor.
/endmacro
}
/next i
/notify GiveWnd GVW_Give_Button leftmouseup
/delay 1m !${Window[GiveWnd].Open}
/if (${Window[GiveWnd].Open}) {
/echo ERROR: Timeout trying to close GiveWnd.
/endmacro
}
:freecursor
/delay 5
/if (${Cursor.ID}) /autoinv
/delay 5
/if (${Cursor.ID}) /goto :freecursor
/goto :Loop
/return