![](templates/Classic/images/spacer.gif) |
shalimar GURU
![](images/avatars/114658559147aeed8fee539.gif)
Joined: 04 Aug 2002 Posts: 4717 Location: Pensacola, FL, USA
|
Posted: Sat Jun 07, 2008 1:21 am
local dbvar |
Is there a better way to work with local dbvars?
This seems very slow, i normally get a few seconds of lag when dealing with over 100 items
<trigger priority="5550" id="555">
<pattern>^{In|On|Under|Behind|Peering into} the (*) you see (*).</pattern>
<value>#GAG
$container=%1
$contents=%2
$contents=%replace( {$contents}, " and ", "|")
$contents=%replace( {$contents}, ", ", "|")
$contents=%countlist( $contents)
#SAY Inside the $container you see
#LOOPDB $contents {#SAY %format(&50s, %key) %if(%val!=1, ~(x%val~))}</value>
</trigger>
changing it to:
#LOOPDB $contents {$contents2=%concat($contents2, %if($contents2, ", "), %key, %if(%val!=1, " (x"), %if(%val!=1, %val), %if(%val!=1, ")"))}
#SAY {$container has: $contents2}
seems even slower |
|
_________________ Discord: Shalimarwildcat |
|
|
![](templates/Classic/images/spacer.gif) |
Anaristos Sorcerer
Joined: 17 Jul 2007 Posts: 821 Location: California
|
Posted: Sat Jun 07, 2008 2:13 am |
I copied this trigger and its script into my setting editor. CMUD bombed (posted on another thread). Also, when I try to do a check syntax or reformat the script, nothing happens. I created a new blank trigger and copied the pattern and the script to the new blank setting and still the problem persisted.
(Sorry Shalimar, I am trying to work on your post but these things are happening)
EDIT: I deleted the setting. The entry remains in the settings tree, though selecting it does not bring it into the settings window. So the settings is gone but its tree entry isn't. The Editor must be closed and re-opened for the tree view to show the proper contents. |
|
_________________ Sic itur ad astra. |
|
|
![](templates/Classic/images/spacer.gif) |
Fang Xianfu GURU
![](images/avatars/1763170544a2093e7e85da.gif)
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jun 07, 2008 7:49 am Re: local dbvar |
shalimar wrote: |
#LOOPDB $contents {$contents2=%concat($contents2, %if($contents2, ", "), %key, %if(%val!=1, " (x"), %if(%val!=1, %val), %if(%val!=1, ")"))} |
It's probably not compiling because of this quote and bracket that've been swapped around, hence the slowness. |
|
|
![](templates/Classic/images/spacer.gif) |
shalimar GURU
![](images/avatars/114658559147aeed8fee539.gif)
Joined: 04 Aug 2002 Posts: 4717 Location: Pensacola, FL, USA
|
Posted: Sat Jun 07, 2008 9:30 am |
no, its none that way on purpose with the three %ifs to get the full look i want because otherwise %val wont be evaluated, thats the opening parenthesis of what i want to be displayed on the screen.
What and how it displays is not at question here, the script does in fact work.
The problem is the lag, or delay i get between the trigger firing and when the #SAY goes off. (Screen freezes with the big block of text only partially showing, then when the lag is up, it finally gags and says. I cant even type during it.)
I mention the code only insofar as someone knows a quicker way of processing this so i get a list of items displayed how i want: a frog (x3), a red duck, a blue frisbee (x5), etc |
|
_________________ Discord: Shalimarwildcat |
|
|
![](templates/Classic/images/spacer.gif) |
Vijilante SubAdmin
![](images/avatars/7230815434153eca6be3ad.gif)
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Jun 07, 2008 2:00 pm |
Code: |
$contents=%subregex(%2 ," and |, ","|")
$contents=%countlist($contents)
$contents2=%leftback(%subregex($contents,"(?:(=1)|=(\d+))\|","(?(1)| (x\2)), "),2) |
|
|
|
![](templates/Classic/images/spacer.gif) |
shalimar GURU
![](images/avatars/114658559147aeed8fee539.gif)
Joined: 04 Aug 2002 Posts: 4717 Location: Pensacola, FL, USA
|
Posted: Sun Jun 08, 2008 12:54 am |
That is several times faster that my current script, i can see how knowledge of regex can help alot.
Thanks. |
|
_________________ Discord: Shalimarwildcat |
|
|
![](templates/Classic/images/spacer.gif) |
|
|
|
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
|
|