Problem with distance

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

Moderator: MacroQuest Developers

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Problem with distance

Post by driftinsupra » Sun Sep 21, 2003 9:34 pm

Ok this script worked perfectly untill I downloaded the latest zip file but now I am having a small problem

Code: Select all

:distanceloop
  /if n $target(distance)>=200 {
     /delay 10
     /goto :distanceloop
     }
this is just one instance where this is being tricky...the section is suppose to wait till the mob is with casting distance then stands me up and casts on it. It worked fine but I download the latest zip today and now I stand up far before the mob is in the casting range. Anything change that I dont know about?

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Sun Sep 21, 2003 11:10 pm

anyone?

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Sep 22, 2003 10:16 am

Not sure why you structured the loop that way. /if statements in MQ can be kinda finicky.

Code: Select all

:distanceloop
/delay 5
/if n $target(distance) > 199 /goto :distanceloop
A simpler loop, without having to worry about multiple commands nested in the if statement.
MQ2: Think of it as Evolution in action.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Sep 22, 2003 12:35 pm

hmmm...will give that a shot

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Sep 22, 2003 12:58 pm

ok I tried that I still got nothing. Somethin did pop up that I didnt notice before, it may have been there when I had the loop the other way but there isw so much battle spam that ididnt notice. As it foes into the loop I get the error :

Couldnt find a comparison operator in 77

This doesnt make sence to me because the distance is much larger then 77 when it breaks out of the if statement loop. There is no comparison that I have that is involving the number 77. He is a larger portion of my script:

Code: Select all


sub lEFTBack
  /call gotoloc -205,-1596
  /call gotoloc -83,-1695 
  /delay 10 
  /if $taget(name)=="NULL" {
     /call gotoloc -205,-1596
     /goto :spawngone
     }
  /call cast "Dooming Darkness"
  /call gotoloc -205,-1596
  /delay 10
  /call cast "Splurt"
  /call gotoloc -270,-1591
  /if $taget(name)=="NULL" {
     /goto :spawngone
     }
  /call gotoloc -579,-1261
  /sit
  :catchloop
  /delay 10
  /if n $target(distance) > 100 /goto :catchloop
  /stand
  /if $taget(name)=="NULL" {
     /goto :spawngone
     } 
  /pet attack
  /call cast "Invoke Fear"
  /call cast "Envenomed Bolt"
  /call gotoloc -518,-1263
  /delay 10
  /call cast "Dooming Darkness"
  /sit
  :deadloop
  /if n $target(hp,pct)!=0 {
     /delay 10
     /goto :deadloop
     }
  /delay 50
  /stand

The thing that bugs me most is that it worked before I got the new zip.

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

Extra spaces?

Post by SimpleMynd_01 » Mon Sep 22, 2003 1:23 pm

Isn't this,

Code: Select all

/if n $target(distance) > 100 /goto :catchloop 
Supposed to look like this?

Code: Select all

