spell.mac provides spell memorization / forgetting NEW UI!!!

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

Moderator: MacroQuest Developers

mongo
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jun 22, 2003 7:52 pm

spell.mac provides spell memorization / forgetting NEW UI!!!

Post by mongo » Mon Jun 30, 2003 8:56 pm

ok this is my first, so be easy with me. All you need to do is get your XY cords of the first gem and first spell slot, and change the vars in the script


BTW Thanks to DeathSpiral for the starter.

Code: Select all

#define gemX v50
#define gemY v51
#define bookX v52
#define bookY v53






sub main

/varset gemX 25
/varset gemY 189
/varset bookX 340
/varset bookY 210

/press esc
/press esc
/press esc
/press esc
/press esc
/stand
/sit on

|||| Delete spell gems ||||

/for v1 1 to 8
/call ForgetSpellByNumber $v1
/next v1

|||| Open spell book ||||


/call MemorizeSpell "Celestial Healing" 1
/call MemorizeSpell "Superior Healing" 2
/call MemorizeSpell "Complete Healing" 3
/call MemorizeSpell "Greater Healing" 4
/call MemorizeSpell "Resolution" 5
/call MemorizeSpell "Instill" 6
/call MemorizeSpell "Retribution" 7
/call MemorizeSpell "Gate" 8
/return







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
	/if "$char(gem,$p0)"=="NULL" /return
	/call MousetoSpellGem $p0 
	/delay 2 
	/click right 
	:WaitForGemFreeInForgetSpellByNumber 
	/doevents 
	/if "$char(gem,$p0)"!="NULL" /goto :WaitForGemFreeInForgetSpellByNumber 
/return 


Sub MousetoSpellGem
	/mouseto $gemX $calc($p0*33+$gemY-33)
/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 v10 0
/varset v11 $bookX
/varset v12 $bookY
/varset v13 $char(book,"$p0")



:looppage

/varadd v10 1
/if n $v13<17 /goto :bookside
/varsub v13 16
/varadd v10 1
/goto :looppage


:bookside
/if n $v13>8 {
/varsub v13 8
/varadd v11 186 
}


/if n $v13==1 /goto :setmouse
 
/if n $v13==2 {
/varadd v11 85
/goto :setmouse
}

/if n $v13==3 {
/varadd v12 67
/goto :setmouse
}

/if n $v13==4 {
/varadd v11 85
/varadd v12 67
/goto :setmouse
}

/if n $v13==5 {
/varadd v12 134
/goto :setmouse
}

/if n $v13==6 {
/varadd v11 85
/varadd v12 134
/goto :setmouse
}

/if n $v13==7 {
/varadd v12 201
/goto :setmouse
}

/if n $v13==8 {
/varadd v11 85
/varadd v12 201
/goto :setmouse
}



:setmouse

/book $v10
/delay 1
/mouseto $v11 $v12
/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 
/return 



Enjoy!

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 Jun 30, 2003 9:01 pm

Add documentation about your assumptions.

You have gemX and gemY hardcoded, for example. What if my gems are in some other place?

mongo
decaying skeleton
decaying skeleton
Posts: 8
Joined: Sun Jun 22, 2003 7:52 pm

Post by mongo » Mon Jun 30, 2003 9:20 pm

All you need to do is get your XY cords of the first gem and first spell slot, and change the vars in the script

dont think that is too hard to understand... change the following vars to your UI setup...

Code: Select all

/varset gemX 25 
/varset gemY 189 
/varset bookX 340 
/varset bookY 210 

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 Jun 30, 2003 10:07 pm

No, it's not.

If you document your functions, then maybe people will build on your work. If I have to scratch my head over every line of your macro, I might as well write my own.

I like your idea but your implementation seems incomplete without a lot of comments.

caewen
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Jan 13, 2003 5:09 am

Post by caewen » Wed Jul 02, 2003 12:53 pm

Instead of all this, why not just add the locs to the location.txt file? Here is part of mine, for example:

[spellgem_0]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell0

[spellgem_1]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell1

[spellgem_2]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell2

[spellgem_3]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell3

[spellgem_4]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell4

[spellgem_5]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell5

[spellgem_6]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell6

[spellgem_7]
UILabel=CastSpellWnd
XMLFile=EQUI_CastSpellWnd.xml
ScreenID=CSPW_Spell7

[book_0]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell0

[book_1]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell1

[book_2]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell2

[book_3]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell3

[book_4]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell4

[book_5]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell5

[book_6]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell6

[book_7]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell7

[book_8]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell8

[book_9]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell9

[book_10]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell10

[book_11]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell11

[book_12]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell12

[book_13]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell13

[book_14]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell14

[book_15]
UILabel=SpellBookWnd
XMLFile=EQUI_SpellBookWnd.xml
ScreenID=SBW_Spell15


This takes care of all 8 gems and the 16 spell icons in the book. Then all you have to do is work on getting the page number and local icon number worked out.

Here is the modified code that I use to mem spells. A little sloppy, but works very well for me.

