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
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sat Mar 01, 2008 4:13 pm   

%mapquery question
 
Bah, don't know if I can do this, but is it possible to use %mapquery to capture a portion of a roomname in a variable? I'm trying to strip characters off the end of room names in one, convenient command.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sat Mar 01, 2008 9:47 pm   
 
I've never used mapquery for this, but even if you did, you'd still need to iterate over the results, so why not do it the old-fashioned way? If you mean to strip periods in room names:

#loop %numrooms {#call %roomname(%roomvnum(%i),%subchar(%roomvnum(%i),"."))}

will do the trick. You can do other things with %pos and the %left and %right (and %leftback and %rightback) functions.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sat Mar 01, 2008 11:25 pm   
 
Did you mean to put "" at the end of that %subchar?

Never mind that, it isn't working in both forms.

hmm, could it be that you are passing a list of room vnums to %subchar and not the actual name? So maybe this instead?

#loop %numrooms {#call %roomname(%roomvnum(%i),%subchar(%roomname(%roomvnum(%i)),".",""))}
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Sun Mar 02, 2008 1:11 am   
 
Characters that aren't specified are deleted, so I didn't specify any.

Besides that, yes, what you have is what I meant. Sorry, I didn't copy the %roomname function as well.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Sun Mar 02, 2008 11:54 pm   
 
Hmm, would having this looping through 53000+ rooms make things seem like it was shutting down?
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Mar 03, 2008 1:42 am   
 
Yes, probably. Enter it on the command line and then press Shift+Esc to have CMUD run the script in its own thread. If it's in an alias or something, add the #wait command with no parameters to the start.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Dumas
Enchanter


Joined: 11 Feb 2003
Posts: 511
Location: USA

PostPosted: Mon Mar 03, 2008 2:26 am   
 
Yeah, it just needed some time. Could've sworn the first time I ran through it that it sat for a much longer time. Maybe I was just impatient.
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