• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Autobones Requesting help to add MQ2Cast_Spell_Routines.inc supprt

Joined
May 21, 2014
RedCents
994¢
I'm trying to add MQ2Cast_Spell_Routines.inc support so it will not go dumb on gate collapse or fizzle. I've been trying different things for a couple of days and am getting nowhere. Any help would be greatly appreciated. Here is my code.



Rich (BB code):
| tradin.mac, by amml
| modified by tms
| full automation added by fuzzymelon
| Buy function courtesy of EqMule on RedGuides.com
| modified by Pepekeao for SOLO Wizard use! Made it to level 95 in days unattended!

#include MQ2Cast_Spell_Routines.inc

#Event Fizzle "Your spell fizzles#*#"
#Event Collapse "Your gate is too unstable, and collapses.#*#"


Sub Main

| *** Increase the destroydelay ONE by ONE until every item on your cursor gets destroyed.
	/declare destroydelay int local 1
	/declare chips int local
	/declare done int local 0
 
	:top
	/doevents
	/delay 5s
		/squelch /target clear
	/target "Gunlok Jure"
		/delay 2s
		/nav ${Math.Calc[${Target.X}-12]} ${Math.Calc[${Target.Y}+25]} ${Target.Z}
		/delay 5s
	/face fast
	
	/echo Opening Bags
	/keypress OPEN_INV_BAGS
		/delay 5
		
	/echo Handing in Chips.
	:Loop
	/if (!${FindItem[=Bone Chips].InvSlot}) {
	  /echo backpacks empty go get more stuff
	  /goto :EmptyBags
	}
	
	/if (!${FindItem[=Bone Chips].InvSlot}) /goto :EmptyBags
	
	
	/for chips 0 to 3
	/shift /itemnotify ${FindItem[=Bone Chips].InvSlot} leftmouseup
	/delay 5
	/click left target
	/click left target
		/delay 5
	/next chips
	
	/delay 8
	/notify GiveWnd GVW_Give_Button leftmouseup
	/delay 2s
	
	|/echo Clearing Cursor
	:cursorclear
	/if (${Cursor.ID} && ${Cursor.ID} != 13073) {
	    /destroy
	    /delay ${destroydelay}
	    /goto :cursorclear
	}
	
	/if (!${FindItem[=Bone Chips].InvSlot}) /goto :EmptyBags
	
	/goto :Loop
	
	:EmptyBags
	
	/if (!${done}) { 
	    /varset done 1
	    /goto :cursorclear
	}
	
	/echo Clearing up your bags, this will take a moment.
	
	/delay 8
	/while (${FindItem[=Rusty Axe].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Rusty Axe].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	/while (${FindItem[=Rusty Broad Sword].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Rusty Broad Sword].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	/while (${FindItem[=Rusty Mace].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Rusty Mace].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	/while (${FindItem[=Rusty Short Sword].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Rusty Short Sword].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	/while (${FindItem[=Rusty Two Handed Sword].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Rusty Two Handed Sword].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	/while (${FindItem[=Small Lantern].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Small Lantern].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	    
	/while (${FindItem[=Small Tattered Gloves].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Small Tattered Gloves].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	    
	/while (${FindItem[=Torch].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Torch].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	
	/while (${FindItem[=Small Patchwork Tunic].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Small Patchwork Tunic].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	
	/while (${FindItem[=Small Tattered Skullcap].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Small Tattered Skullcap].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	
	/while (${FindItem[=Small Patchwork Sleeves].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Small Patchwork Sleeves].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	
	/while (${FindItem[=Small Patchwork Pants].InvSlot}) {
	    /shift /itemnotify ${FindItem[=Small Patchwork Pants].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}
	
	:Done
	/delay 8 
	/notify GiveWnd GVW_Give_Button leftmouseup
	/delay 8
	/echo Closing Bags
	/keypress CLOSE_INV_BAGS
	/echo Done .. Have fun.. 
        /goto :port
	} else {
            /delay 2s
	    /goto :top
	}
	
	:port
		/doevents
	    /squelch /target clear
        /delay 5s
        /call MQ2Cast "Brell's Rest Gate" -maxtries|9
        /delay 45s
        /goto :buy    
	    
	:buy
	    /squelch /target clear
	    /target "Marie Fay"
	    /if (${Target.Type.Equal[npc]}) {
		    /delay 5s
	        /nav ${Math.Calc[${Target.X}+9]} ${Math.Calc[${Target.Y}+4]} ${Target.Z}
	        /delay 15s
                /face fast
                /delay 3s
                /call npc "Marie Fay"
				|/echo Opening Bags
		|/keypress OPEN_INV_BAGS
				|/delay 5				
	        /call Buy
			|/echo Closing Bags
		|/keypress CLOSE_INV_BAGS
			/goto :bind
	    } else {
                /delay 2s
	        /goto :buy
	    }
	
	:bind
		/doevents
	     /squelch /target clear
		 /if (${Merchant.Open}) {
         /notify MerchantWnd MW_Done_Button leftmouseup
         /delay 1s !${Merchant.Open}
		 /delay 5s
         /call MQ2Cast "Gate" -maxtries|9
	         /delay 25s
	         /goto :top
	    
/return	

Sub NPC(NPCName)
    /target npc ${NPCName}
    /delay 1s
    /if (!${Select[${Target.Type},npc,pet]} || !${Target.ID} || ${Target.Type.Equal[pet]} && !${Target.CleanName.Find[familiar]}) {
        /echo Please target a vendor or guildbanker
        /return
    }
    /echo Doing business with ${NPCName}
    /target id ${Spawn[${NPCName}].ID}
    /delay 3s ${Target.ID}==${Spawn[${NPCName}].ID}
    /if (${Target.Distance}>15) {
        /moveto id  ${Spawn[${NPCName}].ID}
        /delay 250 ${MoveTo.Stopped}
    }
    /face nolook
    /delay 1s
	/echo Opening Bags
	/keypress OPEN_INV_BAGS
		/delay 2s			
    /echo Opening merchant/guildbank window
    /nomodkey /click right target
    /echo Waiting 5s for merchant/guildbank window to populate
    /delay 5s
/return


Sub Buy	

        /notify MerchantWnd ItemList listselect ${Window[MerchantWnd].Child[ItemList].List[=Bone Chips,2]}
	/delay 2s
:goagain
	/if (${Me.FreeInventory}>4) {
		/Shiftkey /notify merchantwnd MW_Buy_Button leftmouseup
	:waitforit
		/if (${Window[MerchantWnd].Child[MW_Buy_Button].Enabled}==FALSE) {
			/echo button is false
			/delay 2
			/goto :waitforit
		}
		|/echo ${FindItemCount[${"Bone Chips"}]} ${"Bone Chips"} in inventory
        |    /varcalc QTY ${amount}-${FindItemCount[${Bone Chips}]}
		|	/delay 1
		/goto :goagain
	}
		/echo Closing Bags
	/keypress CLOSE_INV_BAGS
/return

Sub Event_recast_Gate
	/call MQ2Cast "Gate"
/return
	
Sub Event_recast_Brells_Rest_Gate
	/call MQ2Cast "Brell's Rest Gate"
/return
 
I'm posting from my phone so I'm trying to avoid reading the whole code. Is this part where it actually gates you out?

Rich (BB code):
/call MQ2Cast "Gate" -maxtries|9 /delay 25s /goto :top

If it is then put a new goto above gate and then above the /goto :top put an /if to make sure you're in the right zone and goto the new mark above gate if you're not.
 
Yes, that is the part to go back to Kaladim. I'll give it a try later (I'm at work now) and let you know what happens. The code as is works great, until a gate collapses or fizzles.
 
That works fine for fizzles, but does nothing for a gate collapse. It doesn't try to recast if the gate collpases.
 
/casting "Gate" -maxtries|5

this tries it until a success or 5 tries
 
I've never had it work for a gate collapse. When I get the collpase message it just sits there and it starts spamming can't find spawn Gunlok Jure.
 
You might have to create an event for this. What is the exact message when the Gate collapses?

OK I see you have the Event defined in the macro, but you don't have the related Sub. Add this code to the bottom of the macro.

Rich (BB code):
sub Event_Collapse
   /varset Gated 0
/return

and Mod the following code to include the highlighted lines.

Rich (BB code):
| *** Increase the destroydelay ONE by ONE until every item on your cursor gets destroyed.
	/declare destroydelay int local 1
	/declare chips int local
	/declare done int local 0
        /declare Gated int outer 1


Rich (BB code):
:bind
             /doevents
	     /squelch /target clear
	     /if (${Merchant.Open}) {
               /notify MerchantWnd MW_Done_Button leftmouseup
               /delay 1s !${Merchant.Open}
	       /delay 5s
               :CastAgain
               /call MQ2Cast "Gate" -maxtries|9
	         /delay 25s
                 /doevents Collapse
                 /if (!${Gated}) /goto :CastAgain
                 /varset Gated 1
	         /goto :top
	    
/return
 
Your gate is too unstable, and collapses.

- - - Updated - - -

I'll give that a try after the bigwigs leave the office, hehe. Would it be wise to do the same type of thing in the port sub? And I should be able to use the same sub for that also, correct?

- - - Updated - - -

By the way, in case no one noticed, I changed the buy routine to one EqMule posted in another thread. You don't have to set the number of bone chips to be bought. It finds out how many free inventory slots you have and buys till full, or to the limit of free slots you set.

- - - Updated - - -

Two and a half hours running with one bag and 9 open top level slots and not one collapse. Any other time it's at least once an hour. The complete cycle takes about 5 minutes, so it's getting plenty of opportunity to have problems. There is another character that has been PLing other toons for two weeks there. He must wonder whats going on with the fast runs, lol.

- - - Updated - - -

It only took thirteen hours, but it finally had a collapse, actually two in a row, but it worked perfectly. Thank you so much for your help.

- - - Updated - - -

I spoke too soon, it got stuck in a gate loop. I'm trying a zone check wit it instead of the Gated check.

Rich (BB code):
:CastAgain
/call MQ2Cast "Gate" maxtries|5
/delay 15s
/doevents Collapse
{/if (!${Zone.ShortName.Equal [KaladaimB]}) /goto :CastAgain
} else {
/goto :top
 
Last edited:
Try to /echo the shortname for the zone to make sure you're typing it in correctly. Since you're using an "/if !" you're exceptionally prone to errors that cause infinite loops.
 
Assuming that KaladaimB is the correct name.
Rich (BB code):
:CastAgain
/call MQ2Cast "Gate" maxtries|5
/delay 15s
|/doevents Collapse
/if (${Zone.ShortName.NotEqual[KaladaimB]}) {
   /goto :CastAgain
} else {
   /goto :top
}
 
That worked very well, it caught 6 different times the gate collapsed.

I'm trying to change the part to destroy all of the crap he gives back to you, would this sub do that? Trying my hardest to learn all of this stuff, lol.


Rich (BB code):
Sub DestroyItem(ItemtoDestroy)

/declare destroydelay int local 1

/declare ItemtoDestroy "Rusty Axe"|"Rusty Broad Sword"|"Rusty Mace"|"Rusty Short Sword"|"Rusty Two Handed Sword"|"Small Lantern"|"Small Tattered Gloves"|Torch|"Small Patchwork Tunic"|"Small Tattered Skullcap"|"Small Patchwork Sleeves"|"Small Patchwork Pants" local

	/while (${FindItem[=ItemtoDestroy].InvSlot}) {
	    /shift /itemnotify ${FindItem[=ItemtoDestroy].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}

/return
 
That might work if there is no lag. You need to put in checks that don't rely on timers like /delay 5. Don't get me wrong you will have to use /delays but don't depend on them.

I would make a few changes, First I would make sure the cursor is clear before starting the /while loop. So do something like this first.

Rich (BB code):
Sub DestroyItem(ItemtoDestroy)

/declare destroydelay int local 1

/declare ItemtoDestroy "Rusty Axe"|"Rusty Broad Sword"|"Rusty Mace"|"Rusty Short Sword"|"Rusty Two Handed Sword"|"Small Lantern"|"Small Tattered Gloves"|Torch|"Small Patchwork Tunic"|"Small Tattered Skullcap"|"Small Patchwork Sleeves"|"Small Patchwork Pants" local

:Loop1
/if (${Cursor.ID} && ${Cursor.ID} != 13073) {
   /destroy
} else {
    /if (${Cursor.ID} == 13073) {
       /autoinventory
    } else /if (!${Cursor.ID}) /goto :Loop2
}
/delay 5
/goto :Loop1
:Loop2
| If you get here then your Cusor is empty.

Next I would make the following changes

Rich (BB code):
	/while (${FindItem[=ItemtoDestroy].InvSlot}) {
	    /shift /itemnotify ${FindItem[=ItemtoDestroy].InvSlot} leftmouseup
	    /delay 5s ${Cursor.ID}
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /if (${Cursor.ID} && ${Cursor.ID} == 13073) /autoinventory
            
	    /delay ${destroydelay} !${Cursor.ID}
	}

I would also change this /declare destroydelay int local 1 to 3 and not 1. the /delays I use work as following;

/delay 5s(Delay for 5 seconds) or until this is True(${Cursor.ID}). So if only takes 1 second to clear the cursor then the /delay will only delay for 1 second.

Hope this is helpful.





That worked very well, it caught 6 different times the gate collapsed.

I'm trying to change the part to destroy all of the crap he gives back to you, would this sub do that? Trying my hardest to learn all of this stuff, lol.


Rich (BB code):
Sub DestroyItem(ItemtoDestroy)

/declare destroydelay int local 1

/declare ItemtoDestroy "Rusty Axe"|"Rusty Broad Sword"|"Rusty Mace"|"Rusty Short Sword"|"Rusty Two Handed Sword"|"Small Lantern"|"Small Tattered Gloves"|Torch|"Small Patchwork Tunic"|"Small Tattered Skullcap"|"Small Patchwork Sleeves"|"Small Patchwork Pants" local

	/while (${FindItem[=ItemtoDestroy].InvSlot}) {
	    /shift /itemnotify ${FindItem[=ItemtoDestroy].InvSlot} leftmouseup
	    /delay 5
	    /if (${Cursor.ID} && ${Cursor.ID} != 13073) /destroy
	    /delay ${destroydelay}
	}

/return
 
Autobones Requesting help to add MQ2Cast_Spell_Routines.inc supprt

Users who are viewing this thread

Back
Top
Cart