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
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Fri Jul 13, 2007 4:40 am   

Extracting and deleting text from main window
 
Okay, don't know if this is possible but worth a shot. There is a small map appearing at the beginning of every room description. I have it already set where this map gets put into a separate window on the side so it is actually usable using the #cap command. I would like to know if there is a way, in the same trigger to delete the text extracted from the main window. This purpose being that I can have the map on the side without all the ugly spam in the room discriptions or whatnot. Any ideas?

- Winslow.
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Fri Jul 13, 2007 7:02 am   
 
#grep

that should work
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Fri Jul 13, 2007 10:26 am   
 
If you JUST want to remove some of the text from the line, you can use the #sub command:

#trig {This is a really long, boring line that means something really simple. You probably want to shorten it a bit.} {#sub {This is a long, boring line.}}

But you mentioned something about capturing to new windows. If this doesn't solve your problem, please give some more info.

There is no #grep command :S
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shakey
Novice


Joined: 07 Jul 2007
Posts: 40

PostPosted: Fri Jul 13, 2007 2:33 pm   
 
sorry grep is specific to my mud.
you could always capture the text then gag it from the main screen
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jul 13, 2007 9:25 pm   
 
Each additional window you open will have its own configuration. Therefore, you can click on the window and create separate triggers/aliases and the like for just that window. That being said, you could do something like the following:

#sub {a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|'|.|"|!|?} {#sub {}}

What that essentially does is looks for any letter of the alphabet and subs it with a space. It also takes care of several punctuation marks. However, it can be an issue if your map also contains letters, quotation marks, and whatnot. If the map is on a separate line away from the room description, try capturing just the map itself. I know the MUD I play on has the option to show <map> tags, meaning at the start of the map, it shows <map> and at the end, it displays <map end>, making it easier for me to just capture the map if I so desire. If it does have something like that, or an easy way to determine what is a map and what isn't, trigger off that. For instance:

#trigger {~<map~>} {#cap maps}
#TRIGGER {~<map end~>} {#c-}

Let us know if this works out for you.

Charneus
Reply with quote
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Sat Jul 14, 2007 4:04 am   
 
Okay. I somewhat understand your description there but my problem seems to be a little more complicated :P. This is what I have:



First, I suppose I have a little problem with the #cap command as it only takes number of lines specified before your trigger. (Okay, this is hard to describe). I have to capture 11 lines before the bottom of the map. So say my trigger is "+-----[ Clan One ]----+". This would work well. So my script would be "#cap 11 map". would create a new window and put the exact map on it. The problem with that is that the bottom line of the above map varies in every room. The top line is the only thing which stays exactly the same. So how I have it running now is on the trigger "+(*)+" it will run "#cap 11 Map. So it will capture 11 lines before and after the top line as it gets triggered twice and I just have to adjust my little window to only show me the bottom 11 lines which contain the actual map. (Oh God I hope this is somewhat understandable).

Now, if I can get that working correctly, where it only captures the map, the exact map, would then want it to only show this up on my sub-windows "map" and not on the main window. I see the #sub command and see how this could work in a way but I don't follow your two triggers and how that works and where to incorporate the #sub command in it as I only use one trigger.

I know I'm sounding completely noobish however the help files don't provide too many example codes and so I'm not thinking with it real well.

- Winslow.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Jul 14, 2007 4:19 am   
 
What you need is a more specific trigger pattern than +(*)+. This is pretty easy, really, because there are plenty of other options.

+*~[ * ~]*+
+-*~[ * ~]*-+
+[-]~[ * ~][-]+

and perhaps the most complex (regex):