Code: Select all

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
   /delay 3
   /varset v21 $int($p0)
   /varcalc v21 $int($v21+1)
   /varset v21 $int($v21)
   /if "$char(gem,$v21)"=="NULL" /return
   /click right
   :WaitForGemFreeInForgetSpellByNumber
      /doevents
      /if "$char(gem,$v21)"!="NULL" /goto :WaitForGemFreeInForgetSpellByNumber
/return

| This function takes two arguments; the name of the spell to memorize and the
| spell gem to put it in
sub MemorizeSpell
   /delay 1
   /if $char(gem,"$p0")!="0" /return
   /if $char(book,"$p0")=="NULL" /return
   | Spell book # is $l9.  Spell book page is $l8.  Spell slot is $l7.
   | Page layout is $l6
   /varset v19 $char(book,"$p0")
   /varset v19 $int($v19-1)
   /varset v18 $int($v19/8+1)
  	/varset v17 $int($v19)
   /for v10 1 to 15
   |This loop keeps taking away 16 from the spell number until it is under
   |16 for the local spell number.  Sloppy, but works.
   /if n $v17>=16 {
   	/varset v17 $int($v17-16)
   	/next v10
   	}

   /book $v18

   /delay 3

   /if n $v17==0 /varset v20 book_0
   /if n $v17==1 /varset v20 book_1
   /if n $v17==2 /varset v20 book_2
   /if n $v17==3 /varset v20 book_3
   /if n $v17==4 /varset v20 book_4
   /if n $v17==5 /varset v20 book_5
   /if n $v17==6 /varset v20 book_6
   /if n $v17==7 /varset v20 book_7
   /if n $v17==8 /varset v20 book_8
   /if n $v17==9 /varset v20 book_9
   /if n $v17==10 /varset v20 book_10
   /if n $v17==11 /varset v20 book_11
   /if n $v17==12 /varset v20 book_12
   /if n $v17==13 /varset v20 book_13
   /if n $v17==14 /varset v20 book_14
   /if n $v17==15 /varset v20 book_15
   
   /delay 1

   /click left $v20

   /delay 2

   /call MousetoSpellGem $p1

   /call ForgetSpellByNumber $p1

   /click left

   :WaitToFinishMemorizingSpell
      /doevents
      /if "$char(gem,$v21)"=="NULL" /goto :WaitToFinishMemorizingSpell
/return

sub MousetoSpellGem
	/if n $p0==0 /varset v11 "spellgem_0" {
	} else /if n $p0==1 /varset v11 "spellgem_1" {
	} else /if n $p0==2 /varset v11 "spellgem_2" {
	} else /if n $p0==3 /varset v11 "spellgem_3" {
	} else /if n $p0==4 /varset v11 "spellgem_4" { 
	} else /if n $p0==5 /varset v11 "spellgem_5" {
	} else /if n $p0==6 /varset v11 "spellgem_6" {
	} else /varset v11 "spellgem_7"
   /mouseto $v11
/return
Caewen

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

Post by macrotoon » Sun Jul 06, 2003 6:43 pm

Is there any way to use the new spell loading feature in EQ?

Looking in my char_43.ini file i see a section called spell loadouts.

It looks like this

Code: Select all

[SpellLoadouts]
SpellLoadout1.inuse=1
SpellLoadout1.name=another one
SpellLoadout1.slot1=1283
SpellLoadout1.slot2=131
SpellLoadout1.slot3=2581
SpellLoadout1.slot4=216
SpellLoadout1.slot5=3578
SpellLoadout1.slot6=2583
SpellLoadout1.slot7=44
SpellLoadout1.slot8=207
SpellLoadout2.inuse=1
SpellLoadout3.inuse=0
SpellLoadout4.inuse=0
SpellLoadout5.inuse=0
SpellLoadout6.inuse=0
SpellLoadout7.inuse=0
SpellLoadout8.inuse=0
SpellLoadout9.inuse=0
SpellLoadout10.inuse=0
SpellLoadout2.name=normal
SpellLoadout2.slot1=1283
SpellLoadout2.slot2=131
SpellLoadout2.slot3=2581
SpellLoadout2.slot4=216
SpellLoadout2.slot5=2590
SpellLoadout2.slot6=9
SpellLoadout2.slot7=44
SpellLoadout2.slot8=207

Looking on lucy item/spell db i found that the numbber is actually the spell ID. Like 207=Divine Aura.
216=Stun
So on and so forth. Is there a way to impliment this into MQ using the ini file and such?

Not sure if you can or what not, but IMO this would make memming groups of spells or just one spell alot easier.

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Jul 30, 2003 1:55 am

you can use the new spell sets yes

you type /load <name of set>

not that the set cannot have spaces.. I corrected this by changing my spell sets from #1 All Heals to #1.All.Heals

and now it works

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Another little ... gem ...

Post by MacroFiend » Wed Jul 30, 2003 2:37 am

(pun intended) is that the /memspell [slot] [spellname] command works again.

Not only does it work but if you have a spell mem'd in the spot, it will forget it. If you already have the spell you are running the command on mem'd in a different gem, it will forget both gems and mem it in the spot you told it to.

