Event Not Firing

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Event Not Firing

Post by Chill » Sun Jan 21, 2007 4:36 am

I have created a simple little macro to chain cast an enchant or imbue spell to summon pretty much whatever. The problem is that it keeps going long after I've run out of reagents.

I've tried to create several event triggers to get the macro to end, but none of them seem to fire. Can anyone help me get this working?

Code: Select all

|Simple imbue macro

#event alldone "You are missing some required components."
#event alldone "You are missing#*#"
#event alldone "Your spell is interrupted."

#Include SpellCast.inc

Sub Main
   /declare i int outer 0
   /declare SpellName string outer Mass Enchant Gold

   /if (${Defined[Param0]}) {
      /varset SpellName ${Param0}
   } else {
      /for i 9 downto 1
         /if (${Me.Gem[${i}].Name.Find[Mass]} || ${Me.Gem[${i}].Name.Find[Enchant]} || ${Me.Gem[${i}].Name.Find[Imbue]} || ${Me.Gem[${i}].Name.Find[Mana]}) /varset SpellName ${Me.Gem[${i}].Name}
      /next i
   }

   /echo Chain casting ${SpellName}

   :Loop
   /if (${Cursor.ID}) {
      /autoinventory
      /goto :Loop
   } else {
      /if (${Me.SpellReady[${SpellName}]}) /call cast ${SpellName}
      /delay 2s
      /if (${Me.CurrentMana}<${Spell[${SpellName}].Mana}) {
         /if (!${Me.Mount.ID} && !${Me.Sitting}) /sit
         /autoinventory
         /delay 10m ${Me.PctMana}>90
      }
      /doevents
      /goto :Loop
   }
/return

Sub Event_alldone
   /echo out of supplies..
   /if (${Me.Mount.ID}) /dismount
   /if (!${Me.Sitting}) /sit
   /beep
   /endmacro
/return
Thanks

P.S. I added an Event section to the wiki at: http://www.macroquest2.com/wiki/index.p ... est2:Using

nils
a grimling bloodguard
a grimling bloodguard
Posts: 565
Joined: Wed Jul 30, 2003 10:02 pm

Post by nils » Sun Jan 21, 2007 6:20 am

There is probably a better way but you could do a check for the regents and if none call your sub. You might need to use count since you need 5 regents per cast, not sure my second example works

Code: Select all

/if (!${FindItem[<RegentName>].ID}) /call Event_alldone

Code: Select all

/if (${FindItem[<RegentName>].Count<5}) /call Event_alldone

drzoon
a hill giant
a hill giant
Posts: 239
Joined: Tue May 04, 2004 5:38 pm

Post by drzoon » Sun Jan 21, 2007 8:06 am

Try this at the top of the macro:

Code: Select all

/declare SpellComponent string outer Gold Bar
And then this at the top of your :Loop.

Code: Select all

/if (${FindItemCount[=${SpellComponent}]}<5) /call Event_alldone

Cooch
orc pawn
orc pawn
Posts: 24
Joined: Thu Jan 19, 2006 10:41 pm

Post by Cooch » Sun Jan 21, 2007 11:12 am

Here is what I use to macro Imbued Emeralds.

Code: Select all

#Event Done "Sorry, but you don't have everything you need for this recipe in your general inventory."
#Event NoMana "Insufficient Mana to cast this spell!"
#Event Done "You are missing some required components."

Sub Main
   :Loop

      :ClearCursor
      /if (${Cursor.ID}) {
         /autoinventory
         /goto :ClearCursor
      }

        /cast "Mass Imbue Emerald"
	/doevents
        /delay 15s
        /goto :Loop
/return

Sub Event_NoMana
	/sit
	/delay 30s
/return

Sub Event_Done
	/endmacro
/return

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Mon Jan 22, 2007 7:03 pm

I wrote this as a general chain cast macro. I think I wrote it when I needed gold bars, but Ive since used it for all kinds of enchant and imbue spells, so I dont want to check for any specific component.

I will try coppying and pasting Cooch's events and see if those fire.

Thanks

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Mon Jan 22, 2007 7:12 pm

