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


Joined: 19 Dec 2007
Posts: 18

PostPosted: Fri May 01, 2009 5:33 am   

Capturing/Parsing Variable line inputs
 
I'm trying to parse/extract variables from a multiple line input string. The problem is the line count is not consistent since the variables I want to capture are NOT the same length, for example I want to capture both of the following:

> The light brown soil is tinged with some flecks of gold, a few flecks of
white, and glistens a sickly yellow-green colour. The soil is bone dry.

OR

> The pale brown soil is tinged with some flecks of gold, a few flecks of
white, and glistens a sickly yellow-green colour. The soil is somewhat
dry.

There are actually a number of different variables in here I need to capture, (flecks could be some/few/many/swath, soil color different, glisten: yellow/yellow-green/green-yellow/green, etc...)

I know I can use the "$" to find an end of the line, but if I want to parse for the variables (which sometimes end up AT the end of the line, or beginning of new line) I can't just capture lines individually (since the start might be different)

I'd welcome any suggestions....I am continuing to look through the help files for solutions....
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Fri May 01, 2009 1:49 pm   
 
The first suggestion is to find out whether this mud allows you to turn off server-side line wrapping. If you can turn off line wrapping, then cmud can do the line wrapping itself for display, and all of those lines will be treated as a single line for your scripts.

If you can't turn off server-side line wrapping, it gets tricky. But most muds do allow you to turn that off.
Reply with quote
wrym
Magician


Joined: 06 Jul 2007
Posts: 349
Location: The big palace, My own lil world

PostPosted: Fri May 01, 2009 4:34 pm   
 
If you can't disable server-side line wrapping i'ld put this on the back burner for a bit. Zugg is working on implementing a cmud feature to UN-server-side line wrap lines. Then that would be 1 nice neat clean trigger.

Here's the link, he talks briefly about it in his last post, as well as a few other locations.

http://forums.zuggsoft.com/forums/viewtopic.php?t=33192
_________________
"To the engineer, all matter in the universe can be placed into one of two categories: (1) things that need to be fixed, and (2) things that will need to be fixed after you've had a few minutes to play with them" - Scott Adams, The Dilbert Principle
Reply with quote
pelonza
Beginner


Joined: 19 Dec 2007
Posts: 18

PostPosted: Sat May 02, 2009 12:33 am   Yes and no....
 
My mud can set the line wrap values....but it seems that it only applies to SOME things.

Turns out from a little more investigation that things like our mud's room descriptions have BUILT IN character returns (not related to line length).

I suspect that is what is going on with this description. However, obviously those character returns are based on a different, internal variable,
and not a part of the line/phrase I"m trying to capture. I'm going to take a crack at using the built in character returns/puncuation to see if I
can parse it, but I'm not hopeful.
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