The gCLI appears to collapse all whitespace into a single space for me, I had to use regex to check the quantity of spaces (hence why the thread title says adds a space). But using your code still returns "(StDoodle )" for me (with that space shown).
Edit to add:
The following code will show the number of trailing spaces in my_name():
ash int i = 0; matcher m = create_matcher("\\s*$",my_name());if (m.find()) print(length(m.group()));
Using Java v1.6.0_25b06
Noticed the error because my breakfast script gave the abort error that should only occur if I try to run it on my multi (or any other character technically, but I've never logged into anything but StDoodle and Astris). I had thought I'd seen said error before, but I'm not 100% and never looked into it until today.
For the record, the above code returns "3" for me.
Okay, did a fresh install and I'm getting the expected 0 result.... Something's wonky in a setting somewhere? *shrug* I'd love to have some idea how to fix this, if anyone has a clue on something that doesn't involve losing all of my settings. Weird.
Edit: Okay, thought I'd check, and low and behold, the login box had the extra spaces too. I dunno how they got there; I'm guessing a mis-type at some point, though whitespace errors from the program I use for syncing mafia between computers may be a possibility. I imagine the "actual" login process trims trailing whitespace, so it works as normal with KoL, but mafia uses the entire contents of the login text box for storing your name. Or, this could be the reverse of what happened. Regardless, trimming the spaces in the login box appeared to fix things. Weird, weird, weird.