Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Mon Dec 17, 2007 1:57 am   

stringlists %selected and endlines
 
If I copy text to a variable with %selected it is just like the output

I have not been able to get pipes on the end lines

#var dumbstring %subregex( @blocktext, ",\s*", "|")
#var dumbstring %subregex( @dumbstring, "\.", " ")
#var dumbstring %subregex( @dumbstring, " ", "|")

will make strings of sentences but not for single entries or spaces and so single entries are lost or in these weird multi-item things that scroll in the string list editor.

I have found another approach to this without %selected but if anyone knows how to get pipes on end lines I would be happy to know, spent the afternoon watching Lord of the Rings and looking at this.

and

%subregex( @blocktext, "\w+$", "\w+|") does nothing
%subregex( @blocktext, "$", "|") locks ZMud
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Dec 17, 2007 3:40 am   
 
try subchar?
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Dec 17, 2007 10:58 am   
 
If all you want is a pipe at the end of the string regardless of what comes before it, why not just concat one there manually?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
ralgith
Sorcerer


Joined: 13 Jan 2006
Posts: 715

PostPosted: Mon Dec 17, 2007 4:51 pm   
 
It actually sounds (after re-reading initial post) that you are trying to store sentences retrieved from the MUD into a stringlist variable, correct?
There are two methods I use to do this, one is using concat... however this has the downside of adding a pipe at the start of the variable IF there is nothing already in it.

ie:
Code:

#TR {Blah (*).} {#var stringlist %concat(@stringlist, "|", %1)}


But also... (the better way, in case the stringlist is empty...)
Code:

#TR {Blah (*).} {#var temp %1;#additem stringlist @temp}


I assign %1 to a temp var first, for the simple fact that if you use %1 directly in the additem, it only takes the first word. I've never found any other way around it, even using %string(%1)... which SHOULD do it, does not. So I assign it to another variable first.
_________________
CrossOver: Windows Compatibility on Mac and Linux CMUD Advocate
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Mon Dec 17, 2007 5:49 pm   
 
For the %1 to work directly in Zmud sometimes you MUST put "" around it like so "%1". Give this a try.

Code:
#TR {Blah (*).} {#additem stringlist "%1"}
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Tue Dec 18, 2007 2:25 am   Thanks
 
Actually I am wondering about the output from a block of selected text using a speed menu and %selected. I am not processing received text but creating one huge variable including invisible end lines.

This text would look like this in some bizarre parody of a mud

----- my selection highlight in the output window might begin here ------------

A big rock falls on your head.
OUCH
OMG
3422h, 2120m, -someletters WHO HERE

You see the following people here:

Fred

CLANWHO

Betty
Barney
BamBam
Druidess Leitia

[Rubble’s Legacy] You Say, "First in my anger I contracted on him without regard for right or wrong. It was of little consequence to me well or evil, I am only caring for my grove and what crime could I have committed? As such I live true to any consequence. Still, I have reviewed PK law and wish to point out Fred is more then a scoundrel for attacking me, he is criminal."



----- my selection highlight in the output window might end here ------------

So if I paste all that into a variable and try to remove spaces and insert pipes I have bad results. I think it is invisible code that keeps the lines separate. Not too important as I have 1000 things I want to code. just if anyone knew how to do that it would be useful to me, not just there, but for processing block pastes from logs, if I wanted to do that one again.

Phew, sorry, anyway, if it is too weird, please forget I asked, and thanks everyone for trying to help.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Dec 18, 2007 2:37 am   
 
Oh. You want to do this
Code:
#MENU SetBigVar {BigVar=%replace(%selected,%cr,"|")}
I am pretty sure %selected is only really valid from a right-click menu.
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Tue Dec 18, 2007 2:40 am   
 
I couldn't get if you were trying to keep the empty lines or not but if you are this will work

Code:
#var mylist %subregex(@blocktext,"(\r\n)","|")
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Leitia
Adept


Joined: 04 May 2007
Posts: 292
Location: Boston

PostPosted: Wed Dec 19, 2007 11:00 pm   
 
Cool, and neither worked, but they were copied to my corrupted machine. I will reformat windows soon, but if I can code still (as in help files) , maybe it will be exportable.

Media!

*

I hear you Vijilante, thanks for %cr which even displays badly in that help file, this is an answer to my odd question. You rock.

*

MyList didn’t work, but thank you for the unix newline char Dharkael, I will be able to localize that. You rock too.

*

As an aside, I am near to closing a loop on Achaean concoction selling, doing new things there, or difficult things done before.

Should reformat, but I code by the help text and if it works on ’my windows’, I will be happy with any export

woot
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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