|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: 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.
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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. |
|
|
|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: 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)),".",""))} |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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. |
|
|
|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: Sun Mar 02, 2008 11:54 pm |
Hmm, would having this looping through 53000+ rooms make things seem like it was shutting down?
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: 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.
|
|
|
|
Dumas Enchanter
Joined: 11 Feb 2003 Posts: 511 Location: USA
|
Posted: 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.
|
|
|
|
|
|