Nested /if parsing.

A forum for reporting bugs NOT related to custom plugins.

Moderator: MacroQuest Developers

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Nested /if parsing.

Post by NotHere » Wed Mar 31, 2004 2:43 pm

Hi.

It seems that nested /if parsing have been changed, and are bugged atm? Not sure when this changed, but it worked differently before the DX9 patch. Havent tried it before the 20040330 version, and there this issued occured. I am running with both MQ2DATATYPES and MQ2PARAMS enabled.

The following is a modified piece from a macro Im working on, thats been changes slightly so it can run by itself.

Code: Select all

| *** Defines for DurSpells array
#define DurSpellName 0
#define DurItemName 1
#define DurCastNext 2
#define DurMaxHealth 3


Sub Main    
  /declare DurSpells array2

  /varset DurSpells(0,DurSpellName) "Tempest Wrath"
  /varset DurSpells(0,DurItemName) "Blade of the Tempest"
  /varset DurSpells(0,DurMaxHealth) 0

  /varset DurSpells(1,DurSpellName) "Swarming Death"
  /varset DurSpells(1,DurMaxHealth) 16  

  /varset DurSpells(2,DurSpellName) "E'ci's Frosty Breath"
  /varset DurSpells(2,DurMaxHealth) 8

  /call TestEvent  
/return
  
Sub TestEvent
  /declare i local
  /declare Para0 local

  /varset Para0 "Your Swarming Death spell has worn off."
  
  /for i 0 to 9
    /if "@DurSpells(@i,DurSpellName)"~~"UNDEFINED" /return
    /echo Checking spell (@i)
    [color=red]/if "@Para0"~~"@DurSpells(@i,DurSpellName)" [/color]{
      [color=red]/echo Spell (@i) matched![/color]
      /if n ${Target.PctHPs}>@DurSpells(@i,DurMaxHealth) {
        [color=red]/varset DurSpells(@i,DurCastNext) TRUE[/color]
        /echo @DurSpells(@i,DurSpellName) faded, and will be renewed.
      } else {
        /echo @DurSpells(@i,DurSpellName) faded, but will not be renewed.
      }
    }
  /next i
/return
Consider the three lines in red. The problem when running this piece is that the /echo line is only executed when the comparison right above is matched. However, the /varset is executed on all three runs through the loop.

Am I using the nesting incorrectly, or is it bugged?

This is still an issue with .zip from March 31 2004 08:46:39.

EDIT: If running this as a test, target yourself and have more than 16% of your HPs, otherwise you will not match the comparison made for target HPs.
NotHere
/afk

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 Mar 31, 2004 3:01 pm

Post the complete output from this macro.

Here's what I would expect:

Code: Select all

Checking spell (0)
Checking spell (1)
Spell (1) matched!
Swarming Death faded, and will be renewed.
Checking spell (2)

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

Post by ml2517 » Wed Mar 31, 2004 3:28 pm

Code: Select all

*pulls head out of his ass*
Last edited by ml2517 on Wed Mar 31, 2004 3:49 pm, edited 1 time in total.

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 Mar 31, 2004 3:37 pm

He said he has both enabled
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

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

Post by ml2517 » Wed Mar 31, 2004 3:39 pm

Lax wrote:He said he has both enabled
I have become better at reading (66)!

Maybe he's overlooking the fact that he doesn't have them in the actual "test" code he's messing with. I guess in addition to the output DKAA asked for, post the entire piece of code you are testing.

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Post by NotHere » Wed Mar 31, 2004 3:42 pm

dont_know_at_all wrote:Post the complete output from this macro.
I expected the same as you, but what I actually get is:

Code: Select all

Checking spell (0)
Tempest Wrath faded, and will be renewed
Checking spell (1)
Spell (1) matched
Swarming Death faded, and will be renewed
Checking spell (2)
Eci's Frosty Breath faded, and will be renewed
Thats if I have myself targetted. If I have a clear target, I get:

Code: Select all

Checking spell (0)
Tempest Wrath faded, and will be renewed
Checking spell (1)
Spell (1) matched
Swarming Death faded, but will not be renewed
Checking spell (2)
Eci's Frosty Breath faded, and will be renewed
But by all means, try running it. :)

It can run alone as is.
NotHere
/afk

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Post by NotHere » Wed Mar 31, 2004 3:43 pm

ml2517 wrote:
Lax wrote:He said he has both enabled
I have become better at reading (66)!

Maybe he's overlooking the fact that he doesn't have them in the actual "test" code he's messing with. I guess in addition to the output DKAA asked for, post the entire piece of code you are testing.
I wasnt aware that I had to add the types here as well.

I have enabled them both in mq2main.h, this isnt enough?

The code above is the complete test code, and can run as is to test the issue
NotHere
/afk

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

Post by ml2517 » Wed Mar 31, 2004 3:44 pm

Hmm I was thinking you had to do that in the macro's themselves as well. I haven't really messed with it yet so I'm probably full of shit (tm).

Just went back and re-read the info, looks like you can ignore the comment above.

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 Mar 31, 2004 5:47 pm

/if is broken, apparently.

The } else { is matching the first /if and not the second one.

FailIf is using strstr to count "{" and "}", which is wrong. Working on a fix...

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 Mar 31, 2004 6:49 pm

Fixed. MQ2-20040331b.
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0

NotHere
a lesser mummy
a lesser mummy
Posts: 40
Joined: Fri Jan 09, 2004 5:59 am

Post by NotHere » Wed Mar 31, 2004 11:40 pm

Lax wrote:Fixed. MQ2-20040331b.
/cheer!
NotHere
/afk