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
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Mar 03, 2002 10:09 am   

Substitute at the end
 
I'm not sure if Substitute is the best way to do this..

But I want to add a numerical number to the end of a line.
Here is a very simplified version of the script I'm trying to make.

Example:
HariKari massacres HariKari.

Replaced with:
HariKari massacres HariKari. (15)

Right now it's something like this..
#TRIGGER {* massacres *) {#sub {%trigger ~(15~)}}

I tried to just have the pattern as { massacres } to save efficiency thinking *'s take longer to compute, but sub will only replace the part of _massacres_.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Mar 03, 2002 11:41 am   
 
It depends what the 15 is.

If it is the number of times A massacred B then you'll want to capture
the whole line. Then substitute it or gag/say.



TonDiening
Beta Upgrading to 6.26
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Mar 03, 2002 11:54 am   
 
Well.. the number can be anything. This just happens to be the damage that it's doing.

I just want to tag something to the end of a line after I find something in that line.
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Mar 03, 2002 8:45 pm   
 
I tried some "prompt" triggers, but when they print the data, it's already on the new line.
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Mar 03, 2002 8:51 pm   
 
Also, for #SUB's that begin with a space, or anything that begins with a space. What is a good space filler? Right now I have a %ansi() and that keeps the space at the beginning.
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Mar 03, 2002 8:55 pm   
 
So this is what I have now..
#TRIGGER {( massacres *.)$} {#SUB {%ansi()%1 ~(15~)}

Is there any efficiency problems with *'s?
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Mar 03, 2002 8:59 pm   
 
I'm not if the %trigger returns a carriage return as I'm not sure
if it works as a function or a reference variable.

Since you have all the information how about just rewriting it:

#TRIGGER {(%*) massacres (%*)) {#sub {"%1" massacres "%2" ~(15~)}}

I've never like #sub and I don't recall why. I usually pipe
that kind of information to a combat window and watch it there.

TonDiening
Beta Upgrading to 6.26
Reply with quote
HariKari
Wanderer


Joined: 16 Feb 2001
Posts: 57

PostPosted: Sun Mar 03, 2002 9:08 pm   
 
quote:

#TRIGGER {(%*) massacres (%*)) {#sub {"%1" massacres "%2" ~(15~)}}



I would do something like that, but efficiency keeps poping up. There will be many others than just the "massacres", and once those start piling up, zMud will get slower and slower.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Sun Mar 03, 2002 9:37 pm   
 
If you know what you are fighting, who you are fighting with, would this
speed up things?

#ALIAS mygroup {#ADDITEM fightmembers %lower("%1")}
#ALIAS dofight {#VAR amfighting "%1";#ADDITEM fightmembers %lower("%1")}

#TRIGGER {^{@fightmembers} massacres {@fightmembers}$) {#sub {%trigger ~(15~)}}

#ALIAS donefight {#DELITEM fightmembers @amfighting}
I haven't spent time optimising lately myself.


TonDiening
Beta Upgrading to 6.26
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