/if command problem

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

Mister Peepers
a lesser mummy
a lesser mummy
Posts: 46
Joined: Mon Apr 19, 2004 8:10 pm

/if command problem

Post by Mister Peepers » Wed Apr 21, 2004 6:29 pm

Before todays patch I was using the /newif command, I went through and changed them all back to /if.

Now I keep geting Ending Macro: Failed to parse /if command

This is the code it says is giving me the problem

Code: Select all

     /if (${Target.ID}!=0) 
also I am having a problem with this having it comes back null at the /echo command and having <0 be greater then the var

Code: Select all

   /call ArraySize Mob 
   /varset MobArraySize /return 
   /if MobArraySize<0) 
   { 
    /echo Nothing specified to hunt! (you do know what this script is supposed to do, right?) 
    /endmacro 
   } 
   /echo Mob list has ${Math.Calc[@MobArraySize+1]} entries
Any help would be aprciated (sp)
Thank You

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 » Wed Apr 21, 2004 6:35 pm

#1 you have to put the { at the end of the /if or /newif line (this part isnt new)
#2 make sure you have the newest zip where the top of changes.txt says this:

Code: Select all

21 Apr 2004 by Lax:
- Fixed if/newif
(20040421b)

Code: Select all

   /call ArraySize Mob
   /varset MobArraySize /return
   /if MobArraySize<0) {
    /echo Nothing specified to hunt! (you do know what this script is supposed to do, right?)
    /endmacro
   }
   /echo Mob list has ${Math.Calc[@MobArraySize+1]} entries
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Mister Peepers
a lesser mummy
a lesser mummy
Posts: 46
Joined: Mon Apr 19, 2004 8:10 pm

Post by Mister Peepers » Wed Apr 21, 2004 6:53 pm

Thnx re-downloaded and recompiled going to test it now.

