Page 1 of 2

Summon Arrows with Ancille's Pouch.

Posted: Sun May 14, 2006 2:14 pm
by Canadian_Cowgirl
My first macro - so be gentle. ;)

I found a few for Tolan's, but didn't find anything blatantly obvious for the Ancille's pouch.

Code: Select all

|summon_arrows.mac by Canadian Cowgirl - Upgraded by Fearless with suggestions from
|A_Druid_00
|
|This uses a Bloody Ancille's Pouch. You need to have already purchased the
|Purified Crystals and have them anywhere in your inventory. Stick the pouch
|on any main inventory slot. (So it can be clicked)
|
|Yes - I'm exactly this lazy. ^_^

|commented for commenty goodness.

|Use spell_routines.inc to handle the casting, this will require
|MQ2Exchange to handle item swaps if the item you want cast
|is not readily available.  If you have MQ2Exchange loaded
|you can have the pouch anywhere in inventory and it will
|swap it to pack8 to cast.
#include spell_routines.inc

Sub Main

:loop
|If I have something on cursor, drop it in inventory.
/if (${Cursor.ID}) /autoinventory

|delay for 1 second or until cursor is clear
/delay 1s !${Cursor.ID}

|if I have a BAP, I have some room in my inventory, and I
|have some crystals, cast the BAP to make some arrows
/if ( ${FindItem[Bloody Ancille's Pouch].ID} && ${Me.FreeInventory} && ${FindItem[Purified Crystal].ID} ) {
  /call cast "Bloody Ancille's Pouch" item
}

|Loop away
/goto :loop
/end
-C_CG.

Posted: Mon May 15, 2006 9:02 am
by A_Druid_00
Nice start, now you can toy with things like finding it in a bag and swapping it into a general inventory slot for the casting :D

Might want to add a check for Me.Casting.ID to the inventory check as well, so you aren't trying to cast it while another spell is in the process of checking.

Posted: Mon May 15, 2006 9:40 pm
by Canadian_Cowgirl
I actually had it stopping when it ran out of components or inventory room, but I broke that and haven't managed to fix it again yet. :)

Spellcasting I can only see if you were gonna run it as part of another macro since this just spams summon arrows back to back and wouldn't give you a chance to cast.

-CCG.

Posted: Tue May 16, 2006 8:03 am
by A_Druid_00
Without it there's the chance that the /delay 3s might run a little too fast and it loops through again while the cast is still going. Timers aren't 100% accurate, since the server's clock is obviously not the same as your PC's. An even better way to do it is probably with a conditional delay like this:

Code: Select all

         /cast item "Bloody Ancille's Pouch" 
         /delay 3s ${Me.Casting.ID}
         /delay 10s !{Me.Casting.ID}
By doing that, you're pretty much guaranteed to not leave that /if until the cast is complete.

Edit: I see you were also using #events to pick up on no room and no components. You can actually use MQ2Data to determine these things without relying on #events. Me.FreeInventory will return the number of free inventory slots IIRC, and FindItem[Purified Crystal].ID should tell you if you have any crystals.

Posted: Wed May 17, 2006 4:57 pm
by Canadian_Cowgirl
{{eyes glaze over}}

I.. uh.. think I'm gonna go RTFM now.. ;)

-CCG.

Posted: Wed May 17, 2006 5:43 pm
by fearless
his suggestions were to convert it to something like this:

Code: Select all

|summon_arrows.mac by Canadian Cowgirl
|
|This uses a Bloody Ancille's Pouch. You need to have already purchased the
|Purified Crystals and have them anywhere in your inventory. Stick the pouch
|on any main inventory slot. (So it can be clicked)
|
|Yes - I'm exactly this lazy. ^_^

|commented for commenty goodness.

|Use spell_routines.inc to handle the casting, this will require 
|MQ2Exchange to handle item swaps if the item you want cast 
|is not readily available.  If you have MQ2Exchange loaded
|you can have the pouch anywhere in inventory and it will 
|swap it to pack8 to cast.
#include spell_routines.inc

Sub Main

:loop
|If I have something on cursor, drop it in inventory.
/if (${Cursor.ID}) /autoinventory

|delay for 1 second or until cursor is clear
/delay 1s !${Cursor.ID}

|if I have a BAP, I have some room in my inventory, and I 
|have some crystals, cast the BAP to make some arrows
/if ( ${FindItem[Bloody Ancille's Pouch].ID} && ${Me.FreeInventory} && ${FindItem[Purified Crystal].ID} ) {
  /call cast "Bloody Ancille's Pouch" item
}

|Loop away
/goto :loop
/end

Posted: Thu May 18, 2006 4:47 pm
by Canadian_Cowgirl
Thank you for the suggestions and help - I'm very much a beginner and learning slowly :) It would probably help if I'd programmed something in the last 15 years.. the last thing I did was for a Commodore 64.

Out of curiosity (and need to learn!) why the /end after the /goto :loop? If its going to :loop, won't it never see the /end?

-C_CG

Posted: Thu May 18, 2006 5:37 pm
by fearless
habit more then anything else

Posted: Tue Sep 19, 2006 11:39 am
by Snowbanx
I bet this can be expanded. Make a plugin the will look thru your bags, check what slots it can go in (in case it's a shield only that can only be clicked when equiped), or click potions.... Or is there one already?

Posted: Wed Sep 20, 2006 4:19 am
by Hivolt
Would it work if

Code: Select all

/delay 1s !${Cursor.ID}
was changed to

Code: Select all

/delay !${Cursor.ID}
To make it wait till cursor is clear without a time element in there?

Posted: Wed Sep 20, 2006 9:24 am
by fearless
if you are worried about the delay expiring before the condition is met, use something like /delay 2342987298347928374928743s !${Cursor.ID} so that the macro still has a chance of moving on and possibly recovering instead of just waiting for some miracle to happen that clears the cursor.

Posted: Wed Sep 20, 2006 10:46 am
by Hivolt

Code: Select all

:loop
|If I have something on cursor, drop it in inventory.
/if (${Cursor.ID}) /autoinventory

|delay for 1 second or until cursor is clear
/delay !${Cursor.ID} 
To me it looks like the /autoinventory would clear the cursor, if the cursor was already clear it would just move on if writen this way.

no?

But could be one of those things that is not good to get in the habit of doing as it could hang you up in some cases. Prolly considered sloppy writing not to have some delay in there to fall back on. I'm still pretty new at these, thanks for any info :)

Posted: Wed Sep 20, 2006 11:00 am
by fearless
And what if there is more then one thing on the cursor? /autoinv only moves one item off cursor. Having /delay !${Cursor.ID} is just simply a bad idea, there are too many scenario's where the macro would be frozen at that point.

Posted: Wed Sep 20, 2006 11:41 am
by JimJohnson
wouldnt this get stuck for a long ass time also if more then one item on cursor?

Code: Select all

/delay 2342987298347928374928743s !${Cursor.ID}

Id use something like you had but put in another /if

Code: Select all

:loop
|If I have something on cursor, drop it in inventory.
/if (${Cursor.ID}) /autoinventory

|delay for 1 second or until cursor is clear
/delay 3s !${Cursor.ID}
/if (${Cursor.ID}) /goto :loop

Posted: Wed Sep 20, 2006 1:46 pm
by fearless
My point wasn't that it wouldn't be a long ass delay, simply that eventually WILL pass the delay line. With hivolt's option, there simply is no way for the macro to continue if there is still something on cursor.

Once past the delay, you could easily do whatever you wanted to check if you still had something on cursor.