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
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Jun 29, 2009 6:49 pm   

A little assistance for this small script, please?
 
I have a script that is currently working well. It's my own version of 'runto' in Aardwolf. What it does is goes through a database variable, and if only one match is made, it'll run to the vnum that is assigned to that key. For example, if I type 'runto insanitaria' then it runs to vnum 37221.

As I stated, the script works well. But there's one problem I have not been able to get around, and I'm not sure how to do it, if it's possible. The way I add new runto paths to the variable is with an alias that references the zone name. I take care in capitalization of my map names (I don't like looking at 'faerie tales ii' or 'realm of deneria' or such things), so all the keys in my database record are properly capitalized. I've been using %pos to match any part of the database key (like the following):

Code:
%pos( %proper( $Area), %i) OR %pos( $Area, %i) OR %pos( %upper( $Area), %i)


The problem I'm running into is that I have to type it in exactly on some areas (for instance, The DarkLight) because it doesn't recognize 'runto darklight', 'runto Darklight' or 'runto darkLight'. It only accepts 'runto DarkLight.' Is there a way for it to bypass exact matches and exact capitalization so that I can just type 'runto blah' without worrying if the H is capitalized or if the area name is actually 'Bleh Blah Blue'? Any assistance would be appreciated.

Charneus
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Jun 29, 2009 7:31 pm   
 
Do the same case operation to both parts of the comparison before you do it. Then it'll become completely case-insensitive.

That or you could use a different matching function like %match or %regex.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Jun 29, 2009 8:01 pm   
 
Thought about using %match, but then found out that it required direct matches (wouldn't accept 'deneria' for 'Realm of Deneira', for example).

I'm slightly confused by your first statement, though it could be from lack of sleep that I'm not understanding it. I'll take a look into the %regex portion of it, too. Thanks for the tips!

Charneus
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Mon Jun 29, 2009 8:16 pm   
 
%pos(%upper($Area),%upper(%i))

for example. It doesn't matter which case (upper, lower, proper), just do the same thing to both parts of the comparison.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Mon Jun 29, 2009 8:34 pm   
 
Oh duh. So simple. Thanks!
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