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


Joined: 05 Mar 2008
Posts: 10

PostPosted: Wed Mar 19, 2008 11:28 am   

Need help with timestamping in Zmud 7.21 please
 
I've searched and all I've found is something along this line:

#trig {^} {#sub {~[%time(hh:nn)~] }}

The problem is this: when you use #sub, it takes all the color out of the captured line.

So, if someone sets up an alias to talk over guild chat:

Alias: ogdt

action: gdt `5-`4=`%[`7ooc`%]`5=`4-`%

Bearing in mind, `5, `4, `%, `7, etc are the color's *Yes, I know, I don't have ~ before the [ ]. Zmud forgives me this :)* The #sub doesn't keep any colors.

How would I make it so that it just adds a timestamp, say, before or after, doesn't matter, in the capture window?

Currently, my capture trigger is along these lines:

[Guildname](GL)(Guild Title) PlayerName: 'Guild Chat Text'
~[%1~]~(%2~)~(%3~) %4: '%5'
#cap Guild

I know its primitive capture trigger, but hey, it works. What would I add, and where, to get a timestamp before or after the captured line?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Mar 19, 2008 11:43 am   
 
I feel compelled to say this every time I see someone using %1 etc in the pattern: it's not a real wildcard. See the help for real pattern matching wildcards. You don't need to change it, but the old syntax breaks when you try to do some things with it, so it's a good habit to break. Moaning over.

There're a couple of alternatives - use something other than #cap and put your own colours in with %ansi or use #psub instead of #sub. If you use #psub, you'll have to find a way of getting it to add text rather than remove it (I wonder if XEnd of 0 works?)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Evilness
Beginner


Joined: 05 Mar 2008
Posts: 10

PostPosted: Wed Mar 19, 2008 11:44 am   
 
Oi, you totally lost me.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4772
Location: Pensacola, FL, USA

PostPosted: Wed Mar 19, 2008 12:12 pm   
 
#TR {^} {#SUB {<color pink>%time(t)</color>}} no_def {prompt}

i think should work... untested, assumes you have alot of prompts
_________________
Discord: Shalimarwildcat
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Mar 19, 2008 12:43 pm   
 
Check the help files I linked to. You can use the #win command to display text in a window in the same way you'd use #cap. So instead of using #cap, you'd do #win Guild %line;#gag - but that'd still lose the colour information. So you need to know what the colours are going to be beforehand - this method requires that that's pretty simple to do. If it is, you just put the %ansi function in the text like this: #win Guild %ansi(red)%line;#gag - you can make it more complex than that if you need to. If that's not an option (if players can and do send custom colours) then you'll need to use #psub.

#psub works like #sub but you choose where you want it to substitute - the p, I think, means position. You want your sub to happen at the start, so the XStart (horizontal start) is fine - it defaults to the start of the string. But you want the XEnd to be the start of the string too, meaning you'll need to use 0 or 1 and pray it works.

EDIT: Knew I should've finished this post before I went to cook. *shakes fist at shalimar*. I think you mean _nodef, though, and I didn't realise that worked in triggers. Normally I just use an empty string, "". The original issue was with the colour being removed by #sub, and I'm fairly certain that still happens even if you use MXP. But it's worth a try, definitely. Should've thought of it myself :(
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Evilness
Beginner


Joined: 05 Mar 2008
Posts: 10

PostPosted: Wed Mar 19, 2008 12:59 pm   
 
Well, hate to say it, but I'm registered to use Cmud too. Haven't switched to it yet, as some of my things in zmud won't transfer correctly, ie, having a status window opened up that displays my score sheet in a customized fashion. And, I can't get the cmud client to give me a local echo on anything I type in the command bar atm. But, thats a post for a dif forum. Thank you for the help :) you guys rock Mr. Green
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Mar 19, 2008 3:00 pm   
 
In CMUD, this would literally require checking one box. That's it :(
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4772
Location: Pensacola, FL, USA

PostPosted: Wed Mar 19, 2008 3:08 pm   
 
might do better asking for help converting your problem scripts to CMUD
_________________
Discord: Shalimarwildcat
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Wed Mar 19, 2008 9:24 pm   
 
I've not had problems using #SUB where it removes the color from the part of the line that you don't replace.

So, for example:

#TRIG {^} {#SUB foo}

preserves the color of the rest of the line, though

#TRIG {(*)} {#SUB {foo %1}}

does not.
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