The reason the { was on the next line was because macroquest bitched about it being there.

unclebean
decaying skeleton
decaying skeleton
Posts: 4
Joined: Fri Dec 05, 2003 12:14 pm

Post by unclebean » Wed Apr 21, 2004 7:01 pm

still having problems with this line, even with the newest zip from the DL page :?

Code: Select all

if $defined(p0)==false { 
    /echo usage: /mac twisting.mac song1 song2 song3 song4 
    /end 
  } 

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 » Wed Apr 21, 2004 7:03 pm

as you should.

Firstly, the old parm system is replaced, and secondly it needs () in the if

Code: Select all

/if (${Defined[p0]}==false) {
/echo usage: /mac twisting.mac song1 song2 song3 song4
/end
}
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Mister Peepers
a lesser mummy
a lesser mummy
Posts: 46
Joined: Mon Apr 19, 2004 8:10 pm

Post by Mister Peepers » Wed Apr 21, 2004 7:17 pm

I am now having a problem with a macroquest saying

Ending Macro: Flow ran into another subroutine


This is the code it called using the /call ArraySize varname and then stoped so I called it manuals and my guess is causing the error above.

Code: Select all

Sub ArraySize(IncArray) 
/declare ArrSize local 
/declare ArrayCounter local 
/if (${Defined[IncArray]}!=0) { 
  /varset ArrSize 0 
   /for ArrayCounter 0 to 1 step 0 { 
    /if (${String.Equal[@@IncArray(@ArrSize)==UNDEFINED-ARRAY-ELEMENT]}) { 
     /return @ArrSize-1 
    } 
    /varadd ArrSize 1 
   /next ArrayCounter 
   } 
} 
/return -1 

unclebean
decaying skeleton
decaying skeleton
Posts: 4
Joined: Fri Dec 05, 2003 12:14 pm

Post by unclebean » Wed Apr 21, 2004 7:23 pm

Sorry, didn't know the extent to how much the system has changed. In the macro below, p0-p3 are just integers representing a song # in spell list. Am trying to figure how to edit the if statements to work properly with the new system. I get numeric errors with the if false statements.

if there's something i could read to make figuring this out easier, just point me that way :)

Also confused to the code structure of the portion in red.

Code: Select all

#event MissedNote "You miss a note, bringing your song to a close!" 
#event Recovered  "You haven't recovered yet..." 
#event Cantsee "You cannot see your target" 
#event Hitbymob "hits for" 
#turbo 

Sub Main(p0,p1,p2,p3) 
/zapvars 
/declare a array                    
/declare nsongs global              
/declare cursong global              
/declare t0 timer 
/declare v6 local 
/declare notarg global 
  /if ($defined(p0)==false) { 
    /echo usage: /mac twisting.mac song1 song2 song3 song4 
    /end 
  } 
  /varset nsongs 1 
  /varset a(1) @p0   | First song 
  /echo Song 1: $char(gem,@p0) 

  /if ($defined(p1)!=false) { 
            /varadd nsongs 1 
            /varset a(2) @p1 
            /echo Song 2: $char(gem,@p1) 
      } 
  /if ($defined(p2)!=false) { 
            /varadd nsongs 1 
            /varset a(3) @p2 
            /echo Song 3: $char(gem,@p2) 
  } 
  /if ($defined(p3)!=false) { 
            /varadd nsongs 1 
            /varset a(4) @p3 
            /echo Song 4: $char(gem,@p3) 
  } 

  /varset cursong 0              
  /varset t0 1 

:Loop 
  /if (n @t0<=0) { 
    /stopsong 
    /delay 1 
    /varset t0 32 
    /varadd cursong 1 
    [color=red]/if (n @cursong>@nsongs) /varset cursong 1 
|    /echo starting song @a(@cursong) [/color]   
    /cast @a(@cursong) 
    /delay 2 
    } 

  /delay 3 
  /doevents 
  /delay 2 
/goto :Loop 

/return 


Sub Event_MissedNote 
  /varcalc cursong @cursong-1        
  /varset t0 0 
/return 

|Sub Event_Cantsee 
|  /echo "Cant see target yo." 
|  /varcalc cursong @cursong-1    
|  /varset t0 0 
|/return 

Sub Event_Recovered 
  /varcalc cursong @cursong-1        
  /varset t0 0 
/return 

|Sub Event_Hitbymob 
|  /echo "Yo a mob hit you" 
|  /stop 
|  /alt activate 212 
|  /end 
|/return
Last edited by unclebean on Wed Apr 21, 2004 7:39 pm, edited 1 time in total.

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

Post by ml2517 » Wed Apr 21, 2004 7:26 pm

Whoever converted that butchered the hell out of it. Post the pre-converted version of it.

Talking about this:

Code: Select all

Sub ArraySize(IncArray) 
/declare ArrSize local 
/declare ArrayCounter local 
/if (${Defined[IncArray]}!=0) { 
  /varset ArrSize 0 
   /for ArrayCounter 0 to 1 step 0 { 
    /if (${String.Equal[@@IncArray(@ArrSize)==UNDEFINED-ARRAY-ELEMENT]}) { 
     /return @ArrSize-1 
    } 
    /varadd ArrSize 1 
   /next ArrayCounter 
   } 
} 
/return -1 

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 » Wed Apr 21, 2004 7:28 pm

this ones a gem
(${String.Equal[@@IncArray(@ArrSize)==UNDEFINED-ARRAY-ELEMENT]})

i dont even know what to say on that one...
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

Mister Peepers
a lesser mummy
a lesser mummy
Posts: 46
Joined: Mon Apr 19, 2004 8:10 pm

Post by Mister Peepers » Wed Apr 21, 2004 7:43 pm

I saw my problem and I fixed it to now reads

/if (${String[@@IncArray(@ArrSize)].Equal[UNDEFINED-ARRAY-ELEMENT]})

I think thats correct now.

User avatar
dont_know_at_all
Developer
Developer
Posts: 5450
Joined: Sun Dec 01, 2002 4:15 am
Location: Florida, USA
Contact:

Post by dont_know_at_all » Wed Apr 21, 2004 8:07 pm

Damn, and I thought ${Defined[...]} was the shit.