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


Joined: 20 Oct 2006
Posts: 51

PostPosted: Thu Apr 26, 2012 7:20 pm   

Using %match without returning a number
 
Hiya -

I have a large text file that contains a list of mobs for my MUD, along with basic information about them like their exp value, drops, area, and so on. I have aliases to search for and return the entire line, containing all the information from that mob's line in my text file, but I was trying to find a way to return only specific parts of that line as well. I found a way to do it using the %match function, but the problem I am coming across is that %match tries to return a number - the location of the matched portion on the string. I don't need or want this to happen.

Example line from the text file:
Code:
>Borgans Elite Guard                                    XP: 246828 - Area: Tyrir


Pattern of the alias I am using:
Code:
#FILE 2 script_moblist.txt
#VAR mobsearch_matches {%grep( 2, %-1)}
#CLOSE 2
#SAY {%match(@mobsearch_matches,"XP: (%n)",mob_exp_natural)}


Returns:
Code:
27


Although it DOES properly define @mob_exp_natural, which is great. I just don't need or want the returned number. Is there a function I am unfamiliar with that works like %match but doesn't return the number? I saw %regex as a possibility, but the pattern-matching is far more complicated and I was hoping for a simpler solution.

Thank you for your time.
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Thu Apr 26, 2012 7:42 pm   
 
You don't need a function that doesn't return the number, just don't #say that if you don't want to see it. You could #say the variable you're capturing into instead.
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Thu Apr 26, 2012 8:26 pm   
 
Use #CALL instead of #SAY.
Reply with quote
JWhitney
Wanderer


Joined: 20 Oct 2006
Posts: 51

PostPosted: Thu Apr 26, 2012 8:49 pm   
 
Thanks Rahab!
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