Re: Lower case?
will guaraldi <[email protected]> Wed, 27 Apr 2005 10:12:41 -0500 (CDT)
| Newsgroups | gmane.comp.games.mud.client.lyntin |
|---|---|
| Message-ID | <[email protected]> |
On Wed, 27 Apr 2005, Malachi Clark wrote:
>
> 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 have no idea why you think this will work--Lyntin doesn't look at the
return values for commands executed.
It seems you're trying to build a command that takes an input string,
lowercases the whole thing, and then passes it back into Lyntin's input
handling stuff.
If that's the case, then you should do something like this:
def lower_cmd(ses, args, input):
input_string = args["input_string"]
input_string = input_string.lower()
exported.lyntin_command(input_string, 1, ses)
That will pass the lower-cased input string into the Lyntin input handling
routine. It's very similar to how aliases work, except the alias
expansion happens in the user_filter_hook.
> 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?
No, commands don't get expanded like variables do. Lyntin checks to see
if the user input is a command by looking at the first character. If the
first character is a command char, then the entire user input is handled
as a Lyntin command.
Hope that helps!
/will
-------------------------------------------------------
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?id=105hix