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
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Sat Oct 22, 2005 7:21 am   

trigger to detect npc
 
Ok everyone, I have a feeling this question has a real simple answer. Basically I want to set a trigger that'll detect the NPC's and objects in any given room as the room loads.

So specifically what i had in mind is... a room looks something like this (followed by the prompt)

A room of great plains (n, e, s, and w)
HP:130 EP:130>

So if there was an item or an npc, it'd look like this :

A room of great plains (n, e, s, and w)
A great tiger
A black longsword sits here
HP:130 EP:130>


So Ideally, I want the A great tiger and A black longsword each being detected and stored to their own dummy variables based on how many mobs and objects there are. What i mean is the tiger would be stored in something like @object1 and the sword in @object2 and if there was a third thing it would be stored in @object 3 and etc.


Anyways, thanks a lot people, much appreciating.


UMDBANDIT
_________________
Rufus- Winner of Stuff
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sat Oct 22, 2005 11:05 am   
 
#CLASS RoomCapture
#VARIABLE Objects {} {}
#TRIGGER "ObjCap" {^* ~([andesw, ]~)$} {Objects=""}
#COND {} {#IF (%match(%line,"HP:%d EP:%d~>")) {#STATE ObjCap 3;#SET ObjCap 3 1} {Objects=%concat(@Objects,"|",%line)}} {prompt|looplines|param=30}
#COND {*} {#STATE ObjCap 0;#ECHO Error in ObjCap: Exceeded 30 line capture limit.}
#COND {} {#NOOP Further processing here.} {manual}
#CLASS 0

That should do it. It is all stored in the variable Objects. You access the distinct lines with %item(@Objects,number)
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Sat Oct 22, 2005 6:44 pm   
 
Ok, I think I mostly understand what is going on.. but what exactly is this part doing


[andesw, ]


Thanks... I cant wait to have this working :)


UMDBANDIT
_________________
Rufus- Winner of Stuff
Reply with quote
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Sat Oct 22, 2005 6:50 pm   
 
Wait i see now... Thats the list of characters that can be in that space. As for getting it working, I just had an eronius space somewhere or other.... Works great now!

-UMDBANDIT
_________________
Rufus- Winner of Stuff
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5187

PostPosted: Sat Oct 22, 2005 8:28 pm   
 
That part of the trigger pattern should probably include a u for up. Silly of me not to put it in first time round.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
umdbandit
Wanderer


Joined: 31 Oct 2004
Posts: 94

PostPosted: Sat Oct 22, 2005 9:38 pm   for anyone reading this
 
so my intention with this, was to make it so i could create #IF statements to analyze the various npcs/items in the room. Here's the alias I made. It can be run from the room trigger, or just as part of a script

Code:

@guardcount = 0
#LOO 1,30 {#If %item( @Objects, %{i})=" A gate guard" {@guardcount = %eval( @guardcount + 1)}}
kill guard @guardcount


basically what thats doing is counting the gate guards and then attacking the last one first so they dont protect eachother. But basically you could tell the console to do anything with anything it found. Just something that someone viewing this thread might find usefull.

UMDBANDIT[/code]
_________________
Rufus- Winner of Stuff
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