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
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Tue Jun 24, 2003 11:30 am   

another capture question
 

i am trying to capture a variables from a variable string , and send them to a capture window so that i can see what critters are in the room, casting mass spells with a lot of critters cam make it hard to see what exactly is going on with all the scroll.

i have so far

I did try

#TRIGGER {You notice ~*(*)} {#WIN Room {In the room %1}}
but i dont wantg to capture the whole string, just the critters

so..


#TRIGGER {You notice * ({@enemy})} {#WIN Room {In the room %1}}

but this just displays

In the room gremlock
In the room gremlock
In the room being

You notice the Nazradin disk, a twisted being (stunned), a gremlock (dead) and a gremlock.
Obvious exits: north, south

when what i want is

In the room a being, a gremlock, a gremlock

I am also wating to capture the critter state if it has any

so as above a being (stunned), a gremlock (dead), a gremlock


any help appreciated


Nazradin
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jun 24, 2003 12:01 pm   
 
Are all the critters you want to capture in the @enemy variable?
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Tue Jun 24, 2003 1:15 pm   
 
quote:
Originally posted by Kjata

Are all the critters you want to capture in the @enemy variable?



yes apart from the state if they have one (stunned) (prone) currently not in any varaible.

there is a GSL tag for monsters gsl(M) but not sure how to use this

edit

using the gsl tag

#TRIGGER {You notice * ({@enemy}) } {#WIN Room {%time( t) In the room %gsl( M)}}

get out put

9:28 p.m. In the room a festering taint

but it only displays the last creature, if there where taint,being,gremlock would be In the room a gremlock


nazradin
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Jun 24, 2003 4:49 pm   
 
Ok, you need to first capture the whole list of stuff in the room and then loop through each one comparing it to your list of critters. If it matches, add it to another variable and at the end you send this variable to the other window. Example:
#TRIGGER {You notice (*)} {#VAR contents %replace("%1", ", ", "|");#FORALL @contents {#IF ("%1" =~ "{@enemy}") {#VAR critters %additem("%i", @critters)}};#WIN Room {%replace(@critters, "|", ", ")}}
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Tue Jun 24, 2003 6:18 pm   
 
quote:
Originally posted by Kjata

Ok, you need to first capture the whole list of stuff in the room and then loop through each one comparing it to your list of critters. If it matches, add it to another variable and at the end you send this variable to the other window. Example:
#TRIGGER {You notice (*)} {#VAR contents %replace("%1", ", ", "|");#FORALL @contents {#IF ("%1" =~ "{@enemy}") {#VAR critters %additem("%i", @critters)}};#WIN Room {%replace(@critters, "|", ", ")}}



thanks kjata that helps alot

had to add a clear to the critter variable

its almost working great, when there are not critters in the room it shows nothing in the capture window (well just the time which i added) but when there is a critter or 2, which it shows well including any states such as (prone) it is also caputuring any junk in the room and sending it to the captire window

[Forgotten Pool]
You notice a festering taint (stunned).
Obvious exits: none
captures-
1:49 a.m. In the room - a festering taint.

[Forgotten Pool]
You notice a festering taint (stunned).
Obvious exits: none
captures-
1:49 a.m. In the room - a festering taint (stunned).

[Aqueduct]
You notice a gnarled being (stunned), a rose-marrow potion, a ragged knapsack, a filthy knapsack and a dusty knapsack.
Obvious exits: east, west, northeast, northwest, southeast, southwest
captures-
1:49 a.m. In the room - a gnarled being (stunned), a rose-marrow potion, a ragged knapsack, a filthy knapsack and a dusty knapsack.


1:48 a.m. In the room - a twisted being, a filthy knapsack, a festering taint (dead), a battered steel coffer, a dusty knapsack and a pink rhodocrosite stone.


#TRIGGER {You notice (*)} {
@critters =
#VAR contents %replace( "%1", ", ", "|")
#FORALL @contents {#IF ("%1" =~ "{@enemy}") {#VAR critters %additem( "%i", @critters)}}
#WIN Room {%time( t) In the room - %replace( @critters, "|", ", ")}
}


is there anyway to clean it up more so that it shows just the critters and thier state if any?

thanks Nazradin
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