swapcast.mac a swap item and cast it macro (updated 7-2-5)

Post your completed (working) macros here. Only for macros using MQ2Data syntax!

Moderator: MacroQuest Developers

User avatar
Infinite monkeys
a lesser mummy
a lesser mummy
Posts: 36
Joined: Tue Feb 24, 2004 11:14 pm

Post by Infinite monkeys » Sat Sep 23, 2006 9:33 pm

same results JJ. casts then just leaves things where they are with out putting them back.

User avatar
Infinite monkeys
a lesser mummy
a lesser mummy
Posts: 36
Joined: Tue Feb 24, 2004 11:14 pm

Post by Infinite monkeys » Sat Sep 23, 2006 9:54 pm

This is what i get when I use it to cast my DS clicky. BTW im typing this out cause im bored and raiding =)

Code: Select all

[color=red]Unparsable in Calculation: 'B'[/color]
swapcast.mac@67 (CastItem(Slot)): /delay 3s ${Me.Casting}
swapcast.mac@53 (SwapCast(item,equipslot)): /call CastItem ${equipslot}
swapcast.mac@2 (Main(p0,p1)): /call SwapCast "${p0}" "{p1}"
The current macro has ended.
[color=red]Failed to parse /delay condition 'Bramblecoat'. non-numeric encountered[/color]

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Sat Sep 23, 2006 10:00 pm

Suppose to be

Code: Select all

/delay 3s ${Me.Casting.ID}
Is it leaving the item you cast in the slot? or picking it back up, just not putting it back into your bag?

User avatar
Infinite monkeys
a lesser mummy
a lesser mummy
Posts: 36
Joined: Tue Feb 24, 2004 11:14 pm

Post by Infinite monkeys » Sat Sep 23, 2006 10:03 pm

Leaving it in the slot

User avatar
Infinite monkeys
a lesser mummy
a lesser mummy
Posts: 36
Joined: Tue Feb 24, 2004 11:14 pm

Post by Infinite monkeys » Sat Sep 23, 2006 10:05 pm

Ok that worked. the only thing i changed was the Wait. to 1s which should be long enough to notify server.

Thanks JJ your the man.

Code: 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 Waiting 3seconds for server or untill I start to cast 
  /delay 1s ${Me.Casting.ID}
   /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}) /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

JimJohnson
a grimling bloodguard
a grimling bloodguard
Posts: 1299
Joined: Sat Oct 11, 2003 6:00 am

Post by JimJohnson » Sat Sep 23, 2006 10:10 pm

If you ever have server lag 1 second wont always be enough, putting at at 3 will wait MAX of 3 seconds, but once you start to cast it will move on and stop the delay.

basicaly its /delay 3s OR Until ${Me.Casting.ID}

3 seconds wont ever get meet unless your in a high lag zone or your isp almost drops you what not. its your call tho

User avatar
Infinite monkeys
a lesser mummy
a lesser mummy
Posts: 36
Joined: Tue Feb 24, 2004 11:14 pm

Post by Infinite monkeys » Wed Jan 17, 2007 10:02 pm

blah broke again for me. now it doesnt seem to find items =)

was there or is there a change in the structs for item?

or actually would it be inventory.

The only time it would fire is if it were in a slot (if it must be equiped)

Im lost =)

jimbo123
a ghoul
a ghoul
Posts: 87
Joined: Wed Dec 21, 2005 9:46 pm

Post by jimbo123 » Thu Jan 18, 2007 7:44 am

Yeah, FindItemCount will not count items in bags either. It seems to be related.

--jimbo

sedyei
Custom Builder
Custom Builder
Posts: 21
Joined: Mon Jan 03, 2005 6:32 pm

Post by sedyei » Sat Feb 17, 2007 10:11 am

fixed my macro for this latest expansion (buried sea)

be aware that this does necessarily not include any customizations or other patches in this thread... i've only fixed it to work with the latest bagslot changes.

Code: 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}>261 && ${inventoryslot}<342) { 
      /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}-251]} 
      /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 Waiting 3seconds for server or untill I start to cast 
  /delay 1s ${Me.Casting.ID} 
   /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}) /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

