Quick question

Need help with a macro you are writing? Ask here!

Moderator: MacroQuest Developers

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

Quick question

Post by Hiidan » Fri Oct 08, 2004 12:07 am

Writing my first macro, was curious as to the use of { and }. What are they for? In this code, that I was hoping to disect and add more to it, those two characters are in there, but I don't seem them doing anything special. Are they needed? If so, what certain cases would require those.

Code: Select all

#turbo 
#Include spellcast.inc 

Sub Main 

:loop 
/if (${Target.PctHPs}<70) { 
/goto :heal
} else { 
/goto :loop 
} 


:heal 
/cast 8 
/goto :loop 

Lum
a lesser mummy
a lesser mummy
Posts: 68
Joined: Thu Sep 16, 2004 10:12 am

Post by Lum » Fri Oct 08, 2004 12:31 am

first, you dont need spellcast.inc in that macro :P

the { and } are seperators, as a bracket implies, used to group things together. with If statements they say what to use if True with multiple lines.

Code: Select all

/if this {
do this
this
and this
} 
but not this
the else { } is nto required as it will skip right to end of first bracket if the if statement is false etc.

you can simplify your code to this....

Code: Select all

sub main
:loop
/if (${Target.PctHPs}<70) {
/cast 8
}
/goto :loop
/return
and it will do the same thing, you can even replace the /cast 8 with something such as /cast "Greater heal" and it will cast it if its memmed anywhere on teh spell bar.

aside from /if statements and the actual tag for data ive never used the {}, so dunno what else uses em
edit: this code is mostly unusable as it will spam you while casting until heal completes and they are over 70%

Hiidan
a ghoul
a ghoul
Posts: 89
Joined: Wed Oct 06, 2004 10:13 pm

Post by Hiidan » Fri Oct 08, 2004 12:35 am

Thanks a ton, this is just the start. I'll fix bugs and streamline it and stuff while after im done getting the options i want in.