Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Tigger
Novice


Joined: 07 Oct 2002
Posts: 46
Location: USA

PostPosted: Fri Oct 18, 2002 1:30 am   

Trigger inside a loop
 
I am using #loo 1,4 {look %{i}.mob
I want to have a trigger work if the mob I am looking at has a peace of equ called unique.

if the mob has a unique I want the # of the mob recorded so I can kill #.mob


I am thinking

#tr {unique} {#var mnum %{i}}

then I could type kill <@mnum>

but would the trigger work in the middle of the loop?
(I have to test this but no mud at work)
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Oct 18, 2002 2:15 am   
 
Don't put the trigger in the loop, you only need to make it once. Instead, put a #VAR command in the loop to catch the current loop-number.

#LOOP 1,4 {#VAR loop %i;look %{i}.mob}
#TR {unique} {#VAR mnum @loop}

LightBulb
Senior Member
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Oct 18, 2002 2:39 am   
 
I have to disagree with Lightbulb on this one. #LOOP 1,4 {#VAR loop %i;look %{i}.mob}
will send all the looks at once and the variable @loop will contain 4 before any trigger has a chance to fire.

You must use a more coordinated system to detect your uniques. You will need a variable showing the high number for looking, another for the current number, a trigger that picks up when a look has occured to increment the variable and preform another look if appropiate and an alias to start the whole thing.
Reply with quote
Tigger
Novice


Joined: 07 Oct 2002
Posts: 46
Location: USA

PostPosted: Fri Oct 18, 2002 3:24 am   
 
well what would you sugest....I need to grab how many mobs are in the room (begin with exit and finish with a blank line.

Then I need to glance at each mob (using the number from above) and trigger at a unique to store that number in a var.


any help is appericated
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Oct 18, 2002 6:03 am   
 
I think this is what you are looking for:
Basic trigger has driven author nuts!

LightBulb
Senior Member
Reply with quote
Tigger
Novice


Joined: 07 Oct 2002
Posts: 46
Location: USA

PostPosted: Fri Oct 18, 2002 12:10 pm   
 
Thanks LB but I am still stuck with trying to pull the mob with the unique - # out of the loop, so how can I put a trigger in the middle of a loop


Then I need to glance at each mob (using the number from above) and trigger at a unique to store that number in a var.

any help is appericated
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Oct 18, 2002 6:10 pm   
 
So, don't use a loop. The loop was your idea, not mine.
#TR {^~[Exits:*~]$*} {#VAR NoOfMobs 0;#T+ Peekinv}
#CLASS Peekinv disable
#TR {^*} {#ADD NoOfMobs 1}
#TR {$} {#T- Peekinv;#VAR mob 0;lookmob}
#CLASS 0
#AL lookmob {#ADD mob 1;glance @{mob}.mob;#ALA +5 {lookmob}}
#TR {mob has a peace of equ called unique} {#VAR target @mob}

Adjust the alarm time so you always get the return from one glance before you send the next.

LightBulb
Senior Member
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net