Odd issues with string alteration

Posted by Onoitsu2 on Tue 05 Feb 2008 11:06 AM — 2 posts, 13,812 views.

USA #0
I would like to be able to type up a multi-line message in the input area of a world, and then press a macro button to take said multi-line information (I know to type ctrl+enter to put a real carriage return) and alter every new line whatever combination of chars it uses (I know it is 2 control chars), and replace them with %r, and then set that back via the SetCommand function, or at very least copy it to clipboard.

Now doing it via the immediate box works fine, but trying to have a macro do things from an alias is just not working, it keeps complaining about the replacement of "\r%c" using string.gsub.

I was wondering if there were some way that I could do this, even if it required me typing the message in a notepad window named Mail, and then going back to the world and typing a command or using a macro, and it would get the notepad text, and then parse/alter it, then send the string to the SetCommand function.

-Onoitsu2
USA #1
Never mind I think I took care of the issue by using this instead...

message = utils.editbox ( "Enter @Mail Message", "Enter Message:")
message_parse = Replace(message,"\\r\\n","%%r",true)
SetClipboard(message_parse)

[Edit: Even Better Script...
person = utils.inputbox ( "Enter Person's Name", "Enter Addresse:")
if person == nil then return end -- if
message = utils.editbox ( "Enter @Mail Message", "Enter Message:")
if message == nil then return end -- if
message_parse = Replace(message,"\\r\\n","/",false) -- Topic First Line
message_parse = Replace(message_parse,"\\r\\n","%%r",true)
SetCommand("@mail ".. person.."="..message_parse)
]

-Onoitsu2