\+-{2,8}[ [a-zA-Z ]+ [-{2,8}\+

Which will match a +, followed by between 2 and 8 -s, followed by a [ and a space, followed by one or more letters or spaces, followed by a space and a [, followed by between 2 and 8 -s, followed by a +.

EDIT: Also, that pic isn't loading in the forums for me, probably because Angelfire blocks direct linking to images. Try using imageshack.us instead.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Sat Jul 14, 2007 6:26 pm   
 
Thanks. Possibly with the image I can show this more clearly (I hope you can see the image now). The top part of the map is always "+----------------+". The bottom ranges anywere from "+-----[ Clan One ]----+" to "+----------------+" to "+[blah blah blah blah]+"

Here is the image again using imageshack:
[URL=http://imageshack.us][/URL/>

In this case, I don't think that example would work, but its good to know for sure.

- Winslow
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 14, 2007 7:20 pm   
 
Love how the bottom changes. What you could do in this case is use "state" triggers. You'll start out with #cap triggering off +-----------+, then make a state through the Settings. If the map is -always- 11 lines long, you could do the condition as +*+ within 11 (maybe 12) lines, #c-.

I hate not having zMUD in front of me. I'm at the library right now, and my computer at home is busted, so I only get to use zMUD when I'm at my mother-in-law's office. It's harder to explain what to do in these cases, but hopefully, that'll point you in the right direction.

Charneus
Reply with quote
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Sun Jul 15, 2007 3:25 am   
 
Sorry, I don't know what a state trigger is or how to set this. The map is always 11 lines so this is good. I just wish the #cap command could be set to go from the top down instead the bottom up :P
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Sun Jul 15, 2007 4:44 am   
 
#trigger {^+----------------+} {:window name goes here:#clr;#window window name goes here {+----------------+};#sub ""}
#condition {^~|(&16)~|} {#window window name goes here {~|%1~|};#sub ""} {looplines|param=9}
#condition {~+(*)~+} {#window window name goes here {+%1+};#sub ""}

That should do the trick without having to touch the room info you want to keep in the main window.

What Charneus is referring to are called multi-state triggers, which is basically an array of triggers that fire in a specific order. They are seen by ZMud to be one entity, kind of like pages in a book--you must read and process Page 1 before you can go on to Page 2, which in turn must be processed before Page 3, and so on (this is a very oversimplified explanation, and there are of course a few exceptions). If you were to create these states as separate triggers, they'd all basically fire at the same time and you'd have no chance to control the process.
_________________
EDIT: I didn't like my old signature
Reply with quote
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Mon Jul 16, 2007 2:05 am   
 
Okay. This is funny. I worked it out I think but what this does is only take the top bar and the bottom bar and put them in the window. It does not take the map itself. Just the top boarder and bottom boarder.. It DOES delete it thou from the main window so I DO have progress. hehe.

- Winslow
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Jul 16, 2007 4:04 am   
 
Does it delete the entire map and just not transfer it to the window, or does the map in the main window not get deleted either?

I wonder if maybe it's the ansi coloring that throws off the trigger pattern? I think a looplines automatically resets rather than hanging up the trigger, so that'd explain why the entire thing worked but the middle condition didn't do anything. See if changing &16 to * fixes it for you?

I confess I don't use looplines a lot, so I might be expecting it do something it wasn't designed to do. If that's the case, you'll probably just want to unroll the loop (it's really simple, just change it from looplines to pattern, then copy it 8 more times).
_________________
EDIT: I didn't like my old signature
Reply with quote
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Mon Jul 16, 2007 4:30 am   
 
Changing the &16 to * seemed to capture the whole map and put it in the window now, deleting the old one, however the ascii colors don't follow over. Is there a way to fix that or no? Also, when it deletes it from the main window, it does leave the 11 blank lines there, which is better then it was before but I'm trying to reduce spam as much as possible. a way to delete return chars as well?

Thanks for your help so far.

Edit: The #gag command actually works excellent to remove the lines so I could just put in 11 #gags after I capture the map correctly. I don't understand in the previous code however how you deleted the text from the main window.
Reply with quote
Winslow
Novice


Joined: 17 Feb 2007
Posts: 48

PostPosted: Mon Jul 16, 2007 4:15 pm   
 
Woooo.... I think I got it. I just set a trigger for "+(*)+" to #cap map;#gag and another one for "|" to #cap map;#gag. Because the map shows in sequence, I'm able to capture the mapa in order and delete it from the main screeen, leaving the ascii color codes correct and no spaces in the main window, reducing loads of spam and having an actual workable map showing up in another window. Thanks for all your help weveryone.
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