 |
donki1 Beginner
Joined: 02 Oct 2004 Posts: 12
|
Posted: Wed May 03, 2006 9:04 am
what is wrong with this trigger? |
#TRIGGER {%seee%s*$%seeeee%se%s*$%se~\eee~/~.%s*$%see~\~@~/ee%s*$%seee~+eee%s*$%see~|ee%s*$%si~=i%s*$%si~=%s*$%se~|%s*$} {whatever} "" {param=99|disable}
When i am at the given location this trigger fires, and suddenly zmud becoming very very very slow. Basically it crashes.
eee
eeeee e
e\eee/.
ee\@/ee
eee+eee
ee|ee
i=i
i=
e|
I have other triggers with pattern like this:
^%sEEe%s*$%sEEEEE%s*$%sEE~@.ee%s*$%seeeE..%s*$%seeee%s*$%seee%s*$
And they works fine.
What is wrong? |
|
|
 |
edb6377 Magician

Joined: 29 Nov 2005 Posts: 482
|
Posted: Thu May 04, 2006 4:10 am |
could be a good number of things. why param=99 and the "WHATEVER" part might matter depending on what you are trying to do that is taking a lot of compiling cycles
|
|
_________________ Confucious say "Bugs in Programs need Hammer" |
|
|
 |
donki1 Beginner
Joined: 02 Oct 2004 Posts: 12
|
Posted: Thu May 04, 2006 5:13 pm |
#TRIGGER {^%seee%s*$%seeeee%se%s*$%se~\eee~/~.%s*$%see~\~@~/ee%s*$%seee~+eee%s*$%see~|ee%s*$%si~=i%s*$%si~=%s*$%se~|%s*$} {#var lastpath {};#say Position set to [oak].} "" {param=99}
If i randomly remove some %s before *, then it works properly.
but if i finish each line with %s*$ then it lags like hell.
(2 GB ram, 3.4 GHz hypertread Intel processor.)
Why does this happen? |
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Fri May 05, 2006 5:46 am |
It's probably just the challenge of matching that particular pattern several times. I'm not sure how the underlying processing works but %s* will have to be checked multiple times for any number of spaces since it also matches the empty string. So if you have that pattern several times, processing can slow down alot. If there are only spaces after the end your pattern are more efficient match would be '%s$' which matches 1 or more spaces to the end of the line vs. '%s*$' which matches 1 or more spaces, followed by any character 0 or more times, followed by the end of the line.
|
|
_________________ Asati di tempari! |
|
|
 |
Guinn Wizard
Joined: 03 Mar 2001 Posts: 1127 Location: London
|
Posted: Fri May 05, 2006 2:23 pm |
Not sure why you'd be matching %s*$. Every line will eventually terminate, so matching *$ surely is time wasted?
Why not use #condition for each line, and ditch the * matching. Something like.
Code: |
#TRIGGER {%seee%s} {}
#COND {%seeeee%se%s} {}
#COND {%se~\eee~/~.%s} {}
#COND {%see~\~@~/ee%s} {}
#COND {%seee~+eee%s} {}
#COND {%see~|ee%s} {}
#COND {%si~=i%s} {}
#COND {%si~=%s} {}
#COND {%se~|%s} {#say Whatever} |
Using your original trigger and testing with
#say %secs
" eee TestOutput 123 "
" eeeee e TestOutput 123 "
" e\eee/. TestOutput 123 "
" ee\@/ee TestOutput 123 "
" eee+eee TestOutput 123 "
" ee|ee TestOutput 123 "
" i=i TestOutput 123 "
" i= TestOutput 123 "
" e| TestOutput 123 "
#say %secs
Then it fires but was taking about 1400 milliseconds to fire (this is on a 1.9Ghz Pentium-M, so probably just as quick as the 3.4Ghz P4)
If you change it about and use the conditions above then it takes at worst 20 milliseconds, so around 700 times quicker.
It's a bit more of a chore to break things up into conditions, but it saves a hell of a lot of processing.
Guinn |
|
_________________ CMUD Pro, Windows Vista x64
Core2 Q6600, 4GB RAM, GeForce 8800GT
Because you need it for text... ;) |
|
|
 |
donki1 Beginner
Joined: 02 Oct 2004 Posts: 12
|
Posted: Fri May 05, 2006 8:13 pm |
thanks
|
|
|
 |
|
|