Re: Lower case?
"Malachi Clark" <[email protected]> Wed, 27 Apr 2005 07:55:27 -0700 (PDT)
| Newsgroups | gmane.comp.games.mud.client.lyntin |
|---|---|
| Message-ID | <[email protected]> |
Thanks for the reply, I took it upon myself to write the command, but I got stuck at the end. I feel as if I am missing something really basic, but I can already tell, it is going to be one of those kind of days. Here is the command:
#######################################
def lower_cmd(ses, args, input):
"""
Forces a string to lowercase
#lower {string}
category: commands
"""
return args["input_string"].lower()
commands_dict["lower"] = (lower_cmd, "input_string")
########################################
The problem is, that the return isnt sufficent. I am not sure how to get it to be able to be used in text that will be sent to the mud OR text that will just be sent to the client. Idealy, it should be able to do both.
Am I going to need to go for the user_filter_hook to pull this off? Seems like overkill if that is the case.
On a related, yet different note, is there a way to expand commands inside of normally type (going to the mud) text? Like:
"say #lower {bob} is cool" or similar?
> Fiddlesticks. I know this issue has come up before, but I can't remember
> what we said.
>
> You could definitely create a variable, run the #math command (which
> seems weird, but all it does is a Python eval) on it, and then use that
> for wave. Something like this (and my Lyntin macro stuff is really
> rusty):
>
>
> #action {^%1 waves at you.} {#math {wavetarget} {"%1".lower()};wave
> $wavetarget}
>
>
> Or something along those lines.
>
>
> Another possibility is to write a command that handles the lower casing.
> That would be more portable in the long run should:
>
>
> 1) another version of Lyntin come out, and
> 2) it has a different implementation of #math
>
>
> Hope that helps--
> /will
>
>
>
> On Tue, 26 Apr 2005, Malachi Clark wrote:
>
>>
>> Anyone know a good way to get a variable to lowercase?
>>
>>
>> Say for example:
>>
>>
>> #action {^%1 waves at you.} {wave %1}
>>
>>
>> But I want %1 to be forced to lowercase before being sent to the mud.
>> Any thoughts?
>>
>
-------------------------------------------------------
SF.Net email is sponsored by: Tell us your software development plans!
Take this survey and enter to win a one-year sub to SourceForge.net
Plus IDC's 2005 look-ahead and a copy of this survey
Click here to start! http://www.idcswdc.com/cgi-bin/survey?id5hix