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
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Thu May 15, 2008 11:30 pm   

simple trigger help....
 
Well... I thought it was right, but alas... I'm doing something wrong. =[

From the mud:
You get a pile of 395,948,003 gold.

What I have:
#trig {^You get a pile of %n$goldcurr gold.} {#add money $goldcurr;#say I got $goldcurr}

Not adding anything to @money and not performing the #say. =**[
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu May 15, 2008 11:53 pm   
 
This may be overkill and I am sure there is a better way, but...
Code:

#REGEX {^You get a pile of (\d{0,3},?\d{0,3},?\d+) gold\.$} {#ADD money %1;#SAY I got %1}

will do the trick. The only problem I have with it is that it will accept 003 which isn't wrong but it also isn't pretty. So this needs a wee bit of work, but it is a start.
_________________
Sic itur ad astra.
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Fri May 16, 2008 12:03 am   
 
well... lol, the problem with that, is that i don't necessarily always get over a 100k gold, sometimes its as little as 1 gold. thats why i was trying to use the %n i read someplace that it automatically removed the commas.... hrmmm....
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Fri May 16, 2008 12:23 am   
 
Very complex way of doing it, Anaristos. %n will match comma-delimited numbers and strip the commas, so it's the best way to do the match. The trouble, shaun, is that you're using the localvar syntax completely wrong. To set the value of the variable, you use ($localvar:whatever you want to capture), so you want ^You get a pile of ($goldcurr:%n) gold.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Fri May 16, 2008 12:27 am   
 
gar! fang, your the man! hey... can i borrow your brain for a day or so? just so i can get my ideas down into my client, and clean things up? lol! thanks again bro! =D
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Fri May 16, 2008 4:46 am   
 
Wow what game is that where you find that much in a pile of gold? Your character must be rich.
Reply with quote
shaun.murray
Magician


Joined: 23 Jul 2005
Posts: 334
Location: Chicago

PostPosted: Fri May 16, 2008 4:12 pm   
 
Heh... Just an example... =D
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