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
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Mon Aug 26, 2002 8:56 am   

window clearing/new db idea
 
What is the command to clear a window? I know on the main window it is just clear...I tried :Items:clear which didnt work. Is there a simple command, because it is VERY important that I can clear window if needed.

Also, could I make zmud save a log file from a window as a .xml file instead of .txt? xml is plain text after all/

Reason I need to know this is I am capturing the output to a window, and want to have it save the log as an .xml file, and I have a webpage which will read the .xml file and make everything all nice and tidy in a table :)

Evangelist
www.phidar.com
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Aug 26, 2002 8:59 am   
 
Clearing:

:items:#CLR


xml is plain text?

#FILE 1 c:blahblahitems.xml
Then write to file 1 to set up headers and stuff.
#CLOSE 1
:items:#LOG c:blahblahitems.xml
#FILE 1 c:blahblahitems.xml
Then write to file 1 to set up footers and stuff.
#CLOSE 1

Edit: I alert you to the fact that you can:
View->Preferences->General
Under General->Logging
[ ] Log after triggers

Ton Diening
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Mon Aug 26, 2002 5:16 pm   
 
What if I already have the .xml file in existence? Can I just do :Items:#Log items.xml? I want it to update the existing file though, doing it that way, I am not sure as to if it would replace it or not.

Evangelist
www.phidar.com
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Aug 26, 2002 5:49 pm   
 
RTM

"If you open an existing log file, the results will be appended unless you specify "new" as the second parameter in which case a new log file is created."

It's right there in plain language in the helpfile for #LOG.

LightBulb
Senior Member
Reply with quote
Darker
GURU


Joined: 24 Sep 2000
Posts: 1237
Location: USA

PostPosted: Mon Aug 26, 2002 6:18 pm   
 
By the way, while XML is "plain text", it's tagged. i.e.
<Log>
<Date>8/26/2002</Date>
<Entry>Today I answered a post on XML</Entry>
</log>

zMUD won't do the tagging for you, obviously... you'll have to set that up somehow on your own, probably with triggers that #Write to the log-#file



zMUD 6 Online Help: All the power you'll ever need.
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Mon Aug 26, 2002 11:09 pm   
 
Object Name: &name is &type and made of &material~.

#window Items {~<~object~>}
#window Items {~<~name~>@name~<~/~name~>}
#window Items {~<~type~>@type~<~/~type~>}
#window Items {~<~material~>@material~<~/~material~>}

It could probably be done cleaner, but it works for my purposes atm. Im running into a problem with spaces though.

Like, here is small two line output.

