Page 1 of 1

Quick question

Posted: Fri Oct 08, 2004 12:07 am
by Hiidan
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 

Posted: Fri Oct 08, 2004 12:31 am
by Lum
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%

Posted: Fri Oct 08, 2004 12:35 am
by Hiidan
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.