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
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Thu Apr 08, 2004 9:47 am
Lax's new system has me completely lost I'm afraid. I could use some help converting some code segments into the new format, and that will hopefully give me a better idea of how to convert other segments.
Below are my current, parm versions:
Code: Select all
/varset targetarray(0) "$target(name,clean)"
/varset targetarray(1) $target(level)
/varset targetarray(2) $target(name)
/varset targetarray(3) $target(id)
Code: Select all
/if "$target(id)"!="@targetarray(3)" /goto :EndAF
Code: Select all
/if n $target(distance)<11 /if n $char(ability,"Bash")>0 /doability "Bash"
/if n $target(distance)<11 /if n $char(ability,"Kick")>0 /doability "Kick"
/if n $target(distance)<11 /if n $char(ability,"Disarm")>0 /doability "Disarm"
Any help would be appreciated.
-
loadingpleasewait
- a snow griffon

- Posts: 332
- Joined: Sat Sep 14, 2002 8:46 am
Post
by loadingpleasewait » Thu Apr 08, 2004 10:31 am
I'm lost too man.. Seems like a ton of information to soak in. I havnt even begun converting the 6 or so macros that I use constantly, not to mention my custom ui. I keep looking over the information posted on the new mqdata system and everytime I get more lost.
anyways, I need these same parms converted :)
-
smelly wang
- a lesser mummy

- Posts: 54
- Joined: Mon Jan 19, 2004 6:04 pm
Post
by smelly wang » Thu Apr 08, 2004 10:31 am
Code: Select all
${Target.Name}
${Target.Level}
|| is there one?
${Target.ID}
${Target.Distance}
/if ${Me.AbilityReady["Bash"]}
/if ${Me.AbilityReady["Kick"]}
/if ${Me.AbilityReady["Disarm"]}
i think...
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Thu Apr 08, 2004 10:39 am
${Target.Name}
${Target.CleanName}
...
Code: Select all
/newif ${Target.ID}!=@targetarray(3) /goto :EndAF
Code: Select all
/newif (${Target.Distance}<11)&&(${Me.AbilityReady["Bash"]}) /doability "Bash"
/newif (${Target.Distance}<11)&&(${Me.AbilityReady["Kick"]}) /doability "Kick"
/newif (${Target.Distance}<11)&&(${Me.AbilityReady["Disarm"]}) /doability "Disarm"
It's 4895743579853498 times easier as long as you're not used to the 100% ass way (also known as mq2parm)
-
loadingpleasewait
- a snow griffon

- Posts: 332
- Joined: Sat Sep 14, 2002 8:46 am
Post
by loadingpleasewait » Thu Apr 08, 2004 7:12 pm
I can see that it eventually may be easier, and appreciate that. Unfortunately though, I am used to the 100% ass way. Your examples are helping but its a large jump.
-
notetaker
- orc pawn

