My macro, very very very simple...new at this...

A forum for you to dump all the macros you create, allowing users to use, modify, and comment on your work.

Moderator: MacroQuest Developers

ubatch
a ghoul
a ghoul
Posts: 93
Joined: Tue Nov 18, 2003 3:57 pm

My macro, very very very simple...new at this...

Post by ubatch » Fri Dec 05, 2003 4:24 pm

Please tell me what you guys think of it. Let me know how to improve it, i KNOW it'll need it. Just a little something to make my wiz casting easier on me :)

Code: Select all

| This is Malkum's casting program.  Simple, yet effective.
|
| Let's just hope it works...
|
|
/echo "Malkast macro starting.  Be prepaired for some ownage!"

#turbo 20

Sub Main
/declare mobHP global
/varset mobHP == $target(hp,pct)

/if mobHP == 50 {
	/call mobHP50
}
/if mobHP == 15 {
	/call mobHP15
}
/return

Sub mobHP50
/if $char(state) == STAND {
	/cast "Sunstrike"
	} else {
	/stand
	/cast "Sunstrike"
}
/sit
/return

Sub mobHP15
/if $char(state) == STAND {
	/cast "Draught of Ro"
	} else {
	/stand
	/cast "Draught of Ro"
}
/sit
/return

TI994a
a ghoul
a ghoul
Posts: 87
Joined: Mon Oct 13, 2003 12:25 pm

Post by TI994a » Fri Dec 05, 2003 5:58 pm

Well, first off, the vast majority of the time you run this macro, nothing will happen. Why? Because your target's HP would have to be exactly 15% or 50% for it to do anything. And since there's no looping mechanism in place, once you did the /macro malkast, it would run thru just 1 time, and you'd only have a 2% chance of the macro finding your target in one of those states.

Additionally, while it's easier to read the /if statements by putting in the spaces, traditionally /if has required no spaces between the arguments on either side of the comparison operator.

If your goal is simply to cast Sunstrike when the mob is at 50%, why not just press an Alt+# key to cast Sunstrike. It would be much simpler than having to type out an entire commandline of /macro malkast.

- TI

Scary_Penguin
a lesser mummy
a lesser mummy
Posts: 76
Joined: Sun Nov 16, 2003 11:45 am

Post by Scary_Penguin » Fri Dec 05, 2003 11:27 pm

Code: Select all

