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
surge4883@yahoo.com
Beginner


Joined: 30 Jul 2010
Posts: 19

PostPosted: Wed Aug 04, 2010 4:47 am   

capturing a sting with a trigger
 
Here is the mud output I'm working with

Current Sites
~~~~~~~~~~~~~~~~~~~~~~~~~
[00]: Mage Guild - Research and Tutelage
[01]: The Astarian Library
[02]: The Royal Counting House of Astaria
[03]: Starkeep Grand Hall
[04]: < open >
[05]: < open >

I would like to be able to capture each location listed and place them into an array so I can access them. I know how to populate the array once I can grab the strings.

Here is my latest attempt.

#trig {"~[00~]: "} {#call %match(%line, "~[00~]: *", $gatezero); #va test $gatezero#echo @test}

This should store the string "Mage Guild - Research and Tutelage" and store it in the variable test, then echo it to my screen. However, nothing happens and no variable test is created at all. I know it should be firing because when I made the trigger

#trig {"~[00~]: "} {#echo test}

it echos test to my screen

So something else is wrong...


oh the basic trigger,

#trig {"~[00~]: *"} {#echo %1}

also does not work, I tried that first hoping for an easy solution.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Aug 04, 2010 7:43 am   
 
The basic trigger is the one you'd want to use, but it's not echoing anything because you're not capturing anything. Put () around the * and try again.

Charneus
Reply with quote
Taz
GURU


Joined: 28 Sep 2000
Posts: 1395
Location: United Kingdom

PostPosted: Wed Aug 04, 2010 6:24 pm   
 
Also if there are no quotes on the screen then you don't want any quotes in your trigger so

#TRIG {~[%n~]: (*)} {#echo %1}

If there are a variable number of spaces after the colon as opposed to just one then use

#TRIG {~[%n~]:%s(*)} {#echo %1}
_________________
Taz :)
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