[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  Odd issues with string alteration

Odd issues with string alteration

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


Posted by Onoitsu2   USA  (248 posts)  [Biography] bio
Date Tue 05 Feb 2008 11:06 AM (UTC)
Message
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
[Go to top] top

Posted by Onoitsu2   USA  (248 posts)  [Biography] bio
Date Reply #1 on Tue 05 Feb 2008 11:21 AM (UTC)

Amended on Tue 05 Feb 2008 11:45 AM (UTC) by Onoitsu2

Message
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
[Go to top] 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.


10,037 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]