Issues

A forum for macro code snippets to be used in writing other macros. Post routines or .inc files here only, completed macros go to the Macro Depot.

Moderator: MacroQuest Developers

javelinl
a lesser mummy
a lesser mummy
Posts: 70
Joined: Thu Mar 11, 2004 12:40 pm

Issues

Post by javelinl » Thu Apr 22, 2004 10:21 pm

Ok,

The spellcast.inc I have works at work, and not here. A bit annoying. I started just re editing it and ran into some other problems.

Ok, I seem to have issues with { parsing on /if

Can someone tell me me the problem with this code?



From how it looks to me, it should evaluate the compare, and not do any of the code in the { }
However, it doesn't run the first line, and runs all the next lines. What am I doing wrong?




Code: Select all


Sub Main
/declare MyVar global 




/if (${String[@MyVar].Equal["Test1"]}) /echo hello1
/varset MyVar "Smurf"
/echo @MyVar
/if (${String[@MyVar].Equal["Test1"]}) { /echo hello
/echo hello2
/echo hello23
/echo here3
   } 

/return

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

Post by RudeBoy » Fri Apr 23, 2004 8:19 am

Hmm my first time here, but it seems you are trying to check a string on a variable you havent given any value yet.
Sub Main
/declare MyVar global




/if (${String[@MyVar].Equal["Test1"]}) /echo hello1 /*should give you "smurf"
/varset MyVar "Smurf"
/echo @MyVar
/if (${String[@MyVar].Equal["Test1"]}) { /echo hello2

/echo hello23
/echo here3
}

/return
Not sure since i never used this language before but, try this

Sub Main
/declare MyVar global
/varset MyVar "Smurf"


/if (${String[@MyVar].Equal["Test1"]}) /echo hello1 /* should give you "Smurf"
/echo @MyVar

/varset Myvar "Test1"
/if (${String[@MyVar].Equal["Test1"]}) /echo hello2 /*should give you hello2
/echo @MyVar
/return

But this is my first time here so might be very wrong

javelinl
a lesser mummy
a lesser mummy
Posts: 70
Joined: Thu Mar 11, 2004 12:40 pm

Post by javelinl » Fri Apr 23, 2004 10:18 am

The problem I have is that { don't seem to be evaluating.

The first line is blocked (myvar doesn't exist). I even set the value for the next check (/varset MyVar "Smurf" ) and it correctly sees that the condition is not met, but it only fails to run the first line.

My expectation is that all code between the { } should not be run.

Is there a syntax issue?

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

Post by ml2517 » Fri Apr 23, 2004 10:29 am

You cannot put code on the same line after your opening brace {

I also believe you can't put code on the same line before your closing brace }

Try this below.

Code: Select all

Sub Main 
/declare MyVar global 

/if (${String[@MyVar].Equal["Test1"]}) /echo hello1 
/varset MyVar "Smurf" 
/echo @MyVar 
/if (${String[@MyVar].Equal["Test1"]}) {
    /echo hello 
    /echo hello2 
    /echo hello23 
    /echo here3 
}
/return 


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 » Fri Apr 23, 2004 11:39 am

correct. { must be the end of the line, and } must be the beginning of the line.

/if (${String[@MyVar].Equal["Test1"]}) { /echo hello2

looks like crap anyway with the /echo after the {
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0