- Posts: 12
- Joined: Tue Feb 03, 2004 11:50 am
- Location: colorado
Post
by notetaker » Fri Apr 09, 2004 11:11 am
Lax, my friend;
i like the new way of coding, it reminds me of my high school years and listening to the football team...jk, it makes a lot more sence to me just like speaking with bad grammor.
could you give us a list of the new commands? or is the structue the only thing changed?
thanks i realy do like the work your doing
it is better to do something wrong
then to do nothing at all
the only way to not make mistakes
is to do nothing
I MUST BE DOING A LOT !
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Fri Apr 09, 2004 11:19 am
All new commands can be found in changes.txt (or consequently in MQ2::Announcements), but the only one directly related to MQ2Data is /newif.
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Sat Apr 10, 2004 11:48 am
Thanks Lax, makes more sense now. I guess it's just getting familiar with the new types (you have to admit there are a lot of them).
How would I do this?
Code: Select all
/if $target()=="TRUE" {dosomething}
Edit:
Ack, and one more:
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Sat Apr 10, 2004 12:28 pm
/newif ${Target.ID}
/newif ${Math.Rand[99]}>50
Note: ...int Rand[n]: Random number with range of n, meaning Rand[n]=0-(n-1). e.g. Rand[2] will give 0 or 1
(same as $rand)
You're asking for 0-98, so thats not quite 50% if thats what you're shooting for :)
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Sat Apr 10, 2004 2:50 pm
Okay, here's what I've got for the converted macro. Let me know if you see any obvious mistakes:
Code: Select all
#turbo
#Event Casting "You begin casting"
#Event Enraged "has become ENRAGED"
#Event Offrage "is no longer enraged"
#Event Gate "Gates"
sub Main
/zapvars
/mqpause chat off
/declare targetarray array
/declare MyXLOC global
/declare MyYLOC global
/declare ObstacleCount global
/declare InCombat global
/varset targetarray(0) ${Target.CleanName}
/varset targetarray(1) ${Target.Level}
/varset targetarray(2) ${Target.Name}
/varset targetarray(3) ${Target.ID}
/varset InCombat 0
/echo Fighting a level @targetarray(1) @targetarray(0)
/face fast nolook
/call MovetoMob
:CloserAF
/newif ${Target.ID}!=@targetarray(3) /goto :EndAF
/doevents
/if n @InCombat==1 /call AttackRoutine
/goto :CloserAF
:EndAF
/attack off
/echo The level @targetarray(1) @targetarray(0) is dead...
/keypress forward
/keypress back
/varset InCombat 0
/varset targetarray(3) 0
/mqpause chat on
/endmacro keep keys
sub AttackRoutine
/doevents
/newif ${Target.Distance}>10 {
/keypress forward hold
/timed 2 /keypress forward
}
/newif ${Target.Distance}<10 {
/keypress back hold
/timed 2 /keypress back
}
/newif ${Target.Distance}<15 /attack on
/newif ${Target.Distance}>15 {
/attack off
/call MovetoMob
}
/face nolook fast
/doevents
/newif (${Target.Distance}<11)&&(${Me.AbilityReady["Bash"]}) /doability "Bash"
/newif (${Target.Distance}<11)&&(${Me.AbilityReady["Kick"]}) /doability "Kick"
/newif (${Target.Distance}<11)&&(${Me.AbilityReady["Disarm"]}) /doability "Disarm"
/return
sub MoveToMob
/varset MyXLOC $char(x)
/varset MyYLOC $char(y)
/varset ObstacleCount 0
/newif ${Target.Distance}<=15 {
/face nolook
/varset InCombat 1
/return
}
/doevents
/keypress forward hold
:Movementloop
/varadd ObstacleCount 1
/newif ${Target.ID} {
/face nolook
/newif (${Target.ID})&&(${Target.Distance}<=10) {
/face nolook
/keypress forward
/varset InCombat 1
/return
}
/if @ObstacleCount>=3 {
/call CheckObstacle
/goto :Movementloop
}
/newif (${Target.ID})&&(${Target.Distance}>10) /goto :MovementLoop
}
/return
sub CheckObstacle
/newif (@MyXLOC==${Me.X}&&(@MyYLOC==${Me.Y}) /call HitObstacle
/varset MyXLOC ${Me.X}
/varset MyYLOC ${Me.Y}
/varset ObstacleCount 0
/return
sub HitObstacle
/keypress forward
/keypress back hold
/delay 3
/keypress back
/if ${Math.Rand[2]}=0 {
/keypress strafe_right hold
} else {
/keypress strafe_left hold
}
/delay 5
/keypress strafe_right
/keypress strafe_left
/keypress forward hold
/return
sub Event_Enraged
/newif ${Target.ID} {
/attack off
/varset InCombat 0
:EnrageDelay
/newif (${Target.ID})&&(@InCombat==0) {
/doevents
/goto :EnrageDelay
}
}
/return
sub Event_Offrage
/newif ${Target.ID} {
/varset InCombat 1
/attack on
}
/return
sub Event_Casting
:checkcast
/delay 1
/newif ${Me.Casting} /goto :checkcast
/return
sub Event_Gate
/keypress forward
/keypress back
/attack off
/mqpause chat on
/endmacro
/return
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Sat Apr 10, 2004 3:14 pm
Looks fine as far as mq2data is concerned. Other syntax or algorithms im not looking at, but here's a small suggestion
Code: Select all
:Movementloop
/varadd ObstacleCount 1
/newif ${Target.ID} {
/face nolook
/newif (${Target.ID})&&(${Target.Distance}<=10) {
/face nolook
/keypress forward
/varset InCombat 1
/return
}
/if @ObstacleCount>=3 {
/call CheckObstacle
/goto :Movementloop
}
/newif (${Target.ID})&&(${Target.Distance}>10) /goto :MovementLoop
}
The one thing I noticed is the usage of ${Target.ID}&&.. inside the /newif that ONLY executes if there is ${Target.ID} :)
Might as well just do /newif ${Target.Distance}>10 etc imho
thats about it
-
Mckorr
- Developer

- Posts: 2326
- Joined: Fri Oct 18, 2002 1:16 pm
- Location: Texas
Post
by Mckorr » Sat Apr 10, 2004 5:59 pm
No, that's correct, it should only execute if there is a target ID. That's in case the mob is killed during the movement loop and you cease to have a target.
The original loop checked to see if $target()=="FALSE". Here I simply combined the two ifs, so we have two possible conditions, Target && Distance<=10, and Target && Distance>10. Any other condition (no target) should cause the checks to fail and exit the whole loop/routine.
Eh, long winded. I did it that way in case the mob was killed at an inconvenient time in the process. The redundancy was intentional.
-
daerck
- a ghoul

- Posts: 134
- Joined: Mon Jan 12, 2004 8:44 pm
Post
by daerck » Sat Apr 10, 2004 8:32 pm
Wouldn't ${Target.Distance} evaluate to NULL anyways if there was no target?
-
Lax
- We're not worthy!

- Posts: 3524
- Joined: Thu Oct 17, 2002 1:01 pm
- Location: ISBoxer
-
Contact:
Post
by Lax » Sat Apr 10, 2004 11:37 pm
yes.