/if mobHP == 50 { 
   /call mobHP50 
} 
/if mobHP == 15 { 
   /call mobHP15
You may want to change this to

Code: Select all

/if mobHP>=50 { 
   /call mobHP50 
} 
/if mobHP>=15 && mobHP<=49 { 
   /call mobHP15
I think thats the right way to code it...

koad
Plugins Czar
Posts: 127
Joined: Fri May 16, 2003 8:32 pm

Post by koad » Sat Dec 06, 2003 7:22 am

im going to run with the assumption you want this to automate your wiz's role in your boxed setting ~ if that's the case you need a loop running to monitor your conditions to act on them:

a few things-
/varset doesnt need ==, just /varset pointer value(bold)
your dealing with a mobs life its more reliable to do a number comparison with the n switch in the /if for < > comparisons(red)
keep in mind with this setup, its going to call mobHP15 as long as the mobs life is < 15 (you prolly will be finishing it off with this nuke? not sure)
to minimize spam and executions, i added a casting check to my edited example

when you want to use the value of a variable, you need to put a @ before the pointer name so it parses to the value

Code: Select all

| This is Malkum's casting program.  Simple, yet effective. 
| 
| Let's just hope it works... 
| 
| 
/echo "Malkast macro starting.  Be prepaired for some ownage!" 

#turbo 20 

Sub Main 
/declare mobHP global 

:mainloop
[b]/varset mobHP $target(hp,pct) [/b]

/if $char(casting)==FALSE {
   /if [color=red]@[/color]mobHP==50 { 
      /call mobHP50 
   } 
   /if n [color=red]@[/color]mobHP<=15 { 
      /call mobHP15 
   } 
}
/delay 1 
/goto :mainloop

/return 

Sub mobHP50 
/if $char(state)==STAND { 
   /cast "Sunstrike" 
   } else { 
   /stand 
   /cast "Sunstrike" 
} 
/sit 
/return 

Sub mobHP15 
/if $char(state)==STAND { 
   /cast "Draught of Ro" 
   } else { 
   /stand 
   /cast "Draught of Ro" 
} 
/sit 
/return 

ubatch
a ghoul
a ghoul
Posts: 93
Joined: Tue Nov 18, 2003 3:57 pm

Coding error?

Post by ubatch » Sat Dec 13, 2003 6:44 pm

It says that my if statement isnt correct, can someone help me?

Code: Select all

| This is Malkum's casting program.  Simple, yet effective. 
| 
| Let's just hope it works... 
| 
| 
/echo "Malkast macro starting.  Be prepaired for some ownage!" 

#turbo 20 

Sub Main 
/declare mobHP global 

:mainloop 
/varset mobHP $target(hp,pct) 

/if $char(casting) = FALSE{
   /if @mobHP==50 { 
      /call mobHP50 
   }
   /if @mobHP<=15 { 
      /call mobHP15 
   } 
} 
/delay 1 
/goto :mainloop 

/return 

Sub mobHP50 
/if $char(state) = STAND{ 
   /cast "Shock of Magic" 
   }else{ 
   /stand 
   /cast "Shock of Magic" 
} 
/sit 
/return 

Sub mobHP15 
/if $char(state) = STAND{ 
   /cast "Draught of Thunder" 
   }else{ 
   /stand 
   /cast "Draught of Thunder!" 
} 
/sit 
/return 

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sat Dec 13, 2003 7:34 pm

Try this:

Code: Select all

| This is Malkum's casting program.  Simple, yet effective. 
| 
| Let's just hope it works... 
| 
| 
/echo "Malkast macro starting.  Be prepaired for some ownage!" 

#turbo 20 

Sub Main 
/declare mobHP global 

:mainloop 
/varset mobHP $target(hp,pct) 

/if $char(casting)==FALSE { 
   /if n @mobHP==50 { 
      /call mobHP50 
   } 
   /if n @mobHP<=15 { 
      /call mobHP15 
   } 
} 
/delay 1 
/goto :mainloop 

/return 

Sub mobHP50 
/if $char(state)==STAND { 
   /cast "Shock of Magic" 
   } else { 
   /stand 
   /cast "Shock of Magic" 
} 
/sit 
/return 

Sub mobHP15 
/if $char(state)==STAND { 
   /cast "Draught of Thunder" 
   } else { 
   /stand 
   /cast "Draught of Thunder!" 
} 
/sit 
/return 

ubatch
a ghoul
a ghoul
Posts: 93
Joined: Tue Nov 18, 2003 3:57 pm

Post by ubatch » Sat Dec 13, 2003 10:24 pm

Thanks, what does the /if n do?

Another thing now, I have some logic errors I guess, at the end of casting the mobHP15 my character sits and stands really fast, trying to nuke but has no target or whatever...any ideas on that one? Dang this programming stuff sucks =P

ubatch
a ghoul
a ghoul
Posts: 93
Joined: Tue Nov 18, 2003 3:57 pm

Post by ubatch » Sat Dec 13, 2003 10:39 pm

Ok I think ive got everything figured out, just going into a bigger and bigger macro =P I will let you guys know when i need more help...this stuff just takes a lot of trial and error :)

ml2517
a grimling bloodguard
a grimling bloodguard
Posts: 1216
Joined: Wed Nov 12, 2003 1:12 am

Post by ml2517 » Sat Dec 13, 2003 10:54 pm

I'm assuming you want to do something like this:

Code: Select all

| This is Malkum's casting program.  Simple, yet effective. 
| 
| Let's just hope it works... 
| 
| 
/echo "Malkast macro starting.  Be prepaired for some ownage!" 

#turbo 20 

|  Set this to the number of seconds you want to wait before sitting after your target is dead.
#define SITWAITTIME 10s

Sub Main 
/declare mobHP global 

:mainloop 
/varset mobHP $target(hp,pct) 

/if $target()==TRUE {
    /if $char(casting)==FALSE { 
        /if n @mobHP<=50 /call Nuke 
    } 
}
/if $char(state)==STAND /if $target()==FALSE {
    /delay SITWAITTIME
    /sit on
}
/delay 1 
/goto :mainloop 
/return 

Sub Nuke
/if $char(state)!=STAND /stand

/if n @mobHP<=15 {
    /cast "Draught of Thunder" 
    } else { 
    /cast "Shock of Magic" 
} 
/return 

notadruid
a ghoul
a ghoul
Posts: 143
Joined: Mon Dec 08, 2003 6:02 pm

Post by notadruid » Sat Dec 13, 2003 11:17 pm

Perhaps this should be moved to Macro Help

User avatar
blueninja
a grimling bloodguard
a grimling bloodguard
Posts: 541
Joined: Thu Aug 28, 2003 7:03 am
Location: Göteborg, Sweden

Post by blueninja » Sun Dec 14, 2003 4:57 pm

"/if n" does a numeric comparison as opposed to a string comparison.