/if n $target(distance[color=red][/color])>100 /goto[color=#FFFFFF][/color] :catchloop 
-SimpleMynd

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Sep 22, 2003 2:30 pm

The 77 refers to a line number.
MQ2: Think of it as Evolution in action.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Sep 22, 2003 2:41 pm

Would it matter? I cant chek it now but thats the Mckorr showed in his example.

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Mon Sep 22, 2003 3:02 pm

Spaces matter. Right now, the parser splits the line on spaces first. The conditional ($var>x) is one token. If there are spaces between the pieces, it goes bonkers.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Sep 22, 2003 3:31 pm

Tried that and it still doesnt work...this is what I have for my script. Ididnt notice the error but I still got thrown right out of the loop

Code: Select all

Sub Wanderer 
  /call gotoloc -271,-1593
  /sit
  :distanceloop
  /delay 10
  /if n $target(distance)>199 /goto :distance loop
  /stand
  /if $taget(name)=="NULL" {
     /goto :spawngone
     }
  /call cast "Dooming Darkness"
  /call gotoloc -468,-1541
  /delay 10
  /if $taget(name)=="NULL" {
     /goto :spawngone
     }
  /call cast "Splurt"
  /call gotoloc -468,-1272
  /call gotoloc -579,-1261
  /sit
  :catchloop
  /delay 10
  /if n $target(distance)>100 /goto :catchloop
  /stand
  /if $taget(name)=="NULL" {
     /goto :spawngone
     }
  /pet attack
  /call cast "Invoke Fear"
  /call cast "Envenomed Bolt"
  /call gotoloc -518,-1263
  /delay 10
  /call cast "Dooming Darkness"
  /sit
  :deadloop
  /if n $target(hp,pct)!=0 {
     /delay 10
     /goto :deadloop
     }
  /delay 50
  /stand
Did something change in the way /if statements work since the first mq that was working after the spetember patch? It wokred fine until I got the latest mq.

Mckorr
Developer
Developer
Posts: 2326
Joined: Fri Oct 18, 2002 1:16 pm
Location: Texas

Post by Mckorr » Mon Sep 22, 2003 5:36 pm

One thing I see right off the bat is spelling "target" "taget" in several places. Assuming you copied and pasted this are you sure it's not just a spelling error causing it to choke?

Code: Select all

Sub Wanderer
  /call gotoloc -271,-1593
  /sit
  :distanceloop
  /delay 10
  /if n $target(distance)>199 /goto :distance loop
  /stand
  /if $target(name)=="NULL" /goto :spawngone
  /call cast "Dooming Darkness"
  /call gotoloc -468,-1541
  /delay 10
  /if $target(name)=="NULL" /goto :spawngone
  /call cast "Splurt"
  /call gotoloc -468,-1272
  /call gotoloc -579,-1261
  /sit
  :catchloop
  /delay 10
  /if n $target(distance)>100 /goto :catchloop
  /stand
  /if $target(name)=="NULL" /goto :spawngone
  /pet attack
  /call cast "Invoke Fear"
  /call cast "Envenomed Bolt"
  /call gotoloc -518,-1263
  /delay 10
  /call cast "Dooming Darkness"
  /sit
  :deadloop
  /delay 10
  /if n $target(hp,pct)!=0 /goto :deadloop
  /delay 50
  /stand
A number of other problems. First, where is the label :spawngone? You can't go to it if it doesn't exist. You might want to try

Code: Select all

  /if $target(name)=="NULL" /return
Second, there's no endpoint to the sub. You need to end it with either /return or /endmacro. I'm assuming you call this function from another sub, so there should be /return on the end.
MQ2: Think of it as Evolution in action.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Sep 22, 2003 6:11 pm

I didnt post the whole su routine since there is mob names and my name in there in a few spots so it wasnt really necissary...the :goto for spawn gone is near the end of the routine

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Mon Sep 22, 2003 6:37 pm

Still doesnt work...This is my script now...I went through and changed all the $taget to $target and I still got nothin. This is the completer routine.


Code: Select all

Sub Wanderer 
  /call gotoloc -271,-1593
  /sit
  :distanceloop
  /delay 10
  /if n $target(distance)>199 /goto :distance loop
  /stand
  /if $target(name)=="NULL" {
     /goto :spawngone
     }
  /call cast "Dooming Darkness"
  /call gotoloc -468,-1541
  /delay 10
  /if $target(name)=="NULL" {
     /goto :spawngone
     }
  /call cast "Splurt"
  /call gotoloc -468,-1272
  /call gotoloc -579,-1261
  /sit
  :catchloop
  /delay 10
  /if n $target(distance)>100 /goto :catchloop
  /stand
  /if $target(name)=="NULL" {
     /goto :spawngone
     }
  /pet attack
  /call cast "Invoke Fear"
  /call cast "Envenomed Bolt"
  /call gotoloc -518,-1263
  /delay 10
  /call cast "Dooming Darkness"
  /sit
  :deadloop
  /if n $target(hp,pct)!=0 {
     /delay 10
     /goto :deadloop
     }
  /delay 50
  /stand
  /target "Legionnaire Toralitides's corpse"
  /target "Legionnaire Perticon's corpse"
  :corpseloop
  /face
  /call autorun 1
  /if n $target(distance)>16 /goto :corpseloop
  /loot
  /delay 20
  :lootloop
  /mouseto corpse $lootnum
  /click left
  /delay 5 
  /if $cursor(id)!="NULL" {
     /echo $cursor(id)
     /if n $cursor(id)==14866 {
        /click left destroy
        }
     /if n $cursor(id)==14865 {
        /click left destroy
        }
     /if n $cursor(id)==31748 {
        /click left destroy
        }
     /if n $cursor(id)==14864 {
        /click left destroy
        }
     /if n $cursor(id)==10755 {
        /click left destroy
     } else {
        /click left auto
     }
     /delay 5
     /varadd lootnum 1
     /goto :lootloop
     }
  
  /call autorun 0
  /click left corpse done
  /delay 10
  :spawngone
  /call gotoloc -365,-1561
  /sit
  /return

EqMule
Developer
Developer
Posts: 2697
Joined: Fri Jan 03, 2003 9:57 pm
Contact:

Post by EqMule » Mon Sep 22, 2003 7:42 pm

ok I dont write macros so im no expert, but I always thought if you did comparisons using "" you need that on both "sides" of it...

Code: Select all

/if $target(name)=="NULL" { 
should be

Code: Select all

/if "$target(name)"=="NULL" { 
but dont "quote" me on this, im not sure lol...
My status o/
If you like MQ2 and would like to contribute, please do. My goal is 25 donations per month.
So far I've received Image donations for this month's patches.

Bitcoin: 1Aq8ackjQ4f7AUvbUL7BE6oPfT8PmNP4Zq
Krono: PM me.
I can always use characters for testing, PM me if you can donate one.

User avatar
driftinsupra
Official loudmouth
Official loudmouth
Posts: 212
Joined: Tue Jan 28, 2003 9:25 pm

Post by driftinsupra » Tue Sep 23, 2003 1:12 am

that makes sense but I am still having a problem with the distance...it doesnt really matter so much that I dont get to spawngone by the $target(name)=null thing. The part that is messin me up is $tafget(distance) loops...anyone know why those arent working for me?

Better yet...any have an older version of MQ right after the basics were working? When you had the release the mosue to get click to work?