more syntax definition

Help section from before the user variable changes that broke all macros

Moderator: MacroQuest Developers

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

more syntax definition

Post by Kint » Wed Jul 09, 2003 10:17 am

what does a , seperator do in an /if statement do?
ie

/if n (1==1,2==1) /echo hello

thanks
Last edited by Kint on Wed Jul 09, 2003 6:56 pm, edited 2 times in total.

User avatar
grimjack
Macro Author
Macro Author
Posts: 525
Joined: Thu Nov 07, 2002 6:51 am
Contact:

Post by grimjack » Wed Jul 09, 2003 10:29 am

$target(x) should give the x coordinate of the target(This may be goofy and give the y). The x and y axis everquest uses is kind of goofy. If I remember correctly the x axis runs n/s and the y axis runs e/w (rotated 90 degrees from what you would expect basicly).


I have never seen a , used in an /if. (Just because I have not seen it does not meen it does not work)
, is used in $if though.

Thanks
GrimJack
When they come to me, they're in trouble, or they want some. I bust people out of prison, hunt down vampires, fight alien gods -- All the fun jobs people are too squeamish or too polite to do themselves.

Call me a mercenary. Call me an assassin. Call me a villain. I am all that and more.

My name's John Gaunt, but out on the streets of Cynosure, I am called...
GrimJack

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

Post by Kint » Wed Jul 09, 2003 10:44 am

Code: Select all

/if n $distance($calc($target(y)-$cos($target(heading))*10),$calc($target(x)-$sin($target(heading))*10))<3

found this in the getbehind system I was looking through a few min. ago and didn't know what the comma did.

Thanks for your reply about the x thing. I was in game and tested it while you were replying I guess. looks like n-s is Y, north is positive and south is negative. w-e is X, west is positive, east neg. and Z is up/down. up is positive, down is neg.[/code]

User avatar
SimpleMynd_01
a lesser mummy
a lesser mummy
Posts: 71
Joined: Thu May 08, 2003 3:16 pm

Post by SimpleMynd_01 » Wed Jul 09, 2003 11:21 am

Kint, those aren't really parms for the if statement as much as they are parms for the $distance function.

From the MQ manual:
$distance(y,x)
Returns the distance to a location
Without all the fancy computations, it would just look like

Code: Select all

if n $distance(y,x)>3
Hope that helps.

-SimpleMynd

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

Post by Kint » Wed Jul 09, 2003 11:32 am

ohhh of cource, thanks.

User avatar
Kint
a hill giant
a hill giant
Posts: 208
Joined: Thu Mar 13, 2003 3:36 am

Post by Kint » Wed Jul 09, 2003 6:56 pm

how many && operators can you shove into one /if statement?

User avatar
BlueSkies
a ghoul
a ghoul
Posts: 132
Joined: Tue Oct 01, 2002 6:22 pm

Post by BlueSkies » Wed Jul 09, 2003 9:51 pm

hehe, fairly certain there are no AND or OR operators in the macroquest /if statements.

Ran a test to confirm that...

Here's what you do if you have a situation that requires an AND:

Code: Select all

/if thing1==1 {
    /if thing2==2 {
        /dosomething
    }
}
Pretty simple -- but if you need an OR, it gets just a little bit more complicated:

Code: Select all

/varset l0 0
/if thing1==1 /varset l0 1
/if thing2==2 /varset l0 1

/if $l0==1 /dosomething
$l0 can be anything -- you can see how that works, though, right?
Live your dreams! Blue Skies everyone

Valerian
a grimling bloodguard
a grimling bloodguard
Posts: 709
Joined: Sun Jul 28, 2002 3:29 am

Post by Valerian » Wed Jul 09, 2003 11:02 pm

&& and || were implimented at one point, but I think they were always buggy... not going to dig into the source right now to find out.