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
teion
Wanderer


Joined: 03 May 2005
Posts: 72

PostPosted: Fri Feb 20, 2015 7:19 pm   

looping through map database to color rooms.
 
Hi guys I currently have a small script I wrote to check to see if a room is in a certain zone and then color it if the room description is filled. The problem is when I have more then one if condition the searching (looping) through rooms is really slow.
Let me know if there is a better way to do this.

Code:
#wh (@rnum < 50001) {#if (%roomzone(@rnum,) != 74 && %roomname(@rnum,) = "") {%roomcol(@rnum,536870911} {};#math rnum @rnum+1}


rnum is a counter for the rooms. The zone id that I am interested in is 74
Reply with quote
shalimar
GURU


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

PostPosted: Sat Feb 21, 2015 3:17 am   
 
The long delays is unavoidable, however, if you put a
#WAIT 0
before the #WHILE it should shunt the processing off into its own #THREAD so as not to lock up the client for the duration.
_________________
Discord: Shalimarwildcat
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Tue Feb 24, 2015 7:54 am   
 
You can use the %mapfilter function to select only rooms in a specific zone, then iterate over them directly.
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