Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Reg Exp and capital letters

Reg Exp and capital letters

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Neverwhere   USA  (40 posts)  Bio
Date Sat 10 Aug 2002 04:50 PM (UTC)
Message
When ever I am fighting the mud that I play on always capitalizes the names of the targets. I thought that the (\w*) would work, but the mud will not accept capital letters.

'Orc feels the true power of the psychic crush.' would send 'cast psychic crush at Orc' since 'Orc' is %1. Is there any way to send back 'cast psychic crush at orc' instead?

ChaosMUD: chaosmud.org:23
Always looking for new players/coders. Willing to train if your willing to lear. Contact Neverwhere or just mention that I sent you.
Top

Posted by Magnum   Canada  (580 posts)  Bio
Date Reply #1 on Sat 10 Aug 2002 08:40 PM (UTC)
Message
I'm afraid you'll have to use scripting for that. In Visual Basic Script, you could do it like this:

Sub_Psychic_Crush (AliasName, AliasLine, arrWildcards)
  World.Send LCase("cast psychic crush at " & arrWildcards(1))
End Sub

Alternatively, if you have a bunch of aliases that require this kind of functionality, you could do something like:

Sub SendLow (AliasName, AliasLine, arrWildcards)
  World.Send LCase(World.Replace(AliasName, "_", " ", True) & arrWildcards(1))
End Sub

You could use that second script for a whole pile of aliases. It takes the label of the alias, and turns it into part of the command to send. For example, in the case we are working with, you would give your psychic crush alias the following label:

cast_psychic_crush_at_

The "SendLow" subroutine takes the label, replaces the underscores with spaces, and then adds the wildcard to the end, all in lowercase.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #2 on Fri 16 Aug 2002 06:16 AM (UTC)
Message
This seems to have come up a couple of times now, so version 3.26 has a new trigger option "make wildcards lower-case".

If you check that, then %1 (etc.) will be forced to lower-case, so you can use them immediately without scripting.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


12,467 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.