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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
boblinski
Novice


Joined: 05 Dec 2005
Posts: 49
Location: New Zealand

PostPosted: Sun Aug 04, 2019 9:18 am   

Counting MOBS
 
Quote:
<<100%hp 100%m 95%mv>> east

Room Name
Descrption is
Basically always
Multilple lines
[Exits: east west]
Elf Mob 1 stands here.
Human Mob 2 rests here.
Dog Mob 3 sits here.

<<100%hp 100%m 93%mv>>


Hey guys, what I'm wanting to do is make a script for mobs in each room, to do something based on how many there are.. for example I might simply want to look at them all... Is there a way to count how many there are so I can simply trigger to do:

Code:
look 1.
look 2.
look 3.
Reply with quote
chris123zugg
Apprentice


Joined: 23 Aug 2013
Posts: 157

PostPosted: Sun Aug 04, 2019 10:42 am   
 
#TR {Elf mob (%d) stands here.} {#loo %1 {look at elf %i} will iterate through how many elf mobs are listed
Reply with quote
boblinski
Novice


Joined: 05 Dec 2005
Posts: 49
Location: New Zealand

PostPosted: Sun Aug 04, 2019 11:42 pm   
 
Sorry, those were just made up examples, none of the mobs are that simple in actual practice...


What I was even hoping for was more like a way to count the lines between:

[Exits: *]

and the next seen

~<~<*~%hp *~>~>
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4410
Location: Pensacola, FL, USA

PostPosted: Mon Aug 05, 2019 7:49 pm   
 
you can do that, yes

Code:
#TR {Exits:} {NPC_Count=0}
#COND {*} {
  #IF (!%match(%line, "(%d)%hp")) {
    #STATE 1
    NPC_Count=(@NPC_Count+1)
  } {#LOOP @NPC_Count {look %i}}
} {within|param=1}
_________________
Discord: Shalimar#3679
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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