My Macro Is Broken and I need Help Fixing It

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

MoonRaverX
a ghoul
a ghoul
Posts: 91
Joined: Tue Dec 16, 2003 5:09 pm
Location: Tampa, Fl

My Macro Is Broken and I need Help Fixing It

Post by MoonRaverX » Tue Apr 20, 2004 3:33 pm

Present Code (4th update)...

Code: Select all

| Canni.mac
| Autocanni and heal for a 65 with Q and C4
| Usage: /macro canni.mac
| By MoonRaver

#include SpellCast.mac

Sub Main
:loopstart
|  If your hp are less than 35% start a heal first. 
   /newif ( ${Me.PctHPs}<35 ) /call CastHeal

|  If your mana is more than 5%, and hp are between 25 and 50%, heal. 
   /newif ( ${Me.PctMana}>5 && ${Me.PctHPs}>25 && ${Me.PctHPs}<50 ) /call CastHeal

|  If hp are more than 40% and mana is under 90%, canni.
   /newif ( ${Me.PctHPs}>40 && ${Me.PctMana}<90 ) /call CastCanni

|  If your done canni'ing stop the macro.
   /newif ( ${Me.PctMana}>90 ) /call AllDone

   /doevents
   /delay 1
   /goto :loopstart

/return


Sub CastCanni
   :tryagain
   /delay 1
   /newif (!${Me.SpellReady[Cannibalize IV]}) /goto :tryagain
   /sit off
   
   /call Cast "Cannibalize IV"
   /if ( ${Macro.Return.Equal[CAST_RESTART]} ) /goto :tryagain
   /if ( ${Macro.Return.Equal[CAST_SUCCESS]} ) /goto :success
   /call ErrorTrap

   :success
   /sit on
   /delay 1
/return

Sub CastHeal
   :tryagain
   /delay 1
   /newif (!${Me.SpellReady[Quiescence]}) /goto :tryagain
   /sit off
   /target myself
   
   /call Cast "Quiescence"
   /if ( ${Macro.Return.Equal[CAST_RESTART]} ) /goto :tryagain
   /if ( ${Macro.Return.Equal[CAST_SUCCESS]} ) /goto :success
   /call ErrorTrap

   :success
   /delay 1
   /sit on
   /delay 90
/return

Sub ErrorTrap
   /echo Something went wrong with casting. Killing macro now.
   /endmacro
/return

Sub AllDone
   /delay 1
   /sit off
   
   /echo Cannidance done.
   /endmacro
/return
Old Post continues...
exactly as is...
and i have the updated spellcast include that works with the new system. Here's the deal, best I can make it work, it looks like it runs, but does nothing...

Playing with it, I can make it say it doesn't have integers... and I can't find a good how to use the new system with the different parts of the structures. I know this isn't a big macro, but it's the primary one I use, and if i can get this one working, my other more intricate ones can be fixed. Basically, I can't find a good source of info on how to correctly use the new system. Any help is appreciated.

Edited with new rendition
Last edited by MoonRaverX on Thu Apr 22, 2004 1:14 am, edited 1 time in total.
-MoonRaverX
(Removed character from my sig due to owner of said character requesting me to.)

"ASCII stupid question, get a stupid ANSI"

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

example

Post by Preocts » Tue Apr 20, 2004 4:11 pm

Code: Select all

   /newif (${[color=red]M[/color]e.PctHPs}<35[color=red])[/color] /call CastHeal 
And if that doesn't make it work

Code: Select all

    /newif (${Math.Calc[${[color=red]M[/color]e.PctHPs}<35]}) /call CastHeal 

Chaesar
orc pawn
orc pawn
Posts: 15
Joined: Mon Feb 23, 2004 1:28 pm

Post by Chaesar » Tue Apr 20, 2004 4:27 pm

As Preocts said above, me != Me in the new system. You need to make the M uppercase in all instances.

Also you might want to consider restructuring your /newif statements. I don't think that () are necessary unless you are trying to specify the order of your conditions.

Code: Select all

/newif ${Me.PctHPs}<35 /call CastHeal 
should work just fine.

Your other /newifs are rather strangely structured. I cannot test the following atm, but it should work:

Code: Select all

|  If your mana is more than 5%, and hp are between 25 and 50%, heal.
   /newif ${Me.PctMana}>5 && (${Me.PctHPs}>25 && ${Me.PctHPs}<50) /call CastHeal
 
|  If hp are more than 60% and mana is under 90%, canni.
   /newif ${Me.PctHPs}>60 && ${Me.PctMana}<90 /call CastCanni 

|  If your done canni'ing stop the macro. 
   /newif ${Me.PctMana}>90 /call AllDone

wassup
Official Guardian and Writer of TFM
Official Guardian and Writer of TFM
Posts: 1487
Joined: Sat Oct 26, 2002 5:15 pm

Post by wassup » Tue Apr 20, 2004 6:01 pm

Here are a few fixes. I think you can figure out how to do the rest from these:

Code: Select all

