Page 1 of 1

Event Not Firing

Posted: Sun Jan 21, 2007 4:36 am
by Chill
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

Posted: Sun Jan 21, 2007 6:20 am
by nils
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

Posted: Sun Jan 21, 2007 8:06 am
by drzoon
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

Posted: Sun Jan 21, 2007 11:12 am
by Cooch
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

Posted: Mon Jan 22, 2007 7:03 pm
by Chill
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

Posted: Mon Jan 22, 2007 7:12 pm
by Chill
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?

Posted: Mon Jan 22, 2007 7:17 pm
by dont_know_at_all

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.#*#"

Posted: Mon Jan 22, 2007 8:26 pm
by Chill
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?

Posted: Mon Jan 22, 2007 9:35 pm
by dont_know_at_all
Simplify. Are you actually calling /doevents?

Posted: Tue Jan 23, 2007 9:54 am
by simkin
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.

Posted: Tue Jan 23, 2007 10:38 am
by Fuergrissa
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

Posted: Thu Jan 25, 2007 8:41 am
by premodeja
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 .

Posted: Tue May 29, 2007 4:41 am
by zoobish
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...

Posted: Tue May 29, 2007 5:24 am
by zoobish
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...

Posted: Tue May 29, 2007 11:23 am
by wakkedup
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