Reacting if somebody enters the zone

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

psychoticwrath
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Nov 10, 2003 3:21 pm

Reacting if somebody enters the zone

Post by psychoticwrath » Sun Dec 14, 2003 7:35 pm

Is there a way for my macro to react if somebody enters the zone?
Basically, i want to stop what i'm doing if there is anybody in the zone other than my 2 chars

Nilen2
decaying skeleton
decaying skeleton
Posts: 9
Joined: Thu Nov 13, 2003 1:04 pm

Post by Nilen2 » Sun Dec 14, 2003 11:28 pm

I can't log onto EQ right now to test out the code or find exact phrase but i'd figure it might go something like this. ( I'm no expert scripter nor do i know ever command useable in mq2 but I'm pretty sure this would work)
Not sure if |* and *| are for comments in scripting so take them out if your getting stupid errors from them.

You can rename it from Sub Main to another name so you can have the main sub /call this sub to check whenever you want it to.
(No good at explaining things :) )

Code: Select all


#event Zone "There are 2 Players in Zone Name"
|* Edit above line to whatever the last line in a /who would be that tells /
total number of players in zone *|

Sub Main
/declare global JustYou
/varset JustYou 0
:Loop
/
|* I'm Not positive if the slash would work to do a who in the main EQ chat window or if it would error cause it's only a slash. Play with that if it doesn't work to see what would do a who in main text window, I know a /who would do it in the mq2 window but dunno if #event grab text from mq2 window, if it does you can do it with /who *|
/doevents
/if n @JustYou==1 {
|* Have this part /call the sub routine you have the code in for whatever it is your doing.
}
/delay 100
|* Delay will wait awhile before it checks to see if anyone else is still in zone, so your not scrolling /who's forever, dunno if it's detectable but why take the chance. *|
/goto :Loop

Sub event_Zone
/varset JustYou 1
/return

Like I said this may be more then what is really needed to do what you want, but I'm pretty sure this will work, i'd test it if i had eq on this computer but alas I don't. Just play around with it maybe you can figure it out from this kind of example.

Good luck!

psychoticwrath
decaying skeleton
decaying skeleton
Posts: 5
Joined: Mon Nov 10, 2003 3:21 pm

Psychoticwrath

Post by psychoticwrath » Sun Dec 14, 2003 11:43 pm

Hmm that seems like a good idea... i dont know why i didnt think of that guess the only problem is that if several people zone in before i do my /who tho think there is a way to do
#event Zone "There are "variable" players in the zone?
if not i'll just have to make about 20 or so events making the number higher by 1 each time. If somebody could think of a way to do it withotu spamming my screen a lot that would be nice too.
Thank you very much for your idea :)

What i had planned on doing is using several /target
to target anything other than the other person that is supposed to be in the zone with me.

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

Post by ml2517 » Mon Dec 15, 2003 12:40 am

This is what you need. You should be able to get the idea how to merge this into your script.

Code: Select all

#turbo 20

Sub Main


/declare pcid global
/declare firstpcid global
/declare lastpcid global
/declare pccount global

/varset pcid 0
/varset firstpcid 0
/varset lastpcid 0
/varset pccount 0

/varset pcid $searchspawn(pc)


:Loop
/if n @pcid==@firstpcid {
    /if n @pccount>2 /endmacro
} else {
    /if n @pccount==0 /varset firstpcid @pcid
    /varset lastpcid @pcid
    /varset pcid $searchspawn(pc,id:@lastpcid,next)
    /varadd pccount 1
}
/goto :Loop
/return

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

Post by ml2517 » Mon Dec 15, 2003 1:06 am

This should be a bit easier to merge in your existing macro.

Code: Select all

#turbo 20 

Sub Main 
/declare pccount global

:WaitForEmptyZone
/delay 1s
/call ZoneCount
/if n @pccount>2 /goto :WaitForEmptyZone

[color=red]Put your other stuff here...[/color]


/goto :WaitForEmptyZone
/return





Sub ZoneCount
/declare pcid local
/declare firstpcid local 
/declare lastpcid local 
/varset pcid 0 
/varset firstpcid 0 
/varset lastpcid 0 
/varset pccount 0 

/varset pcid $searchspawn(pc) 
:Loop 
/if n @pcid==@firstpcid { 
    /return
} else { 
    /if n @pccount==0 /varset firstpcid @pcid 
    /varset lastpcid @pcid 
    /varset pcid $searchspawn(pc,id:@lastpcid,next) 
    /varadd pccount 1 
} 
/goto :Loop 
/return