Winterskulk
orc pawn
orc pawn
Posts: 15
Joined: Mon Apr 18, 2005 1:02 pm

Post by Winterskulk » Tue Feb 20, 2007 8:16 pm

i tested your mac and not wortk for me ;

DEDruid
orc pawn
orc pawn
Posts: 25
Joined: Thu Apr 14, 2005 12:55 am

Post by DEDruid » Sat Oct 06, 2007 3:34 am

Changed the 'item' variable to 'loot' to make this macro work with the 'item' variable changes. This works with the 2007/10/6 zip.

Code: Select all

Sub Main(p0,p1) 
   /call SwapCast "${p0}" "${p1}" 
/endmacro 

Sub SwapCast(loot,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[loot]}) /goto :end 
   /if (${Twist}) { 
      /twist stop 
      /varset leavetwisting 1 
   } 
   :stopsingingdelay 
   /if (${Me.Casting.ID}>0) { 
      /stopsong 
      /goto :stopsingingdelay 
      } 
   /varset inventoryslot ${FindItem[${loot}].InvSlot} 
   /if (!${inventoryslot}) /goto :notfound 
   :packcountloop 
   /if (${inventoryslot}>261 && ${inventoryslot}<342) { 
      /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}-251]} 
      /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 ${loot} not found in inventory. 
   :end 
   /if (${leavetwisting} == 1) /twist start 
/return 

Sub CastItem(slot) 
   /nomod /itemnotify ${slot} rightmouseup 
  /echo Waiting 3seconds for server or untill I start to cast 
  /delay 1s ${Me.Casting.ID} 
   /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}) /goto :castloop 
/return 

Sub WaitCursor(slot, pack) 
   /declare loot local 
   /declare timeout timer 30 
   /varset loot ${Cursor.ID} 
   /if (${Defined[pack]}) /goto :waitloop2 
   :waitloop1 
      /nomod /itemnotify ${slot} leftmouseup 
   /if ((${loot} == ${Cursor.ID}) && (${timeout} > 0)) /goto :waitloop1 
   /goto :donewaiting 
   :waitloop2 
      /nomod /itemnotify in ${pack} ${slot} leftmouseup 
   /if ((${loot} == ${Cursor.ID}) && (${timeout} > 0)) /goto :waitloop2 
   :donewaiting 
/return 

chikiko
orc pawn
orc pawn
Posts: 11
Joined: Thu Mar 04, 2004 1:38 pm
Contact:

great macro

Post by chikiko » Sat Nov 24, 2007 3:01 am

I just wanted to say that this is a great macro. I was hesitant to buy a new item recently cuz the one that i was wearing had a clicky i really liked and i didn't want to switch cuz i knew i was likely to be lazy or forgetful and not swap it out to cast. so this is a beautiful. The only thing it seems to lack the ability to do is make a swap a swap and cast on a 2h clicky item, like the lost staff of the scorned. nevertheless great macro!

Mangilagat
decaying skeleton
decaying skeleton
Posts: 5
Joined: Wed Jul 06, 2011 7:20 pm

Re: swapcast.mac a swap item and cast it macro (updated 7-2-5)

Post by Mangilagat » Wed Jul 06, 2011 7:23 pm

Anyone have an updated macro for this? It doesn't work atm -- doesn't swap items, just tries to cast them from inventory.

Gomer
a snow griffon
a snow griffon
Posts: 304
Joined: Fri Apr 15, 2005 2:38 pm

Re: swapcast.mac a swap item and cast it macro (updated 7-2-5)

Post by Gomer » Wed Jul 06, 2011 9:15 pm

Mangilagat wrote:Anyone have an updated macro for this? It doesn't work atm -- doesn't swap items, just tries to cast them from inventory.
I recommend you try "spell_routines.inc", it's current and works well for both spells and clickies. You'll probably want to also get bagwindow etc.
I a recent version is here: viewtopic.php?p=147975#p147975

Mangilagat
decaying skeleton
decaying skeleton
Posts: 5
Joined: Wed Jul 06, 2011 7:20 pm

Re: swapcast.mac a swap item and cast it macro (updated 7-2-5)

Post by Mangilagat » Thu Jul 07, 2011 8:19 am

I don't have access to VIP =(