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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Sat Mar 22, 2008 9:40 pm   

There a reason this trigger slows down Cmud so much?
 
^{A|*}{*| }{*|p}{r|*}{*|i}{c|*}{k|*}{l|*}{y|*}{*| }{s|*}{t|*}{i|*}{n|*}{g|*}{i|*}{n|*}{g|*}{ |*}{o|*}{v|*}{e|*}{r|*}{w|*}{h|*}{e|*}{l|*}{m|*}{s|*}{*| }{y|*}{o|*}{u|*}{r|*}{ |*}{b|*}{o|*}{d|*}{y|*}{,|*}{*| }{f|*}{a|*}{d|*}{i|*}{n|*}{g|*}{*| }{a|*}{w|*}{a|*}{y|*}{*| }{i|*}{n|*}{t|*}{o|*}{*| }{n|*}{u|*}{m|*}{b|*}{n|*}{e|*}{s|*}{s|*}{.|*}

#if (@attacked <= 0) {#echo ILLUSION!!!}
#if (@attacked > 0) {
#var plants.paralysis 1
#var plants.planthit 1
}
#var attacked [@attacked - 1]

Basically the message varies each letter with *, hence the bunch of varying. Can Cmud not handle this well? Is there another way I should put this?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Mar 22, 2008 10:02 pm   
 
Firstly, the [] syntax has been removed (see the help).

What do you mean by slowing down? The package editor is pretty slow just because there're lots of different things to highlight (it's actually highlighting some things wrong, which might be something to look into). Is that what you meant, or is the trigger actually executing slowly?
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Sat Mar 22, 2008 10:05 pm   
 
Yeah, sorry, I already deleted the [ ] but try putting it in your system and you'll see what I mean. The system 'drags' like.....so bad
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Mar 22, 2008 10:12 pm   
 
I pasted it into the editor and noticed that it's very slow to change tabs and things with that trigger highlighted. Is that what you meant? I didn't notice any significant slowdown in matching speed.

EDIT: Wow. Opening and closing the package editor with that trigger highlighted and changing flags like enabled on it is very slow.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
talonnb
Apprentice


Joined: 30 Oct 2004
Posts: 127

PostPosted: Sat Mar 22, 2008 10:26 pm   
 
My point exactly. Oh well, might try another way to add it....although can't think of another way at the moment. Is there another way to vary things like this?

The triggered line is:
A prickly stinging overwhelms your body, fading away into numbness.

But the game varies the letters to * so you could see:
A pr*ckly sti*ging ove*wh*lms your *od*, f*din* awa* int* nu**ness.

So, is there another way?
Reply with quote
shalimar
GURU


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

PostPosted: Sat Mar 22, 2008 11:41 pm   
 
Too bad we dont have inverse triggering...

i mean if:

A pr*ckly sti*ging ove*wh*lms your *od*, f*din* awa* int* nu**ness.

was the pattern it WOULD match:

A prickly stinging overwhelms your body, fading away into numbness.

But i suspect it would be rather slower to treat the incomming text as the pattern and test it against a wildcard free trigger
_________________
Discord: Shalimarwildcat
Reply with quote
luggage
Novice


Joined: 20 Jul 2004
Posts: 38
Location: Australia

PostPosted: Sun Mar 23, 2008 12:52 am   
 
I can only think of one other way of doing it, which involves a bit of mick-mucking around.
Basically, the number of characters in the line is always going to be the same, so you could trigger on a fixed pattern length.
Then I would also incorporate into the same trigger several character range checks for say every word and the space.
This will pick up that line, but maybe another one as well, so then in the trigger you would have to double-check if it is exactly the prickly stinging.

Basically (untested) something like:

#TRIGGER {^&2[A* ]&8[prickly* ]&9[sting* ] .... etc

Will trigger on that line, but possibly on more lines as well. Also, this won't slow down the editor much either. :)
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Sun Mar 23, 2008 2:12 am   
 
Actually I am thinking the best way to handle this is really with script. Since you already have something that detects being attacked you know when to enable the match. If you use a null pattern or equivalent it will match each line.
Code:

#REGEX "paralysed" {^} {

//Next you do the fastest check possible to throw the line out, that being its length.
 #IF (%len(%line)=67) {

//Now it looks like the inverse matching would be a good idea.
  #IF (%match("A prickly stinging overwhelms your body, fading away into numbness.",%line)) {

//Finally your code
   plants.paralysis=1
   plants.planthit=1
   attacked=(@attacked - 1)
  }
 }
}
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Mar 24, 2008 4:35 pm   
 
Also try turning off the Syntax Highlighting option in the editor menu. I think it's the color syntax highlighting of the pattern that is causing the slowdown.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sun Aug 03, 2008 3:25 am   
 
Nevermind. I had the stupid class folder the trigger was in off while testing. lol I was going to say it won't work for me.
Reply with quote
Seb
Wizard


Joined: 14 Aug 2004
Posts: 1269

PostPosted: Sun Aug 03, 2008 4:00 am   
 
Bah, ninja'd by edit. Evil or Very Mad

Ideally one should replace the %line in:
#IF (%match("A prickly stinging overwhelms your body, fading away into numbness.",%line)) {
with:
%replace(%line,"*","?")
but that would only make it faster (I presume, but maybe it's actually slower due to the replacing time) and less likely to have a false match. I don't know why it's not matching. Have you tried using the debugger? OK, I decided to debug it myself (next time you try this first though, promise?) and found that it works fine for me using a #SHOW command to trigger it, so maybe the text is not the same? Try it with the debugger and put some variables you set to see how far you get (you can't print or you mess up %line).
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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