|
JWhitney Wanderer
Joined: 20 Oct 2006 Posts: 51
|
Posted: 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:
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. |
|
|
|
Daern Sorcerer
Joined: 15 Apr 2011 Posts: 809
|
Posted: 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.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Thu Apr 26, 2012 8:26 pm |
Use #CALL instead of #SAY.
|
|
|
|
JWhitney Wanderer
Joined: 20 Oct 2006 Posts: 51
|
Posted: Thu Apr 26, 2012 8:49 pm |
Thanks Rahab!
|
|
|
|
|
|
|
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
|
|