Code: Select all
/call MemorizeSpell "Gate" 1
/stand- ForgetSpellByName - should be fairly obvious, provide it with the name of a spell and it will forget it. EG: /call ForgetSpellByName "Gate"
- ForgetSpellByNumber - again, fairly obvious. Provide it with the # of the spell gem you want it to forget. EG: /call ForgetSpellByNumber 3
- MemorizeSpell - Memorizes any of your spells. Doesn't even bother if a) you already have it memorized or b) you don't have it. Takes two arguments; the name of the spell to memorize and the slot to put it in. EG: /call MemorizeSpell "Minor Healing" 4
- MousetoSpellGem - moves the mouse to the appropriate spell gem (used internally)
- MousetoSpellSlot - moves the mouse to the appropriate spell slot (used internally)
spellbook.mac
Code: Select all
|** - spellbook.mac -
**
** This macro is an include for other macros. It deals with memorizing
** and forgetting spells.
**|
| This function forgets a memorized spell by its spell name
sub ForgetSpellByName
/if "$char(gem,"$p0")"=="NULL" /goto :EndForgetSpellByName
/call ForgetSpellByNumber $char(gem,"$p0")
:EndForgetSpellByName
/return
| This function forgets a memorized spell by gem #
sub ForgetSpellByNumber
/echo FSBN called with p0 $p0
/varset l0 $mouse(x)
/varset l1 $mouse(y)
/call MousetoSpellGem $p0
| /delay 2
/click right
:WaitForGemFreeInForgetSpellByNumber
/doevents
/if "$char(gem,$p0)"!="NULL" /goto :WaitForGemFreeInForgetSpellByNumber
/mouseto $l0 $l1
/return
| This function takes two arguments; the name of the spell to memorize and the
| spell gem to put it in
sub MemorizeSpell
| Make sure we don't already have the spell memorized!
/if "$char(gem,"$p0")"!="NULL" /return
| Make sure we have the spell!
/if "$char(book,"$p0")"=="NULL" /return
/varset l0 $mouse(x)
/varset l1 $mouse(y)
| Spell book # is $l9. Spell book page is $l8. Spell slot is $l7.
| Page layout is $l6
/varset l9 $int($char(book,"$p0")-1)
/varset l8 $int($l9\5+1)
/varset l7 $int($l9%5)
/varset l6 $l8
:GetPageLayout
/if n $l6>6 /varsub l6 6
/if n $l6>6 /goto :GetPageLayout
/book $l8
| In case we need to open our spell book...
/delay 3
/if n $l6==1 /call MousetoSpellSlot 1 $int($l8%2) $l7
/if n $l6==2 /call MousetoSpellSlot 2 $int($l8%2) $l7
/if n $l6==3 /call MousetoSpellSlot 3 $int($l8%2) $l7
/if n $l6==4 /call MousetoSpellSlot 3 $int($l8%2) $l7
/if n $l6==5 /call MousetoSpellSlot 3 $int($l8%2) $l7
/if n $l6==6 /call MousetoSpellSlot 4 $int($l8%2) $l7
/delay 1
/click left
/delay 2
/call MousetoSpellGem $p1
/call ForgetSpellByNumber $p1
/click left
| Wait for the spell to finish memorizing
:WaitToFinishMemorizingSpell
/doevents
/if "$char(gem,$p1)"=="NULL" /goto :WaitToFinishMemorizingSpell
/mouseto $l0 $l1
/return
| Moves your mouse to the appropriate spellgem
sub MousetoSpellGem
/varcalc l0 $int($p0-1)*38+27
/mouseto 104 $l0
/return
| Moves your mouse to the appropriate spell slot for the given layout
| $p0: layout $p1: even/odd (0/1) $p2: spell slot
sub MousetoSpellSlot
/if n $p0==1 /goto :Layout1InMousetoSpellslot
/if n $p0==2 /goto :Layout2InMousetoSpellslot
/if n $p0==3 /goto :Layout3InMousetoSpellslot
/if n $p0==4 /goto :Layout4InMousetoSpellslot
:Layout1InMousetoSpellslot
/if n $p2==0 /mouseto 202 66
/if n $p2==1 /mouseto 280 60
/if n $p2==2 /mouseto 280 128
/if n $p2==3 /mouseto 202 184
/if n $p2==4 /mouseto 280 195
/goto :CheckRightPageInMousetoSpellslot
:Layout2InMousetoSpellslot
/if n $p2==0 /mouseto 200 59
/if n $p2==1 /mouseto 276 88
/if n $p2==2 /mouseto 200 127
/if n $p2==3 /mouseto 276 161
/if n $p2==4 /mouseto 200 194
/goto :CheckRightPageInMousetoSpellslot
:Layout3InMousetoSpellslot
/if n $p2==0 /mouseto 191 63
/if n $p2==1 /mouseto 284 63
/if n $p2==2 /mouseto 238 136
/if n $p2==3 /mouseto 191 189
/if n $p2==4 /mouseto 284 189
/goto :CheckRightPageInMousetoSpellslot
:Layout4InMousetoSpellslot
/if n $p2==0 /mouseto 242 61
/if n $p2==1 /mouseto 193 124
/if n $p2==2 /mouseto 281 124
/if n $p2==3 /mouseto 202 193
/if n $p2==4 /mouseto 267 193
/goto :CheckRightPageInMousetoSpellslot
:CheckRightPageInMousetoSpellslot
/if n $p1==0 /mouseto + 161 +0
/return


