Need some help with that macro you're working on or aren't quite sure how to get your macro to do something? Ask here!
Moderator: MacroQuest Developers
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Mon Apr 26, 2004 7:32 pm
Someone posted this in the depot, and I've been fiddling with it all day and still can't get it to work. It is a conversion to MQ2 of the old classic magic skill up macro. Any suggestions or soultions, please post, as I am stumped!!!
| Call this macro after defining targetted skill levels and appropriate spells
|
| Will iterate through all skills and raise them to requested levels in order
| The macro will auto end if the character moves.
|
| IMPORTANT NOTE: If you're casting a summoning spell and an item with "Summoned:"
| exists on your cursor it will be DESTROYED.
#define MANA_SIT 30 |% mana to sit and regain mana
#define MANA_CAST 90 |% mana to stand and resume casting
sub Main
/declare loc_x global |x loc
/declare loc_y global |y loc
|=========================
| record loc of character
|=========================
/varset loc_x (${Me.X})
/varset loc_y (${Me.Y})
/call RaiseSkill "Abjuration" 200 "Okeil's Radiation"
/call RaiseSkill "Alteration" 200 "Root"
/call RaiseSkill "Conjuration" 200 "Halo of Light"
/call RaiseSkill "Divination" 200 "True North"
/call RaiseSkill "Evocation" 200 "Shock of Fire"
/call RaiseSkill "Channeling" 200 "True North"
/call RaiseSkill "Meditate" 200 "Familiar"
/call RaiseSkill "Specialize Alteration" 50 "Shallow Breath"
/return
|===================================================================================
sub RaiseSkill(skill,level,spell)
|=========================
| general notification
|=========================
/echo - Raising @skill to @level with '@spell'
/echo Macro will AUTO STOP if movement is detected.
| return if spell not in book
|=========================
| /if $char(book,"@spell")==NULL {
/if (!${Book["@spell"]} {
/echo Spell '@spell' not in spellbook.
/return
}
:loop
|=========================
| insert short semi-random delay
|=========================
| /delay $calc(5+$rand(5))
/delay (${Rand[10]})s
|=========================
| exit if character movement detected
|=========================
| /if (@loc_x!=$char(x) || @loc_y!=$char(y)) {
/if (${Me.X}!=@loc_x || ${Me.Y}!=@loc_y) {
/echo Movement detected! Ending macro.
/endmacro
}
|=========================
| if casting a summoning spell and a summoned item on cursor, destroy it
|=========================
| /if ("@spell"~~"Summon" && "$cursor(name)"~~"Summoned:") /destroy
/if (@spell~~"Summon" && ${Cursor.Name}~~"Summoned:") /destroy
|=========================
| return if this skill at desired level
|=========================
| /if n $char(skill,"@skill")>=@level {
| /echo @skill at $char(skill,"@skill")
/if (${Skill[@skill]}>=@level {
/echo @skill at ${Skill[@skill]}
/return
}
|=========================
| insure spell memorized
|=========================
| /if n $char(gem,"@spell")==0 {
/if (!${Gem[@spell]})
/memspell 8 "@spell"
/delay 10s
}
|=========================
| sit if not casting/medding and mana dropped to MANA_SIT value
|=========================
| /if (n $char(mana,pct)<MANA_SIT && $char(state)=="STAND" && $char(casting)=="FALSE") /sit
/if (${Me.PctMana}<MANA_SIT && ${Me.State.Equal[STAND]} && !${Me.Casting.ID}) /sit
|=========================
| if medding and mana not yet up to MANA_CAST, continue to med
|=========================
| /if ($char(state)=="SIT" && n $char(mana,pct)<MANA_CAST) /goto :loop
/if (${Me.State.Equal[SIT]} && ${Me.PctMana}<MANA_CAST) /goto :loop
|=========================
| cast if the spell has refreshed
|=========================
| /if n $char(gem,"@spell")>0 {
| /if $char(state)=="SIT" /stand
| /if n $target(id)!=$char(id) /target myself
/if (${Gem[@spell]})>0 {
/if (${Me.State.Equal[SIT]) /stand
/if (${Target.CleanName.NotEqual[${Me.CleanName}]}) /target myself
/cast "@spell"
}
|=========================
| loop
|=========================
/goto :loop
/return
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)
-
dont_know_at_all
- Developer

- Posts: 5450
- Joined: Sun Dec 01, 2002 4:15 am
- Location: Florida, USA
-
Contact:
Post
by dont_know_at_all » Mon Apr 26, 2004 7:47 pm
/if (@spell~~"Summon" && ${Cursor.Name}~~"Summoned:") /destroy
search mq2date string
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Mon Apr 26, 2004 7:57 pm
What do you mean search mq2date string?
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)
-
dont_know_at_all
- Developer

- Posts: 5450
- Joined: Sun Dec 01, 2002 4:15 am
- Location: Florida, USA
-
Contact:
Post
by dont_know_at_all » Mon Apr 26, 2004 8:00 pm
sorry mq2data.
push the search button above and then type in mq2data and string.
-
dont_know_at_all
- Developer

- Posts: 5450
- Joined: Sun Dec 01, 2002 4:15 am
- Location: Florida, USA
-
Contact:
Post
by dont_know_at_all » Mon Apr 26, 2004 8:06 pm
Answering the inevitable:
/if evaulates a numeric value.
(@spell~~"Summon") is not a numeric value.
there are fourteen bajillion examples of how to do a string compare in the depot.
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Mon Apr 26, 2004 8:10 pm
Ok, sorry for the aggravation. I'm new to macroquest, so there is a bit of inevitable noobtardness.
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)
-
LordGiddion
- a snow griffon

- Posts: 352
- Joined: Sat Sep 13, 2003 6:12 pm
-
Contact:
Post
by LordGiddion » Mon Apr 26, 2004 8:14 pm
Also you posted in the wrong form, you should have posted this down in Macro help.
-
newb-n-training
- a lesser mummy

- Posts: 39
- Joined: Mon Apr 19, 2004 8:51 pm
Post
by newb-n-training » Tue Apr 27, 2004 12:14 pm
Trying to practice by rewriting some macro's so here's a second attempt. Figured I was doing the string wrong but didn't have time to research, so again, this is meant to
get you started. The old code was left in to allow people to compare against the old method.
Also I reiterate - I'm doing these conversions from work so unable to play with it (yes, newb enough that to write macro's I do so via trial and error), therefore this is
UNTESTED:
Code: Select all
| Call this macro after defining targetted skill levels and appropriate spells
|
| Will iterate through all skills and raise them to requested levels in order
| The macro will auto end if the character moves.
|
| IMPORTANT NOTE: If you're casting a summoning spell and an item with "Summoned:"
| exists on your cursor it will be DESTROYED.
#define MANA_SIT 30 |% mana to sit and regain mana
#define MANA_CAST 90 |% mana to stand and resume casting
sub Main
/declare loc_x global |x loc
/declare loc_y global |y loc
|=========================
| record loc of character
|=========================
/varset loc_x (${Me.X})
/varset loc_y (${Me.Y})
/call RaiseSkill "Abjuration" 200 "Okeil's Radiation"
/call RaiseSkill "Alteration" 200 "Root"
/call RaiseSkill "Conjuration" 200 "Halo of Light"
/call RaiseSkill "Divination" 200 "True North"
/call RaiseSkill "Evocation" 200 "Shock of Fire"
/call RaiseSkill "Channeling" 200 "True North"
/call RaiseSkill "Meditate" 200 "Familiar"
/call RaiseSkill "Specialize Alteration" 50 "Shallow Breath"
/return
|===================================================================================
sub RaiseSkill(skill,level,spell)
|=========================
| general notification
|=========================
/echo - Raising @skill to @level with '@spell'
/echo Macro will AUTO STOP if movement is detected.
|=========================
| return if spell not in book
|=========================
| /if $char(book,"@spell")==NULL {
/if (!${Book[@spell].ID} {
/echo Spell '@spell' not in spellbook.
/return
}
:loop
|=========================
| insert short semi-random delay
|=========================
| /delay $calc(5+$rand(5))
/delay (${Rand[10]})s
|=========================
| exit if character movement detected
|=========================
| /if (@loc_x!=$char(x) || @loc_y!=$char(y)) {
/if (${Me.X}!=@loc_x || ${Me.Y}!=@loc_y) {
/echo Movement detected! Ending macro.
/endmacro
}
|=========================
| if casting a summoning spell and a summoned item on cursor, destroy it
|=========================
| /if ("@spell"~~"Summon" && "$cursor(name)"~~"Summoned:") /destroy
/if (${String[@spell].Find[Summon]} && ${Cursor.CleanName.Find[Summoned:]}) /destroy
| Or should this be:
| /if (!${String[@spell].Find[Summon]}==NULL && !${Cursor.CleanName.Find[Summoned:]==NULL) /destroy
|=========================
| return if this skill at desired level
|=========================
| /if n $char(skill,"@skill")>=@level {
| /echo @skill at $char(skill,"@skill")
/if (${Skill[@skill]}>=@level) {
/echo @skill at ${Skill[@skill]}
/return
}
|=========================
| ensure spell memorized
|=========================
| /if n $char(gem,"@spell")==0 {
/if (!${Me.Gem[@spell].ID})
/memspell 8 "@spell"
/delay 10s
}
|=========================
| sit if not casting/medding and mana dropped to MANA_SIT value
|=========================
| /if (n $char(mana,pct)<MANA_SIT && $char(state)=="STAND" && $char(casting)=="FALSE") /sit
/if (${Me.PctMana}<MANA_SIT && ${Me.State.Equal[STAND]} && !${Me.Casting.ID}) /sit
|=========================
| if medding and mana not yet up to MANA_CAST, continue to med
|=========================
| /if ($char(state)=="SIT" && n $char(mana,pct)<MANA_CAST) /goto :loop
/if (${Me.State.Equal[SIT]} && ${Me.PctMana}<MANA_CAST) /goto :loop
|=========================
| cast if the spell has refreshed
|=========================
| /if n $char(gem,"@spell")>0 {
| /if $char(state)=="SIT" /stand
| /if n $target(id)!=$char(id) /target myself
/if (${Me.Gem[@spell].ID})>0) {
/if (${Me.State.Equal[SIT]) /stand
/if (${Target.CleanName.NotEqual[${Me.CleanName}]}) /target myself
/cast "@spell"
}
|=========================
| loop
|=========================
/goto :loop
/return
-
Preocts
- a snow griffon

- Posts: 312
- Joined: Thu Jan 29, 2004 1:02 pm
Post
by Preocts » Tue Apr 27, 2004 1:33 pm
newb-n-training wrote:(yes, newb enough that to write macro's I do so via trial and error),

You mean all this time there is a way other than trial and error?
Note to Mongol311:
Code: Select all
[code]Code Brackets[/code]
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Tue Apr 27, 2004 1:35 pm
Hehe, just tested this macro AND just found out about the code brackets. [/code] works like a charm, unfortunately the macro does not. I am such a noobtard.
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)
-
newb-n-training
- a lesser mummy

- Posts: 39
- Joined: Mon Apr 19, 2004 8:51 pm
Post
by newb-n-training » Tue Apr 27, 2004 3:09 pm
PreOcts- yer hysterical

but it sure seems like some people don't know how to do it
Mongol311 - post the error and lets see what else we can do ... the error typically tells you what's wrong, even down to the line the error occurs on
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Tue Apr 27, 2004 9:33 pm
Ok, here is the current version of the code I am using, and here is the error:
[MQ2] - Raising Abjuration to 200 with "Okeil's Radiation"
[MQ2] Macro will AUTO STOP if movement is detected
Ending macro: Failed to pare /if command. Could not find command to execute.
skillmagicup.mac@48 (RaiseSkill(skill,level,spell): /if (!${Book[@spell].ID}{
skillmagicup.mac@24 (Main): /call Raiseskill "Abjuration" 200 "Okeil's Radiation"
Cleared the following: Timers Arrays
The current macro has ended
I think it might be an error in terms of me inputting things like what spell to use, what level to raise skill, etc. Here is my current code
Code: Select all
| Call this macro after defining targetted skill levels and appropriate spells
|
| Will iterate through all skills and raise them to requested levels in order
| The macro will auto end if the character moves.
|
| IMPORTANT NOTE: If you're casting a summoning spell and an item with "Summoned:"
| exists on your cursor it will be DESTROYED.
#define MANA_SIT 30 |% mana to sit and regain mana
#define MANA_CAST 90 |% mana to stand and resume casting
sub Main
/declare loc_x global |x loc
/declare loc_y global |y loc
|=========================
| record loc of character
|=========================
/varset loc_x (${Me.X})
/varset loc_y (${Me.Y})
/call RaiseSkill "Abjuration" 200 "Okeil's Radiation"
/call RaiseSkill "Alteration" 200 "Root"
/call RaiseSkill "Conjuration" 200 "Halo of Light"
/call RaiseSkill "Divination" 200 "True North"
/call RaiseSkill "Evocation" 200 "Shock of Fire"
/call RaiseSkill "Channeling" 200 "True North"
/call RaiseSkill "Meditate" 200 "Familiar"
/call RaiseSkill "Specialize Alteration" 50 "Shallow Breath"
/return
|===================================================================================
sub RaiseSkill(skill,level,spell)
|=========================
| general notification
|=========================
/echo - Raising @skill to @level with '@spell'
/echo Macro will AUTO STOP if movement is detected.
|=========================
| return if spell not in book
|=========================
| /if $char(book,"@spell")==NULL {
/if (!${Book[@spell].ID} {
/echo Spell '@spell' not in spellbook.
/return
}
:loop
|=========================
| insert short semi-random delay
|=========================
| /delay $calc(5+$rand(5))
/delay (${Rand[10]})s
|=========================
| exit if character movement detected
|=========================
| /if (@loc_x!=$char(x) || @loc_y!=$char(y)) {
/if (${Me.X}!=@loc_x || ${Me.Y}!=@loc_y) {
/echo Movement detected! Ending macro.
/endmacro
}
|=========================
| if casting a summoning spell and a summoned item on cursor, destroy it
|=========================
| /if ("@spell"~~"Summon" && "$cursor(name)"~~"Summoned:") /destroy
/if (${String[@spell].Find[Summon]} && ${Cursor.CleanName.Find[Summoned:]}) /destroy
| Or should this be:
| /if (!${String[@spell].Find[Summon]}==NULL && !${Cursor.CleanName.Find[Summoned:]==NULL) /destroy
|=========================
| return if this skill at desired level
|=========================
| /if n $char(skill,"@skill")>=@level {
| /echo @skill at $char(skill,"@skill")
/if (${Skill[@skill]}>=@level) {
/echo @skill at ${Skill[@skill]}
/return
}
|=========================
| ensure spell memorized
|=========================
| /if n $char(gem,"@spell")==0 {
/if (!${Me.Gem[@spell].ID})
/memspell 8 "@spell"
/delay 10s
}
|=========================
| sit if not casting/medding and mana dropped to MANA_SIT value
|=========================
| /if (n $char(mana,pct)<MANA_SIT && $char(state)=="STAND" && $char(casting)=="FALSE") /sit
/if (${Me.PctMana}<MANA_SIT && ${Me.State.Equal[STAND]} && !${Me.Casting.ID}) /sit
|=========================
| if medding and mana not yet up to MANA_CAST, continue to med
|=========================
| /if ($char(state)=="SIT" && n $char(mana,pct)<MANA_CAST) /goto :loop
/if (${Me.State.Equal[SIT]} && ${Me.PctMana}<MANA_CAST) /goto :loop
|=========================
| cast if the spell has refreshed
|=========================
| /if n $char(gem,"@spell")>0 {
| /if $char(state)=="SIT" /stand
| /if n $target(id)!=$char(id) /target myself
/if (${Me.Gem[@spell].ID})>0) {
/if (${Me.State.Equal[SIT]) /stand
/if (${Target.CleanName.NotEqual[${Me.CleanName}]}) /target myself
/cast "@spell"
}
|=========================
| loop
|=========================
/goto :loop
/return
(Puts flame retardent hat on, hides in asbestos igloo, and prepares for worst)
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)
-
newb-n-training
- a lesser mummy

- Posts: 39
- Joined: Mon Apr 19, 2004 8:51 pm
Post
by newb-n-training » Tue Apr 27, 2004 11:09 pm
ok ... so here's the error:
Code: Select all
skillmagicup.mac@48 (RaiseSkill(skill,level,spell): /if (!${Book[@spell].ID}{
playing with it by typing (directly into the MQ window)
/echo ${Book[Alacrity]} on my chanter and I get an error "No such Top-Level Object 'Book'"
typing /echo ${Me.Book[Alacrity]} and I get a value
typing /echo ${Book[Alacrity].ID} and I get an error
typing /echo ${Me.Book[Spirit of Wolf]} and I get "unmatched bracket found in index: 'Spirit of Wolf""
Try changing that to (!${Me.Book[@spell]} in the macro to see where it gets ya.
I did a few tests and you'll find errors on a couple more lines that can be resolved exactly like this. Check it out, should help you to get a grasp on this a bit more. Sure helped me !
Last edited by
newb-n-training on Tue Apr 27, 2004 11:18 pm, edited 1 time in total.
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Tue Apr 27, 2004 11:16 pm
Thanks a ton newb!! Im gonna test it out right now!
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)
-
Mongol311
- a lesser mummy

- Posts: 45
- Joined: Sat Apr 24, 2004 12:06 pm
- Location: Connecticut, USA
Post
by Mongol311 » Tue Apr 27, 2004 11:49 pm
Changed
to
and I still get the same error. Is it possible it needs an "else" in there to make the if command work?
I live in an asbestos igloo, do your worst!
(Devs, please don't hate me, I donated!)