swapcast.mac a swap item and cast it macro (updated 7-2-5)
Posted: Fri May 14, 2004 5:03 pm
This is my first attempt at a useful macro, i have lots of right click items and hate searching through packs to find them then equip them then put them back ....
Useage: /mac swapcast itemname [slot]
example:
will find and equip Coldain Hero's Insignia Ring , then cast and return it to where it was found.
if you have multiple items with similar names then use quotes.
if you want to specify the slot to equip it in then you may.
if you want to make this an .inc file then just remove the Sub Main section.
edit: added timeout delay for poofed items 5-20-04
edit: fixed to work with 6-29-05 patch
Useage: /mac swapcast itemname [slot]
example:
Code: Select all
/mac swapcast coldainif you have multiple items with similar names then use quotes.
Code: Select all
/mac swapcast "Coldain Hero's Insignia Ring"Code: Select all
/mac swapcast "Coldain Hero's Insignia Ring" rightfingerCode: Select all
Sub Main(p0,p1)
/call SwapCast "${p0}" "${p1}"
/endmacro
Sub SwapCast(item,equipslot)
/declare inventoryslot int local
/declare pack local
/declare packslot int local
/declare leaveopen int local 1
/declare packnumber int local 0
/declare leavetwisting int local 0
/if (!${Defined[item]}) /goto :end
/if (${Twist}) {
/twist stop
/varset leavetwisting 1
}
:stopsingingdelay
/if (${Me.Casting.ID}>0) {
/stopsong
/goto :stopsingingdelay
}
/varset inventoryslot ${FindItem[${item}].InvSlot}
/if (!${inventoryslot}) /goto :notfound
:packcountloop
/if (${inventoryslot}>250 && ${inventoryslot}<331) {
/varset packnumber ${Math.Calc[${packnumber}+1]}
/varset inventoryslot ${Math.Calc[${inventoryslot}-10]}
/goto :packcountloop
}
/if (${packnumber} > 0) {
/varset pack pack${packnumber}
/varset packslot ${Math.Calc[${inventoryslot}-240]}
/goto :foundit
}
:notinpack
/call CastItem ${inventoryslot}
/goto :end
:foundit
/if (!${Window[${pack}].Open}) {
/nomod /itemnotify ${pack} rightmouseup
/varset leaveopen 0
}
/call WaitCursor ${packslot} ${pack}
/if (${equipslot.Find[null]}) {
/if (${Cursor.WornSlots}>0) {
/varset equipslot ${Cursor.WornSlot[1]}
} else {
/varset equipslot pack1
}
}
/call WaitCursor ${equipslot}
/call CastItem ${equipslot}
/call WaitCursor ${equipslot}
/call WaitCursor ${packslot} ${pack}
/if (${leaveopen} == 0) /nomod /itemnotify ${pack} rightmouseup
/goto :end
:notfound
/echo ${item} not found in inventory.
:end
/if (${leavetwisting} == 1) /twist start
/return
Sub CastItem(slot)
/nomod /itemnotify ${slot} rightmouseup
/echo Swapcast::Casting the effect on your ${InvSlot[${slot}].Item.Name}
:castloop
|| special case composer greaves don't ever stop casting
/if (${InvSlot[${slot}].Item.Name.Find["Composers Greaves"]}) {
/delay 12
/stopsong
}
|| special cases for epics and other items that don't seem to cast proper with default cast times
/if (${InvSlot[${slot}].Item.Name.Find["Blade of Vesagran"]}) {
/delay 10
/stopsong
}
/if (${InvSlot[${slot}].Item.Name.Find["Prismatic Dragon Blade"]}) {
/delay 10
/stopsong
}
/if (${Me.Casting.ID}>0) /goto :castloop
/return
Sub WaitCursor(slot, pack)
/declare item local
/declare timeout timer 30
/varset item ${Cursor.ID}
/if (${Defined[pack]}) /goto :waitloop2
:waitloop1
/nomod /itemnotify ${slot} leftmouseup
/if ((${item} == ${Cursor.ID}) && (${timeout} > 0)) /goto :waitloop1
/goto :donewaiting
:waitloop2
/nomod /itemnotify in ${pack} ${slot} leftmouseup
/if ((${item} == ${Cursor.ID}) && (${timeout} > 0)) /goto :waitloop2
:donewaiting
/return
edit: fixed to work with 6-29-05 patch