Still not firing :-(

I edited the code slightly but its pretty much the same syntaxt as what I had:

Code: Select all

|Simple imbue macro

#Event Done "Sorry, but you don't have everything you need for this recipe in your general inventory." 
#Event Done "You are missing some required components." 

#Include SpellCast.inc

Sub Main
   /declare i int outer 0
   /declare SpellName string outer Mass Enchant Gold

   /if (${Defined[Param0]}) {
      /varset SpellName ${Param0}
   } else {
      /for i 9 downto 1
         /if (${Me.Gem[${i}].Name.Find[Mass]} || ${Me.Gem[${i}].Name.Find[Enchant]} || ${Me.Gem[${i}].Name.Find[Imbue]} || ${Me.Gem[${i}].Name.Find[Mana]}) /varset SpellName ${Me.Gem[${i}].Name}
      /next i
   }

   /echo Chain casting ${SpellName}

   :Loop
   /if (${Cursor.ID}) {
      /autoinventory
      /goto :Loop
   } else {
      /if (${Me.SpellReady[${SpellName}]}) /call cast ${SpellName}
      /delay 2s
      /if (${Me.CurrentMana}<${Spell[${SpellName}].Mana}) {
         /if (!${Me.Mount.ID} && !${Me.Sitting}) /sit
         /autoinventory
         /delay 10m ${Me.PctMana}>90
      }
      /doevents 
      /goto :Loop
   }
/return

Sub Event_Done 
   /endmacro 
/return
For the life of me I cant figure out why the event isnt firing. On my screen I see in red:
You are missing some required components.
You are missing Poision Vial.


but for some reason this isnt trigering the Done event to end the macro. Any other suggestions?

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Mon Jan 22, 2007 7:17 pm

Code: Select all

#Event Done "#*#Sorry, but you don't have everything you need for this recipe in your general inventory.#*#"
#Event Done "#*#You are missing some required components.#*#"

Chill
Contributing Member
Contributing Member
Posts: 435
Joined: Fri May 07, 2004 5:06 pm
Location: Erie, PA

Post by Chill » Mon Jan 22, 2007 8:26 pm

Just tried DKAA's events, still not firing for me.

Only other thing I can think of..it shows up in red text, do I need to tell the Events what kind of text to monitor or does it check everything by default?

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Mon Jan 22, 2007 9:35 pm

Simplify. Are you actually calling /doevents?

simkin
a snow griffon
a snow griffon
Posts: 303
Joined: Thu Sep 01, 2005 1:52 pm

Post by simkin » Tue Jan 23, 2007 9:54 am

Put an /echo command just before the doevents call. See how many times it goes off. Or put the doevents somewhere else.

I have a very similar macro and the same Event triggers and don't have any problems with it stopping.

User avatar
Fuergrissa
a grimling bloodguard
a grimling bloodguard
Posts: 607
Joined: Mon Dec 08, 2003 3:46 pm
Location: UK

Post by Fuergrissa » Tue Jan 23, 2007 10:38 am

Chill wrote:Still not firing :-(

Code: Select all

   :Loop
   [color=red]/doevents[/color]
/if (${Cursor.ID}) {

Sub Event_Done 
   /endmacro 
/return
Put a /doevents at the start of your :Loop
[quote]"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning."[/quote]

premodeja
a lesser mummy
a lesser mummy
Posts: 51
Joined: Wed Aug 04, 2004 12:11 pm

Post by premodeja » Thu Jan 25, 2007 8:41 am

Try to simplify some.

Code: Select all

#Event nocomp "#*#You are missing#*#"
#Event FullInventory "#*#There was no place to put that#*#"

Code: Select all

Sub Event_nocomp
      /echo "You have run out of Componants. ((Ending Macro)) "
      /popup You have run out of Componants. ((Ending Macro))   
      /if (${Cursor.ID}) /autoinv
      /end

Sub Event_FullInventory
      /echo "Your inventory is full, ((( Ending Macro ))) "
      /popup Your inventory is full, ((( Ending Macro )))
      /end
That is from the auto ts mac I have used for so long. It never fails. Not that you should need to, but you could always make an event in mq2targets to monitor and /endmacro .
[quote][b]dont_know_at_all wrote:[/b]
I, for one, welcome our new bot overlords.[/quote]

zoobish
a lesser mummy
a lesser mummy
Posts: 40
Joined: Tue Apr 18, 2006 6:59 am

Post by zoobish » Tue May 29, 2007 4:41 am

I have this occurring in my bazzar tribute macro, if the item is no longer for sale, MQ2 is not picking up the message...

I might fiddle with that...

zoobish
a lesser mummy
a lesser mummy
Posts: 40
Joined: Tue Apr 18, 2006 6:59 am

Post by zoobish » Tue May 29, 2007 5:24 am

Your problem is not the same as mine.

Your code never fires. In the event you have no product to imbue, EQ produces "Your spell is interrupted." as one of the messages.

This is picked up by SpellCast.inc, and it tries to cast again. Your code never gets entered into again.

SpellCast.inc would be dangerous to use in some instances I suspect, as in your case...

May have to code your own spell cast routine...

wakkedup
a ghoul
a ghoul
Posts: 114
Joined: Tue Apr 11, 2006 5:25 am

Post by wakkedup » Tue May 29, 2007 11:23 am

As you're only casting one spell, why do you need SpellCast.inc? Even if the spell is different every time, you really only need to "/cast" the spell. If it fizzles or is interrupted, big deal, it will fire the next time through the macro. Something like

Code: Select all

/cast "Spell Name"
/delay 1s ${Me.Casting.ID}
/delay 6s !${Me.Casting.ID}
not certain if those delays would be perfect, but tweak them up a bit.

Another suggestion would be to add more /doevents throughout your macro.

Also, I'd add some /echo's as much as I could to make sure what I think is happening, *is* actually happening.

My last suggestion would be to use mq2cast plugin for your casting, although since question is in normal forums, not certain you have access to that as I believe its in VIP.

Cheers
Nothing to see here. Move along.