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
foxmajik
Beginner


Joined: 14 Jul 2014
Posts: 10

PostPosted: 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?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
foxmajik
Beginner


Joined: 14 Jul 2014
Posts: 10

PostPosted: 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"?
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
Reply with quote
Progonoi
Magician


Joined: 28 Jan 2007
Posts: 430

PostPosted: 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
--------------------------------
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: 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
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