spellbook.mac - provides spell memorization / forgetting

Macro depository for macros written before the user variable changes that broke all of them.

Moderator: MacroQuest Developers

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

spellbook.mac - provides spell memorization / forgetting

Post by DeathSpiral » Tue Oct 01, 2002 2:36 am

The following mac was designed to be #include'd by other macros. Quite simply, it can memorize and forget any spell that you have. When memorizing / forgetting a spell, the functions won't return until memorization is complete. IE, you can do the following:

Code: Select all

/call MemorizeSpell "Gate" 1
/stand
and you don't have to worry about standing interrupting your spell memorizing. If there is a spell already in the gem, it forgets it for you. Obviously enough, this is old-ui only. The following functions are provided:
  • 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)
With that being said, here we go!
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
I am orc pawn, hear me yell for centurians...

Genoius
a lesser mummy
a lesser mummy
Posts: 49
Joined: Sat Jul 13, 2002 8:20 am

Post by Genoius » Tue Oct 01, 2002 2:53 am

this works? would rawk if it does! what version of MQ? the latest IRC version i am guessing, cuz this is the first I have heard of it

---Genoius---

User avatar
DeathSpiral
a ghoul
a ghoul
Posts: 95
Joined: Thu Aug 22, 2002 6:31 pm

Post by DeathSpiral » Tue Oct 01, 2002 3:02 am

Genoius wrote:this works? would rawk if it does! what version of MQ? the latest IRC version i am guessing, cuz this is the first I have heard of it
Yes, this works. I believe $char(book,xxx) and $char(gem,xxx) were introduced in the 20020905 release. However, I'm getting the impression that there either wasn't a big announcement of the feature or many people missed it. :)
I am orc pawn, hear me yell for centurians...

gingertips
a hill giant
a hill giant
Posts: 230
Joined: Wed Jun 26, 2002 3:47 am
Location: Tseu-Qorcam

Post by gingertips » Tue Oct 01, 2002 3:21 am

aye they were announced, but its great to see someone has done this - will prove very useful - thanks!

User avatar
rizwank
Huggle Police
Huggle Police
Posts: 524
Joined: Tue Jul 23, 2002 12:07 am
Contact:

Post by rizwank » Tue Oct 01, 2002 3:28 am

I need testers and peoples opinions.

will be included on the next CVS if it works fine.
#macroquest op
Macroquest Official Documentarion
Macroquest Board Moderator
All around cool guy

[img]http://medicomuerte.users.btopenworld.com/images/fairy_bounce08.gif[/img]

Gengis
a ghoul
a ghoul
Posts: 116
Joined: Wed Aug 14, 2002 7:46 pm

Post by Gengis » Tue Oct 01, 2002 4:44 am

Great for running after a death :!:

macrotoon
a ghoul
a ghoul
Posts: 106
Joined: Wed Sep 18, 2002 4:38 pm

Post by macrotoon » Tue Oct 01, 2002 8:01 am

This could prove very useful if used with another macro like memspelltype.mac

Something of the sorts

/macro memspelltype guildraid

or

/macro memspelltype undeadhunt

Or a number of things.

Have another macro to include this one.

I see lots of potential here!

Great work DeathSpiral!

If i get around to a macro to include with this I'll post it.

User avatar
Nuad
a ghoul
a ghoul
Posts: 93
Joined: Thu Jun 27, 2002 11:43 am
Location: Berlin, Germany

Post by Nuad » Tue Oct 01, 2002 9:10 am

OH NOOoooo... now i have to improve my Druid.mac even more with some all purpose spell memming commands... :D

User avatar
rizwank
Huggle Police
Huggle Police
Posts: 524
Joined: Tue Jul 23, 2002 12:07 am
Contact:

Post by rizwank » Tue Oct 01, 2002 1:04 pm

macrotoon, that would be very much apprecaited, if you would make that macro

remember to /delay between loadings.
#macroquest op
Macroquest Official Documentarion
Macroquest Board Moderator
All around cool guy

[img]http://medicomuerte.users.btopenworld.com/images/fairy_bounce08.gif[/img]

eq_freak
a ghoul
a ghoul
Posts: 105
Joined: Mon Jun 24, 2002 7:17 am

Post by eq_freak » Tue Oct 01, 2002 5:24 pm

Awesome :)

Will have to include this in my bot as soon as I have time to fiddle with it.

User avatar
ap50
a snow griffon
a snow griffon
Posts: 425
Joined: Sun Aug 18, 2002 2:29 pm

ijustdied.mac

Post by ap50 » Wed Oct 02, 2002 8:18 am

[color=yellow][size=92][b]Just because you're paranoid, it doesn't mean everyone isn't out to get you![/b][/size][/color]

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

WTF

Post by Mutter » Sun Dec 15, 2002 12:12 pm

AGain, cant get this to work i use the following code:

/press m
/delay 8
/call MemorizeSpell "Suffocating Sphere" 1
/call MemorizeSpell "Minor Shielding" 2
/call MemorizeSpell "Juli's Animation" 3
/stand

Tried without the /press M

I am baffeled.

eqaddict
a lesser mummy
a lesser mummy
Posts: 74
Joined: Sun Sep 15, 2002 10:05 pm

Baffled

Post by eqaddict » Tue Dec 17, 2002 4:44 pm

This does not work for me either and I am at working looking it over. On a first pass it seems that

Code: Select all

   /if "$char(gem,"$p0")"!="NULL" /return 
is incorrect as $char(gem,XXX) returns a number and not a string..

maybe this would fix the problem

Code: Select all

   /if n $char(gem,"$p0")!=0 /return 
will try later tonite.

CONFIRMED... replace the above line in memorizespell with the one I provided to fix the problem

-eqA

User avatar
SingleServing
a hill giant
a hill giant
Posts: 195
Joined: Tue Dec 17, 2002 11:00 pm

Bug

Post by SingleServing » Wed Dec 18, 2002 8:35 pm

If you cast a spell that takes 2 seconds to cast and 7 seconds to refresh after you cast the spell the macro will be paused for 7 seconds allowing the spell to refresh and not cast another spell when in reality it should only pause if the same spell were instructed to be cast again. Also, if a spell is instructed to /call cast "spell" and has not refrshed yet the function will skip the spell instead of waiting until it refreshes then attempts a recast just like the fizzle event does.

I hope this makes sense, I am very tired.

eqaddict
a lesser mummy
a lesser mummy
Posts: 74
Joined: Sun Sep 15, 2002 10:05 pm

cast routine

Post by eqaddict » Wed Dec 18, 2002 11:45 pm

Actually, no I dont get it (

--EqA