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


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Thu Jul 16, 2009 1:28 am   

Catching an unkown number of strings.
 
I am attempting to collect information that is listed in the following manner....

Item1, Item2, Item3, Item4

The thing is there could be one thing there, or many things there, and it can change from time to time. How would I write a trigger to allow me to catch each item but not make it so specific that it wont work each time the list changes.
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jul 16, 2009 1:39 am   
 
I would use a trigger condition

#TR {some pattern of leadup text} {}
#COND {(*)} {thisList=%replace(%line, ", ", "")}
#COND {cleanup text or prompt} {}

Best I can offer without seeing the output myself.
_________________
Discord: Shalimarwildcat
Reply with quote
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Thu Jul 16, 2009 1:44 am   
 
Code:
Enemies of the House Nebre'seir:
Morganth, Sentrine, Sudoxen, Kalista, Metheri, Aliyas, Torlin, Osai, Kheoss, Mordacai, Bynar, Talmord, Noon, Wylliam, Kraven, Athesia, Jaymz, Erimus, Donick
Total: 19



The exact copy of what I am trying to collect, one example anyway
Reply with quote
shalimar
GURU


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

PostPosted: Thu Jul 16, 2009 1:58 am   
 
#TR {Enemies of the House Nebre'seir} {}
#COND {(*)} {Enemies=%replace(%line, ", ", "|")}
#COND {Total: %d} {#SAY Enemies: @Enemies}

That should work... I haven't played with z much since moving to C.
_________________
Discord: Shalimarwildcat
Reply with quote
Stowslee
Wanderer


Joined: 20 Apr 2008
Posts: 69
Location: Watervliet, NY

PostPosted: Thu Jul 16, 2009 2:08 am   
 
Excellent, thank you. I was considering switching to CMud as well, but my computer seems to have trouble with it. When I enter the settings screen and the characters screen when I change from one thing to another I get weird blank spaces... just graphics issues with it.
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