Noob need help

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

RudeBoy
orc pawn
orc pawn
Posts: 23
Joined: Wed Mar 24, 2004 7:04 am

Noob need help

Post by RudeBoy » Mon Apr 26, 2004 7:52 am

Hello!

I just started to learn MQ, and then theres a change in syntax. Since i havent found any macro thats following the new way too the fullest, i would like some help with syntax.

Most of the time im writing my macros, i dont have any EQ to use and debugg them, therefore i could use some help with the syntax.

Dont bother with the paranthentis, what i wonder is how to syntax work.

Code: Select all

/* The old way

Sub Main

/declare IamBad global
/declare MyCrapArray Array
/declare ArrayCore global
/declare counter global

/varset IamBad 1
/varset MyCrapArray(0) 00
/varset MyCrapArray(1) 10
/varset MyCrapArray(2) 20
/varset MyCrapArray(3) 30
/varset MyCrapArray(4) 40
/varset MyCrapArray(5) 50
/varset ArrayCore 5

/if (@IamBad==1){
  /for counter 0 to @ArrayCore
    /if (${Time.Minute}==@MyCrapArray(@counter)) {
     /echo "it worked!!"
    }
    else {
	/echo "crap, wrong minut"
	/Delay 30s
   	/next counter
        }
}
/return
/endmacro

Now same code, but im trying the NEW WAY! What im interested in is if the syntax is used right for /if /for and calling/checking Arrays and variables.

Code: Select all

/* The new way

Sub Main

/declare IamBad int outer
/declare ArrayCore int outer
/declare counter int outer
/declare MyCrapArray[6] int 


/varset IamBad 1
/varset MyCrapArray[1] 00
/varset MyCrapArray[2] 10
/varset MyCrapArray[3] 20
/varset MyCrapArray[4] 30
/varset MyCrapArray[5] 40
/varset MyCrapArray[6] 50
/varset ArrayCore 6

/if (${IamBad }==1){
  /for counter 1 to ${ArrayCore}
    /if (${Time.Minute}==${MyCrapArray}[${counter}]) {
      /echo "It worked"
}
    else {
	/echo "Crap, wrong minut"
	/Delay 30s
   	/next counter
        }
  }
/return
/endmacro

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 » Mon Apr 26, 2004 1:26 pm

Looks about right, but there's a couple nitpicky things the parser wont like and an obvious problem in another line

/if (${IamBad }==1){
Get rid of the space after IamBad, and put a space before the {
/if (${IamBad}==1) {

/if (${Time.Minute}==${MyCrapArray}[${counter}]) {
you're evaluating ${MyCrapArray} before trying to get the index. This is going to result in a parsing error evaluating the /if conditions. Move the array indexing inside the array's ${}.
/if (${Time.Minute}==${MyCrapArray[${counter}]}) {

changing those should make it work just fine
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

RudeBoy
orc pawn
orc pawn
Posts: 23
Joined: Wed Mar 24, 2004 7:04 am

Post by RudeBoy » Mon Apr 26, 2004 5:08 pm

Thanks Lax - exactly what i needed to know. Now back on coding :D