[ 57 - Cle-Ari ] [efGd afk] Pirku (Mord'Sith)
[ 60 - War-Hum ] [efGd afk] Friedal (Warlord Angels)

My trigger is set up as:
~[~efGd afk~] &whoname ~(&Clan~)
#WINDOW Who ~<~Identity~>
#WINDOW Who ~<~Name~>@whoname~<~/~Name~>
#WINDOW Who ~<~Clan~>@Clan~<~/~Clan~>
#WINDOW Who ~<~/~Identify~>

The problem is, when I capture it, i get the blank spaces from the end of their name to the (. so it look like:

|Identity|
|Name|Xxanth&nbsp&nbsp&nbsp&nbsp&nbsp|/Name|
|Clan|Warlord Mord'Sith|/Clan|
|/Identify|
|Identity|
|Name|Anshar&nbsp&nbsp&nbsp&nbsp&nbsp|/Name|
|Clan|Han'yake|/Clan|
|/Identify|

The || Are really > and < but I could not insert those in this post, no biggie. I am unaware how to get rid of the space after Anshar and Xxanth. Any ideas how to trim off spaces?
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Tue Aug 27, 2002 1:27 am   
 
Drum roll...

Try the %trim function.
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Tue Aug 27, 2002 2:21 am   
 
Well, I had tried having

#WINDOW Who ~<~NAME~>%trim{@whoname~<~/~NAME~>}

#WINDOW Who ~<~NAME~>%trim(@whoname)~<~/~NAME~>

#WINDOW Who ~<~NAME~>%trim @whoname ~<~/~NAME~>

None of those worked, and I did look at that file...didn't get it to work though so I figured I had been doing it wrong. Obviously I have.

I gotta be on the right track...but I can't get past it :(


Evangelist
www.phidar.com
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 27, 2002 3:29 am   
 
How about typecasting the trigger:

quote:

You have 1000gp

you would use a trigger:

#TRIGGER {You have &%d{Gold}gp}

which will only match digits and will properly set the @Gold variable to 1000.




My trigger is set up as:
~[~efGd afk~] &%x{whoname} ~(&Clan~)

%x or %w

Don't know if your mud allows odd characters in the name.



Ton Diening
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Tue Aug 27, 2002 4:04 am   
 
I took out the %x and it worked.

I did run into a small problem just now though.

[ 41 - Thi-Kob ] [efGd afk] Zeek (Exodus)
[ 35 - War-Min ] [efgd afk] Memnoch

My trigger is set to catch the players name and then their clan inside of ()....I just realized it the person is not in clan, after their name there is nothing...and their name is not captures.

I tried taking out the end part to catch the clan, but then it captures everyones name as Namehere Leader Raven .... and Namehere.... is there a way for me to alter it some?

Like, how could I make a trigger to catch the name of the people not in clan, without duplicating entries of people who are in clan?

Evangelist
www.phidar.com
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 27, 2002 4:20 am   
 


[ 41 - Thi-Kob ] [efGd afk] Zeek (Exodus) <endofline
[ 35 - War-Min ] [efgd afk] Memnoch <endofline


#TRIGGER {^~[~efGd afk~] &%w{whoname} ~(&Clan~)%s$} {#NOOP blah}
#TRIGGER {^~[~efGd afk~] &%w{whoname}%s$} {#NOOP blah}


Lock the trigger to match the end with $ and from the beginning with ^


Ton Diening
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Tue Aug 27, 2002 6:07 pm   
 
I played around with them but to no avail.Are there any other approaches I could possibly take? I thought about limited the number of character that @whoname will display, but that will cut off the clan affiliation if I only use one trigger, and using two will give me dupes.

Evangelist
www.phidar.com
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Tue Aug 27, 2002 10:00 pm   
 
What exactly did you modify? How exactly does it not work?

Going from what you provided and what Ton suggested, neither of the two triggers should match on a line they are not supposed to. The first trigger has a pattern of:
^~[~efGd afk~] &%w{whoname} ~(&Clan~)%s$

since "[efGd afk]" is not the beginning of the line, you should probably remove the ^ from the pattern (same goes for the second trigger) and you end up with:
~[~efGd afk~] &%w{whoname} ~(&Clan~)%s$

this pattern will not match this line:
[ 35 - War-Min ] [efgd afk] Memnoch

Likewise, this pattern:
~[~efGd afk~] &%w{whoname}%s$

will not match this line:
[ 41 - Thi-Kob ] [efGd afk] Zeek (Exodus)

Kjata
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 27, 2002 10:04 pm   
 
Bah sorry about that, oversight on my part, didn't check real mud output before anchoring.

This is also a good place to use fix width matching
quote:

&nn matches exactly nn characters (fixed width pattern)



Ton Diening
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Tue Aug 27, 2002 11:37 pm   
 
not currently at home, but could I do something like...

^~[*~] ~[~efGd afk~] &%w{whoname}%s$

and

^~[*~] ~[~efGd afk~] &%w{whoname} ~(&Clan~)%s$


btw, what do the %s$ do? Just end the line?


Evangelist
www.phidar.com
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Tue Aug 27, 2002 11:50 pm   
 
%s matches the white space that seems to trail the users name and the clan designation.



[ 41 - Thi-Kob ] [efGd afk] Zeek (Exodus) <endofline
[ 35 - War-Min ] [efgd afk] Memnoch <endofline



See how Memnoch and (Exodus) has space before the endofline?

Well we have to account for that before we anchor it with the $.
$ means we match it exactly from the end of line.
^ means we match it exactly from the begininning of the line.

It reduces spoofing.


Ton Diening
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Wed Aug 28, 2002 4:04 am   
 
Didn't post when I tried, hehe, here goes. Thanks so much for the help. I used the

^~[*~] ~[~efGd afk~] &%w{whoname}%s$

to capture people without clans, and my original trigger to capture the ones who are in clans. Thank you immensely.

I plan on doing this for the who list, the different clan outputs and stuff...I am currently working on making a hyperlinked html page from the list of clans command, then having it trigger to get clan information for each and saving it in an xml file..sorta a self updating website, as long as I am signed in :)

Thanks again for the help, I might be asking for more of it soon :)

Evangelist
www.phidar.com
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