Here is a tough problem

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

Moderator: MacroQuest Developers

quasit
orc pawn
orc pawn
Posts: 14
Joined: Sun Oct 27, 2002 11:51 am

Here is a tough problem

Post by quasit » Fri Nov 29, 2002 1:58 am

I am trying to target or roll through all targets of the same name, ex. a panther. When I type /target panther , it only shows me the closest one to me. How can I target the other ones.

I was reading the read me file and it looks like I might be able to do this with the target commands.

range <min> <max> limits matching to level range
radius <distance> limits matching to a distance away from you

how can i incorporate this into a macro. If i wanted to rotatel through every mob in the zone for example using the above filters.

Thanks so much,

Q

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Fri Nov 29, 2002 10:33 pm

Salutations,

Code: Select all

sub main
:pantherloop
 /target $p1 "$p0"
 /if $target()!=TRUE {
  /echo We ran out of $p0's to target... Exitting...
  /return
 }
 /echo $target(name,clean) is level $target(level) and $target(distance) clicks away.
 /varset p1 "$p1 notid $target(id)"
/goto :pantherloop
/return
this should work... *cough*( if it doesn't i know what's wrong... you can't do more then one notid's... i think... whateva' try this...

quasit
orc pawn
orc pawn
Posts: 14
Joined: Sun Oct 27, 2002 11:51 am

Post by quasit » Sat Nov 30, 2002 2:54 am

thanks for the help.

OK, i ran this in PoK and had guard in the $p0 spot. Now it was scrolling through the guards, but only like 2 of em. When I walked around it targeted others. I didnt think the radius was defined. Also, after about 2 min of working pretty good, it did kick me to desktop.

What can we tweek to have unlimited radius and no crashy to desktopy.

;)

Thanks L124RD, great effort

Q

User avatar
L124RD
Site Admin
Site Admin
Posts: 1343
Joined: Fri Jun 14, 2002 12:15 am
Location: Cyberspace
Contact:

Post by L124RD » Sat Nov 30, 2002 1:30 pm

Salutations,
I think the problem is that having more then one notid thingummy isn't working... try this and tell me what it outputs, the string should get longer and longer...

Code: Select all

sub main
:pantherloop
/target $p1$p0
/if $target()!=TRUE {
  /echo We ran out of $p0's to target... Exitting...
  /return
}
| /echo $target(name,clean) is level $target(level) and $target(distance) clicks away.
/varset p1 "$p1 notid $target(id)"
/echo $p1
/goto :pantherloop
/return

quasit
orc pawn
orc pawn
Posts: 14
Joined: Sun Oct 27, 2002 11:51 am

One more tweek

Post by quasit » Wed Dec 04, 2002 9:26 am

Ran it, it seems to be stuck between the first two mobs it sees and just goes back and forth between them.

Also it will target a corpse if there is one nearby, kinda annoying :)

I really think this is the route to go, but can't get it over the hump.

Thanks for the help.

Q

pablo
decaying skeleton
decaying skeleton
Posts: 3
Joined: Fri Dec 06, 2002 10:26 pm

Post by pablo » Fri Dec 06, 2002 10:37 pm

Hm, what about adding them all to an alert list as the loop enumerates, using their goofy names? Not sure if they would they be unique though - e.g. are there 2 a_frenzied_assclown21 in zone at once, if so you may skip one.

Then obviously you can /target noalert x and whatnot.

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

Post by Mutter » Sun Dec 15, 2002 11:49 am

Here is what I did, I changed the code from the hatelist example I "believe" Fippy did, this code cycles through all mobs in zone, anyone higher then me gets added to a avoidlist. This is part of my new Hunter.mac, made a revise one using a lot of other peoples code and a ton of my own to make a hunt script that is safe.

I will be posting it once I am done making it work for all classes. 8)

#define endlevel v65
sub makefearlist
/varset endlevel $int($char(level))
| Setup Alerts for Scary mobs here
/alert clear 4
/varset v1 0
| Loop to find first valid spawn
:ValidLoop
/varset v2 $spawn($v1,next)
/if n $v2==0 {
/varadd v1 1
/goto :ValidLoop
} else {
/varset v1 $v2
}

| Save off the first valid spawn found
/varset v3 $v1

:WalkSpawns
| Loop through all spawns to find a mach
/mqlog $v1

/if n $int($spawn($v1,level))>$int($endlevel) {
/if n $v1!=$char(id) {
/if "$spawn($v1,type)"=="NPC" {
/mqlog id $v1 $spawn($v1,name) is too high for us, avoiding $spawn($v1,level)
/alert add 4 npc radius 500 $v1
/echo adding $spawn($v1,name)
}

}
}
/varset v1 $spawn($v1,next)
/doevents
/if "$spawn($v1,name)"~~"NULL" /goto :donewalkin
/if n $v1!=$v3 /goto :WalkSpawns
:donewalkin
/mqlog finished checking all spawns
/alert add 4 npc radius 500 merchant
/alert add 4 npc radius 500 Eldak Howlingbear
/alert list 4
/return

