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: 175

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: 4690
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: Shalimarwildcat
Reply with quote
rmorock8869@yahoo.com
Beginner


Joined: 15 May 2018
Posts: 17

PostPosted: Mon Dec 27, 2021 4:59 pm   
 
How would you count CORPSE and then set it to @NUM
Reply with quote
shalimar
GURU


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

PostPosted: Mon Dec 27, 2021 9:09 pm   
 
That depends entirely on how your game displays corpses.
_________________
Discord: Shalimarwildcat
Reply with quote
rmorock8869@yahoo.com
Beginner


Joined: 15 May 2018
Posts: 17

PostPosted: Tue Dec 28, 2021 2:09 am   
 
The corpse of a dire corby alpha is here.
Reply with quote
hpoonis2010
Adept


Joined: 18 Jun 2019
Posts: 279

PostPosted: Tue Dec 28, 2021 1:36 pm   
 
#TRIG {The corpse of * is here.} {num=@num+1}

Obviously you initialise your corpse counter at the point when you want to start counting.

Eg., for each session maybe an ONCONNECT event, and for each room an ONROOMENTER event.
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