|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Feb 25, 2008 11:38 pm
[2.18] Sluggish trying to display and edit this trigger |
Normally CMud displays triggers instantly without delay, but with this trigger it takes it about 5 seconds after clicking it to display the trigger. Something about it is causing the CMud to spike the CPU usage when I click on it to view.
Code: |
<trigger priority="28990" case="true" regex="true" id="2899">
<pattern>^([A\*][ \*][p\*][r\*][i\*][c\*][k\*][l\*][y\*][ \*][s\*][t\*][i\*][n\*][g\*][i\*][n\*][g\*][ \*][o\*][v\*][e\*][r\*][c\*][o\*][m\*][e\*][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\*][.\*])</pattern>
<value>#if (%numwords( %1, "*") <= 15) {
#sub {%ansi( red)AFF%ansi( gray) paralysis}
i_venom_aff i_aff paralysis
i_queue i_scan_vlock
}</value>
</trigger> |
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Feb 26, 2008 4:39 am |
Confirmed... definitely something wonky going on.
What text are you trying to match? My gut tells me there's got to be a better way to match that. |
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Feb 26, 2008 5:14 am |
It's the message "A prickly stinging overcomes your body, fading away into numbness." but a few of the characters (random each time the message is sent) will be replaced with asterisks. There's not really a better way to do it, unfortunately.
I really don't understand why MUD admins do stuff like this. It's a cheap shot designed to stop people from scripting, but really all it does is stop novices from scripting. Someone with a good knowlege of regexes is going to find a way around pratically anything they try and do. |
|
|
|
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Tue Feb 26, 2008 9:57 am |
And it seems to be indicating that the combat is simple enough to be able to be scripted otherwise. A few speed tweaks is fine but in any good mud the majority of the combat decisions are made by the person, not the script.
|
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Feb 27, 2008 7:05 am |
I know it's not much of an improvement but that regex is really irking me. Hopefully I can think of a better way to improve the pattern.
Code: |
^([A*][ *][p*][r*][i*][c*][k*][l*][y*][ *][s*][t*]([i*][n*][g*]){2}[ *][o*][v*][e*][r*][c*][o*][m*][e*][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*]{2}[.*]) |
|
|
_________________ Asati di tempari! |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Feb 27, 2008 3:52 pm |
I guess the original author (Larkin, I believe)'s intention was to err on the side of caution when quoting special characters, even though you're right and they wouldn't be special inside the square brackets (note how the full stop isn't quoted in the original pattern). But does that actually improve the display time? I'm at work right now and can't check.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Feb 27, 2008 5:52 pm |
It's probably the syntax highlighting. Try turning off the syntax highlighting in the editor and see if that fixes the delay.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed Feb 27, 2008 11:17 pm |
Yes, turning off syntax highlighting makes the delay go away. Is this something that will be looked at for the next version?
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Feb 27, 2008 11:37 pm |
Not right away. The problem is that the syntax highlighting for the trigger *pattern* field is done using an editor component that just does simple pattern matching to color the text. Somehow your pattern causing this to be really slow. What I might be able to do is add a separate option for the Pattern color highlighting so that you can turn that off and leave the script syntax highlighting turned on.
The script editor uses Scintilla which then uses the low-level CMUD script parser for it's syntax highlighting, so it is very fast. |
|
|
|
|
|