Malachi
a hill giant
a hill giant
Posts: 227
Joined: Tue Nov 19, 2002 1:29 am
Contact:

You might want to

Post by Malachi » Sun Dec 15, 2002 1:57 pm

You might want to consider having avoid list levels be a variable, probably default = your level, however changeable by optional +1 +2 parameter, that way low level twinkies can slaughter those nasty yellows if they want to.

Of course, murdering blues non-stop w/ no downtime is better xp than solo yellow, wait, repeat.

I'm eager for this script, I'll probably add the twist.mac to it so my bard can get full benefit.

~Malachi
~Oh danny boy, the pipes the pipes are calling.~

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

Good idea

Post by Mutter » Sun Dec 15, 2002 9:33 pm

Bard twist would be great in there, frankly only thing stopping me from releasing this is the fact that I cannot get ANY routines to work for memming spells. even non-modified ones off the board dont do shit.

Ahh well. This is the most fun I've had coding in years. Also re-wrote the poweerarrows macro so it works.

*shrug*

Everyone else takes the real good ideas. heheh

lifewolf
a ghoul
a ghoul
Posts: 143
Joined: Fri Oct 18, 2002 6:29 pm

Post by lifewolf » Mon Dec 16, 2002 11:27 am

Using the number at the end of the spawn name.

Code: Select all


Sub FindOrcPawn
   /varset l0 0
   /for l0 to 99  
      /target "orc pawn$l0"
      /if "$target(name)"!="NULL" /echo $target(name) -- $target(distance)ft.
    /next l0
   /echo All spawns matching orc pawn[nn] reported.
/return

By radius

Code: Select all


#turbo

Sub OrcPawnByDistRadius
   /press Escape
   /varset l0 0
   :NextPawn
   /tar radius $l0 100000 "orc pawn"
   /if "$target(name)"=="NULL" /goto :NoPawns
   /if "$target(name)"!="NULL" {
      /if "$target(name)"=="NULL" /goto :NoPawns
      /echo $target(name) -- $target(distance)ft.
      /varcalc $l0 $target(distance)+0.01
      /goto :NextPawn
   }

:NoPawns
   /echo End of OrcPawn spew.
   /return

Edit: Fixed stuff, edited stuff, try it now ...
Last edited by lifewolf on Mon Dec 16, 2002 10:26 pm, edited 2 times in total.

Mutter
a ghoul
a ghoul
Posts: 105
Joined: Sat Nov 16, 2002 1:09 pm

Lazy code`

Post by Mutter » Mon Dec 16, 2002 2:22 pm

no... the search engine just sucks

Vendor001
Cheezily Banned
Cheezily Banned
Posts: 78
Joined: Wed Nov 13, 2002 1:37 pm

Search engine not tailored for slash-commands

Post by Vendor001 » Mon Dec 16, 2002 3:31 pm

From a "working" script I found using search, it appears the following /for-/next code should work:

Code: Select all

Sub FindOrcPawn 
  /varset v10 1 
  /for v10 to 99  
    /target orc_pawn$10  | Anyone know if this is valid?  Doesn't seem to be.
    /if "$target(name)"!="NULL" /echo $target(name) -- $target(distance)ft. -- $target(Whatever_Else) 
    /next v10 
  /echo All spawns matching orc_pawn/?n/?n reported. 
/return 
btw, did you mean to put |0 instead of 10? Don't quite see how commenting out the rest of the line will make it work...

lifewolf
a ghoul
a ghoul
Posts: 143
Joined: Fri Oct 18, 2002 6:29 pm

Re: Search engine not tailored for slash-commands

Post by lifewolf » Mon Dec 16, 2002 10:06 pm

Vendor001 wrote:From a "working" script I found using search, it appears the following /for-/next code should work:

Code: Select all

Sub FindOrcPawn 
  /varset v10 1 
 ...
/return 
btw, did you mean to put |0 instead of 10? Don't quite see how commenting out the rest of the line will make it work...
Was actually late for class. The only $v anything that is supposed to use is $l0 ($L0, local variable 0)

Fixed my above post as best I could. It may work it may not. Ill see if i can get around to testing this thursdayish.. Was planing on making an NPC find sub like this anyway.

Heh i write 95% from trial, error, and MQ freezing when events trigger themselves and overflow line lengths.. That needs be fixed too ...

lifewolf
a ghoul
a ghoul
Posts: 143
Joined: Fri Oct 18, 2002 6:29 pm

Post by lifewolf » Mon Dec 16, 2002 10:28 pm

pablo wrote:Hm, what about adding them all to an alert list as the loop enumerates, using their goofy names? Not sure if they would they be unique though - e.g. are there 2 a_frenzied_assclown21 in zone at once, if so you may skip one.

Then obviously you can /target noalert x and whatnot.
There will never be (I dont think) 2 NPCs with the same name and same number in zone at the same time without some other distinguishing characteristic to them...