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
fearless
Not a Psychic
Posts: 2684
Joined: Wed Mar 10, 2004 3:52 pm

Post by fearless » Mon May 23, 2005 9:23 am

There are already several plugins that can accomplish this, no need to create another.
Reading . . . it's not just for me.

[url=http://www.catb.org/~esr/faqs/smart-questions.html]How To Ask Questions The Smart Way[/url]
[quote="Ccomp5950"]Fearless showed me the light, you too shall learn.[/quote]

User avatar
OnyxSys
a ghoul
a ghoul
Posts: 133
Joined: Sun Dec 21, 2003 9:58 pm
Contact:

Post by OnyxSys » Mon May 23, 2005 9:06 pm

this is awesome..

with the VT orb for my shaman, i can now just call apon it.. and what i did was made alias for it:

Code: Select all

/alias /shrink /mac swap orb
bingo then i can just type:

Code: Select all

/shrink


this is very nice.. great job!
[img]http://web.infoave.net/~jpdixon/onyxsys.jpg[/img]

monster69
orc pawn
orc pawn
Posts: 20
Joined: Mon May 24, 2004 11:20 am

Post by monster69 » Sat Jul 02, 2005 10:58 am

change this line:

Code: Select all

      /if (${String[${equipslot}].Find[null]}) { 
to this:

Code: Select all

      /if (!${equipslot}) { 
To handle the change to the Strings TLO

Monster

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

Post by DEDruid » Sat Jul 02, 2005 4:00 pm

Monster69's change to the code works for items that are equippable, but MQ2 runs into an error if you try to use this on an item that must be clicked from inventory, such as an AoN for classes that cannot equip it.

monster69
orc pawn
orc pawn
Posts: 20
Joined: Mon May 24, 2004 11:20 am

Post by monster69 » Sat Jul 02, 2005 6:18 pm

Well, I don't have an AoN but my fisherman's companion and collapsable spit & toolbox all work just fine and they are inventory slot only.

I will see if I can dig up something that is equipable, that I can't equip that has a click effect to test with.

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

Post by DEDruid » Sat Jul 02, 2005 7:13 pm

Hmm, could you show me what the command lines in your hot key look like?

Mine says: /mac swapcast "amulet of necropotence" pack1

Also tried my fisherman's companion, and got the same error message.

The error message I am receiving is: "Failed to parse /if condition '(!pack1)', non-numeric encountered.

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

Post by DEDruid » Sat Jul 02, 2005 8:37 pm

Monster 69 wru?!!? I need to know how you are making this work, it's driving me nuts!

monster69
orc pawn
orc pawn
Posts: 20
Joined: Mon May 24, 2004 11:20 am

Post by monster69 » Sat Jul 02, 2005 8:37 pm

/macro swapcast fisherman's

/macro swapcast spit

/macro swapcast toolkit

I don't bother telling it which slot because it auto uses #1

Monster

bardomatic
a ghoul
a ghoul
Posts: 131
Joined: Thu Apr 29, 2004 12:09 am

Post by bardomatic » Sun Jul 03, 2005 12:45 am

1st post updated

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 7:30 pm

for us ancient folks that still use this one can someone point me in the right direction on fixing it?

for some reason it will take the item out put it in a slot then immediately put it back into a pack while trying to cast it.

any help =)

IM.

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

Post by JimJohnson » Sat Sep 23, 2006 7:47 pm

put a /delay 5s ${Me.Casting} after it swaps the item in.

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 8:31 pm

Thanks JJ. I was playing around with that to.

I did put in a delay as it starts to cast the item. more of a /delay 1s ${Me.Casting}

now that helps as it will cast the item. but then just leaves it in my slot with an item on the cursor.

I know this isnt really your macro or hell its over a year since anyones even posted on it.. but ive gotten so used to this thing. Its like a life saver =)

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

Post by JimJohnson » Sat Sep 23, 2006 8:50 pm

Post the version you have and sure we can look at it and get it fixed. The problem is you now have to wait for server to actually click an item.

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:03 pm

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 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
that was the newest one like a year ago. and after diff its still the same as on the first page.

I tried adding the line just after this

Code: Select all

:castloop
/delay 5s ${Me.Casting}
and that keeps it enough to cast. but doesnt put it back.

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

Post by JimJohnson » Sat Sep 23, 2006 9:19 pm

Give this a fast try and let me know if its working right.

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
[color=red]  /echo Waiting 3seconds for server or untill I start to cast
  /delay 3s ${Me.Casting.ID}[/color]
   /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
      }
      [color=red]/if (${Me.Casting.ID})[/color] /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
Last edited by JimJohnson on Sun Sep 24, 2006 3:32 pm, edited 1 time in total.