|
foxmajik Beginner
Joined: 14 Jul 2014 Posts: 10
|
Posted: Mon Jul 14, 2014 10:22 pm
Text captured with ' symbol is truncated |
Hi,
I'm attempting to make a script to shunt pages and whispers to another window.
An example output from the muck would be:
Code: |
--> [ 3:12pm ] majik'fox pages, "test3" to you. |
My trigger is:
Code: |
(%w) pages, "%*" to you.$ |
My script is:
Code: |
name=%1
#COLOR "hi,green"
#CAPTURE "FurryMUCK - %1"
#GAG
#BEEP |
I anticipate this would gag the text from the session window and send the text of the page to a window titled:
FurryMUCK - majik'fox
However, instead, it sends the text to a window titled:
FurryMUCK - fox
I want to capture the whole name, not just the part after the ' symbol.
How can I capture the whole name even when someone's name has a special character in? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Mon Jul 14, 2014 11:33 pm |
Use %x. %x will match on any non-whitespace group of characters.
You can also use a character range, which is denoted as [stuff], where stuff is the list of wildcards and literal characters you wish to match. For example, [%w'] will match the example in your post. |
|
_________________ EDIT: I didn't like my old signature |
|
|
|
foxmajik Beginner
Joined: 14 Jul 2014 Posts: 10
|
Posted: Tue Jul 15, 2014 12:05 am |
Neat, that works.
I have one more problem with my script:
When the first line is captured a window named "FurryMUCK - x" is opened, where x is the value of %x.
Lets say %x contained "bob".
But when another line is captured it appears in the same window.
I would expect a new window to be opened with the new value of %x, since the value of %x is now different.
A use case:
1. Bob pages me.
2. Bob's line appears in the window "FurryMUCK - Bob"
3. Tom pages me.
4. Tom's line appears in the window "FurryMUCK - Bob"
Why doesn't Tom's line appear in a window named "FurryMUCK - Tom"? |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Tue Jul 15, 2014 10:47 pm |
It it quite interesting that CMud processes the %1 in #CAPTURE "FurryMUCK - %1". It's not at all supposed to do that, ever, so your window name should be FurryMUCK - %1.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Wed Jul 16, 2014 1:36 am |
It's been ages since I scripted CMud, but shouldn't you call with #CAPTURE a variable (or local variable?) instead?
That way variable can always change given what's the trigger is, but capture window is always different because variable changes.
Something like...
Code: |
name=%1 // or $name=%1
#COLOR "hi,green"
#CAPTURE "FurryMUCK - @name" // or $name
#GAG
#BEEP
|
|
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
MattLofton GURU
Joined: 23 Dec 2000 Posts: 4834 Location: USA
|
Posted: Wed Jul 16, 2014 11:09 pm |
%1 IS a variable. However, everything inside double quotes is supposed to be unparseable so if you do "FurryMUCK - @name" it would not expand @name to whatever it contained.
|
|
_________________ EDIT: I didn't like my old signature |
|
|
|
|
|