Moderator: MacroQuest Developers
topgun wrote:No one who have the time and will to do this one :) :)
I think it simple, but have no skills in this myself.
Code: Select all
|generic-cast.mac
#include gj-spellsub.inc
Sub Main
/declare Fail global
/declare DefaultSpellSet global
/declare DoAgain global
/declare StartCast global
/declare SpellSlot global
/declare SpellName global
/declare CastTime global
/declare CTimer timer
|------------ Edit These ----------------
/varset DefaultSpellSet "default"
/call SpellSub "Name of spell to cast"
/call SpellSub "Name of spell to cast"
/call SpellSub "Name of spell to cast"
/call SpellSub "Name of spell to cast"
|-----------------------------------------
/returnCode: Select all
|gj-spellsub.inc
#event Collapse "Your gate is too unstable, and collapses."
#event NoLOS "You cannot see your target."
#Event CastStart "You begin casting"
#Event CastFizzle "Your spell fizzles!"
#Event CastInterrupt "Your spell is interrupted."
#Event CastNoMana "Insufficient Mana to cast this spell"
#Event CastTooFar "Your target is out of range, get closer!"
#Event Recovered "You haven't recovered yet..."
#Event CastResist "Your target resisted "
#Event Distracted "You are too distracted to cast a spell now!"
#Event NoTarget "You must first select a target for this spell!"
#Event Sitting "You must be standing to cast a spell."
#Event NoMem "You do not seem to have that spell memorized."
#Event Stunned "You can't cast spells while stunned!"
Sub SetupSpellVars
/declare Fail global
/declare DefaultSpellSet global
/declare DoAgain global
/declare StartCast global
/declare SpellSlot global
/declare SpellName global
/declare CastTime global
/declare SitAfterCast global
/declare CTimer timer
/varset SitAfterCast 0
/varset DefaultSpellSet "default"
/return
|SpellSub
|Main spell casting sub.
|Used to handle all spell casting. Auto mems spells and handles fizzles.
|Will need to set the DefaultSpellSet var to your default spell set.
|
|Usage /call SpellSub "spellname"
|
Sub SpellSub
/if "@Param0"=="NA" /return
/varset Fail 0
/if n @SitAfterCast==1 /varset SitTimer 1140m
/varset SpellName "@Param0"
/if $char(state)==SIT {
/stand
}
/varset Remem 0
/if $char(ismoving)!=FALSE {
/sendkey up up
/sendkey up down
/delay 1s
}
:WaitForStop
/doevents
/if n $BreakOut==1 /return
/echo $char(ismoving)
/if $char(ismoving)!=FALSE {
/delay 1s
/goto :WaitForStop
}
/if $char(book,"@SpellName")=="NULL" /varset Fail 1
:MemWait
/doevents
/if n @Fail==1 {
/varset Fail 0
/if n @Remem==1 {
/memspellset @DefaultSpellSet
:loadsploop
/delay 5
/if $char(spellbook)=="TRUE" /goto :loadsploop
}
/if n @SitAfterCast==1 {
/if $char(state)==STAND /sit
}
/return 1
}
/varset SpellSlot $char(gem,"@SpellName")
/if n @SpellSlot<0 {
/delay 1s
/goto :MemWait
}
/if n @SpellSlot==0 {
/memspell 2 "@Param0"
/varset SpellSlot 2
/varset Remem 1
:refreshwait
/doevents
/if n @Fail==1 {
/varset Fail 0
/if n @Remem==1 {
/memspellset @DefaultSpellSet
:loadsploop
/delay 5
/if $char(spellbook)=="TRUE" /goto :loadsploop
}
/if n @SitAfterCast==1 {
/if $char(state)==STAND /sit
}
/return 1
}
/delay 5
/if n $char(gem,"@SpellName")<=0 /goto :refreshwait
}
/varset CastTime "$spell("@SpellName",casttime)"
/varadd CastTime 1
:BeginCast
/varset Fail 0
/varset DoAgain 0
/varset StartCast 0
/call WaitForStart
:TimerLoop
/doevents
/if n @DoAgain==1 /goto :BeginCast
/if n @Fail==1 {
/varset Fail 0
/if n @Remem==1 {
/memspellset @DefaultSpellSet
:loadsploop
/delay 5
/if $char(spellbook)=="TRUE" /goto :loadsploop
}
/if n @SitAfterCast==1 {
/if $char(state)==STAND /sit
}
/return 1
}
/if n @CTimer>0 /goto :TimerLoop
/delay 2
/doevents
/if n @DoAgain==1 /goto :BeginCast
/if n @Remem==1 {
/memspellset default
:loadsploop
/delay 5
/if $char(spellbook)=="TRUE" /goto :loadsploop
}
/return 0
|WaitForStart
|Used by SpellSub to determine when to start spell countdown.
Sub WaitForStart
/cast @SpellSlot
:StartLoop
/doevents
/if n @Fail==1 /return
/if n @DoAgain==1 /return
/if n @StartCast==0 {
/goto :StartLoop
}
/varset CTimer "@CastTime"s
/return
Sub Event_CastStart
/varset StartCast 1
/return
Sub Event_CastFizzle
/delay 2
/varset DoAgain 1
/return
Sub Event_CastInterrupt
/delay 2
/if n @Fail==1 /return
/varset DoAgain 1
/return
Sub Event_Sitting
/stand
/delay 2
/varset DoAgain 1
/return
Sub Event_CastTooFar
/varset Fail 1
/varset CTimer 0
/return
Sub Event_Distracted
/varset Fail 1
/varset CTimer 0
/return
Sub Event_NoTarget
/varset Fail 1
/varset CTimer 0
/return
Sub Event_NoMem
/varset Fail 1
/varset CTimer 0
/return
Sub Event_CastNoMana
/varset DoAgain 1
/sit off
/sit on
:medingwait
/delay 0
/doevents
/if n $char(mana,pct)<40 /goto :medingwait
/sit off
/return
Sub Event_Stunned
/delay 3s
/varset DoAgain 1
/return
Sub Event_Recovered
/delay 2s
/varset DoAgain 1
/return
Sub Event_CastResist
/varset Fail 1
/return
Sub Event_Collapse
/varset DoAgain 1
/return
Sub Event_NoLOS
/varset Fail 1
/varset CTimer 0
/returnI had that in the original post. He wants all the pieces to end up on the cursor. I would imagine to hand all at once.blueninja wrote:You probably want to /autoinv (drops what's on your target in your bags)between every cast too.
Ending macro: Bad variable in /var function
gi-spellsub.inc@41 (Spellsub): /varset Fail 0
gi-spellsub.mac@13 (Main): /call SpellSub "Girdle of Magi'Kot"
Cleared the following: Timers Vars Arrays
The Current Macro has ended

Code: Select all
/declare Fail global
You shouldn't. You may get an error but it won't be the same.topgun wrote:Tried your sugestion NotSoCSharp, bur still gets the same error
Sure, but I don't seem to recall any of this as part of the request. I am guessing the person who requested this either sells sets of pet armor on request or hands them out to players who have pets on raids.Lord Yei wrote:I think it would require a little more code and plenty of cursor positions to make this really useable by mages....
cast 8 items (limit for cursor stack I believe)
Target Pet
/face
drop 4 on pet then OK
drop 4 on pet then OK
Also for armor you would need this
cast armor bag
drop in predefined slot (would need to be same one everytime for cursor positions)
open bag
target pet
/face
pick up 4 armor pcs, drop on pet, and OK
pick up 4 armor pcs, drop on pet, and OK
I am currently working on mage mac, but I am only in the middle and not ready to release code.