|  If hp are more than 60% and mana is under 90%, canni. 
   /newif (${Me.PctHPs}>60 && ${Me.PctMana}<90) /call CastCanni

Code: Select all

Sub CastCanni 
   :tryagain 
   /delay 1 
   /newif (!${Me.SpellReady[Cannibalize IV]}) /goto :tryagain 
   /sit off 
    
   /call Cast "Cannibalize IV" 
   /newif (${Macro.Return.Equal[CAST_RESTART]}) /call CastCanni 
   /newif (${Macro.Return.Equal[CAST_OUTOFMANA]}) /call ErrorTrap 
   /newif (${Macro.Return.Equal[CAST_OUTOFRANGE]}) /call ErrorTrap 
   /newif (${Macro.Return.Equal[CAST_CANNOTSEE]}) /call ErrorTrap 
   /newif (${Macro.Return.Equal[CAST_STUNNED]}) /call ErrorTrap 
   /newif (${Macro.Return.Equal[CAST_RESISTED]}) /call ErrorTrap 
   /sit on 
   /delay 1 
/return
replace /call Main with /return at the end of every sub

MoonRaverX
a ghoul
a ghoul
Posts: 91
Joined: Tue Dec 16, 2003 5:09 pm
Location: Tampa, Fl

Post by MoonRaverX » Wed Apr 21, 2004 8:16 am

ok, i chewed on it, and can't believe i did the newbie newbie newbie /call main instead of return... *slaps own hand*.... anyhow, surprised you didn't catch if it wanted to recast, it called itself... anyhow, with the info given, and finind caps matter, untested but should work, here's what i got... going to log in and test later, i think it's getting patched atm...

Code: Select all

| Canni.mac
| Autocanni and heal for a 65 with Q and C4
| Usage: /macro canni.mac
| By MoonRaver

#include SpellCast.mac

Sub Main
:loopstart
|  If your hp are less than 35% start a heal first. 
   /newif ( ${Me.PctHPs}<35 ) /call CastHeal

|  If your mana is more than 5%, and hp are between 25 and 50%, heal. 
   /newif ( ${Me.PctMana}<5 && ${Me.PctHPs}<25 && ${Me.PctHPs}<50 ) /call CastHeal

|  If hp are more than 40% and mana is under 90%, canni.
   /newif ( ${Me.PctHPs}<40 && ${Me.PctMana}<90 ) /call CastCanni

|  If your done canni'ing stop the macro.
   /newif ( ${Me.PctMana}<90 ) /call AllDone

   /doevents
   /delay 1
   /goto :loopstart

/return


Sub CastCanni
   :tryagain
   /delay 1
   /newif (!${Me.SpellReady[Cannibalize IV]}) /goto :tryagain
   /sit off
   
   /call Cast "Cannibalize IV"
   /if $return==CAST_RESTART /goto :tryagain
   /if $return==CAST_SUCCESS /goto :success
   /call ErrorTrap

   :success
   /sit on
   /delay 1
/return

Sub CastHeal
   :tryagain
   /delay 1
   /newif (!${Me.SpellReady[Quiescence]}) /goto :tryagain
   /sit off
   /target myself
   
   /call Cast "Quiescence"
   /if $return==CAST_RESTART /goto :tryagain
   /if $return==CAST_SUCCESS /goto :success
   /call ErrorTrap

   :success
   /delay 1
   /sit on
   /delay 90
/return

Sub ErrorTrap
   /echo Something went wrong with casting. Killing macro now.
   /endmacro
/return

Sub AllDone
   /delay 1
   /sit off
   
   /echo Cannidance done.
   /endmacro
/return
What do you think for cleaner, better code? (And hope it works, never realized how much i used it till it was taken away).
Last edited by MoonRaverX on Wed Apr 21, 2004 5:34 pm, edited 1 time in total.
-MoonRaverX
(Removed character from my sig due to owner of said character requesting me to.)

"ASCII stupid question, get a stupid ANSI"

Preocts
a snow griffon
a snow griffon
Posts: 312
Joined: Thu Jan 29, 2004 1:02 pm

Post by Preocts » Wed Apr 21, 2004 8:39 am

MoonRaverX wrote: | If your hp are less than 35% start a heal first.
/newif ${Me.PctHPs}<35 /call CastHeal

| If your mana is more than 5%, and hp are between 25 and 50%, heal.
/newif ( ${Me.PctMana}<5 && ${Me.PctHPs}<25 && ${Me.PctHPs}<50 ) /call CastHeal

| If hp are more than 40% and mana is under 90%, canni.
/newif ( ${Me.PctHPs}<40 && ${Me.PctMana}<90 ) /call CastCanni

| If your done canni'ing stop the macro.
/newif ${Me.PctMana}<90 /call AllDone
1) () around ALL conditional operators in the /newif statements.
2) Acually don't know if this will make an error but MQ phrase, in the past, hates spaces. So might want no spacing. ( ${ becomes (${.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Wed Apr 21, 2004 11:58 am

Spaces when used inside the condition parentheses are fine, e.g.

( 1 && 2 || 3 )

This is part of the reason for requiring them :)
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0