At least it did both those things on my version of MQ but I haven't tweaked that function or any of its friends.

Also, like most MQ commands, wrapping a name in quotes will handle spaces, i.e. /loadspells "#1 All Heals" from Vesper's example.

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Jul 30, 2003 3:41 pm

hrmm.. i've run into something very odd with /memspell

yes it does work for lots of spells.. couldn't give you a percentage since I haven't tried that many.. but for spells it clearly does not work.. wether you put them in brackets or not.. it won't work.. And I've double checked the spelling many times

such spells as : Judgement, Condemnation (cleric high lvl nuke spells) won't be recognized but "Destroy Undead" is recognized np. And I've checked the spelling and it did not work any more

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Jul 30, 2003 4:25 pm

VesperKnight wrote:hrmm.. i've run into something very odd with /memspell

yes it does work for lots of spells.. couldn't give you a percentage since I haven't tried that many.. but for spells it clearly does not work.. wether you put them in brackets or not.. it won't work.. And I've double checked the spelling many times

such spells as : Judgement, Condemnation (cleric high lvl nuke spells) won't be recognized but "Destroy Undead" is recognized np. And I've checked the spelling and it did not work any more
The brackets were there to show variables. You shouldn't have any [] in the actual command. An example would be /memspell 5 "Destroy Undead" or /memspell 5 Condemnation

I haven't gone through a lot of spells on my cleric, so I don't know if there are any scribing issues using the fixed memspell but if I get some time, I'll run through most of my spells and see if it chokes anywhere.

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Jul 30, 2003 5:20 pm

sorry but i didn't mean brackets.. i meant "" whatever those are called..

Condemnation and Judgement won't scribe no matter what. I've gone around this by making a spell set with just Condemnation in it and having the command load the spell set (thus only forgetting and memming one new spell) instead of using the /memspell command



I also have this problem.. here is a CH Rotation macro that someone was nice enough to make for me

Code: Select all

| USAGE: /macro CHCHat [channelname] [mynumber] [delayinseconds] 
| #chat defines the channel that you want. 
| In this case the chat channel is the channel to 
| trigger Event_Chat 
#chat chat 
#include SpellCast.mac 
| This will loop and be watching for any events 
| Thus, it will be waiting for a chat channel to become active 
Sub Main 
/varset a(2,0) $p0 
/varset a(2,1) $p1 
/varset a(2,2) $p2 
:loop 
  /doevents 
  /goto :loop 
/return 

| This is our Chat event sub. it is triggered evrey time 
| someone uses a chat channel, any chat channel 
Sub Event_Chat 
/if $p0~~$a(2,0) /if $p2~~$a(2,1) { 
  /delay $a(2,2)s 
  /press 1
 }
/return 
It works like a charm now. I have only one problem with it. If i want my /cast to go off only when I see 2 2 2 (with spaces) it doesn't work even if i put "2 2 2". It gives me this error message : Couldn't find a comparision operator in '2'

any ideas on how to make the above macro react to a string of characters that contains spaces?

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Jul 30, 2003 6:01 pm

Try changing your trigger to be this ...

Code: Select all

/if $p0~~$a(2,0) /if "$p2"~~"$a(2,1)" { 
 
That should make it try and compare strings. Without the quotes, it could have been reading the " 2 2" as other parts of a comparison

VesperKnight
orc pawn
orc pawn
Posts: 29
Joined: Tue Jul 29, 2003 5:37 am

Post by VesperKnight » Wed Jul 30, 2003 10:21 pm

MacroFiend thank you for your quick replies you've been very helpful. and btw that latest modification did solve my problem!!

But I have another problem now... I wasn't expecting to have this one... but I guess that's how the macro works right now.

the last time I used the command I used this one

/macro chchat testcleric "8 8 8" 1.5

btw it handles half seconds.. and that's great caz 2 seconds was a bit too long. the macro was running great.. every time the person before me CH and his msg went off, my CH and msg went off approx 2 seconds later

but then later in the fight cleric 8 had to be skipped one round.. so as customary for us to do.. he said "skip 8" .. and that made my ch/msg go off!!

now that's not good.. I thought it was only going to go off when it say "8 8 8" not just any random single 8....

can you, or anyone, think of any way to make sure it only goes off when the chat matches exactly what it's looking for? in this case.. "8 8 8"

thanks that'd be great

====================================

Edit : Sorry had to add this.. found out more weird stuff happening tonight.

At someone point while running the above macro.. from which I removed the "include spellcast.mac" btw because I didn't need it. It gave me this error message that really boggled me : Couldn't find a comparision operator in 'the'

... and it said that after there was no mention whatsoever of THE in neither the chat channel or other channels. I then removed all the explanatory text from the macro.. thinking it might be one of those 'the' that was messing it up.. and the same error happened later on!!

Also I thought of going around my problem with the macro not recognizing "8 8 8" as "8 8 8" and going off when a single 8 was spoken.. by having it look for "<8" instead since cleric 8's macro was <8 8 8> in fact. I tested this and indeed the macro no longer went off at the mention of a single 8... however it now went off at the mention of ANY "<" even if not followed by an 8...

just some minor problems I'm hoping