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
shalimar
GURU


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

PostPosted: 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(&amp;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
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: 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.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
shalimar
GURU


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

PostPosted: 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
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: 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)
Reply with quote
shalimar
GURU


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

PostPosted: 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
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