 |
| chamenas |
Posted: Mon May 12, 2008 12:17 am
Alright, running through a string... couple of purposes |
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun May 18, 2008 6:01 pm |
Doh! Yeah, sorry. And swears are bad for you. 
|
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun May 18, 2008 6:12 pm |
So I fixed it, still a couple issues though.
Here it is, fixed:
| Code: |
#REGEX sleep {^You go to sleep(?: (?:on|in) a )?(.*)?\.$} {posn=sleep
bed={%replace(%1," ","|")}
#FORALL @commons {#DELI @bed %i} } {General Triggers}
|
You go to sleep on a sleeping pad.
Bed: sleeping|pad
| Code: |
#TRIGGER thirsty {^You are thirsty.$}
{
#IF (@posn="wake")
{
#5 {#send "drink decan"}
} {
#send rest
#5 {#send "drink decan"}
#send {sleep %replace(@bed,"|"," ")}
}
} {General Triggers}
|
Is just one think I'm trying to use it on, there will be others.
But that last line sends:
sleep sleeping pad
That should work right? Nope, my MUD requires quotes around a multiple word argument. But whenever I put quotes around the replace function, or I escape quotes, it does not come out with "sleeping pad" |
|
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon May 19, 2008 2:34 pm |
bump, this must have a simple solution that I'm just missing...
|
|
|
|
 |
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Mon May 19, 2008 4:39 pm |
Why not try?
#send {sleep ~"%replace(@bed,"|"," ")~"}
And no I'm not reading the billion threads, or this whole one.
Just got bored for a moment and saw the bump. |
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
 |
chamenas Wizard

Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon May 19, 2008 4:46 pm |
When I tried that it sent
sleep " "
I thought I mentioned it, maybe I didn't. I can try it again when I get out of work. |
|
|
|
 |
Larkin Wizard

Joined: 25 Mar 2003 Posts: 1113 Location: USA
|
Posted: Mon May 19, 2008 6:47 pm |
This doesn't seem quite like proper syntax to me, but it worked when I tested it.
| Code: |
| sleep %concat(~", %replace(@bed,"|"," "), ~") |
|
|
|
|
 |
|
|
|