Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Entire forum
➜ MUSHclient
➜ General
➜ Copy ansi color from output as BBCode
Copy ansi color from output as BBCode
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Khonsu
(5 posts) Bio
|
Date
| Mon 08 Feb 2021 12:34 PM (UTC) |
Message
| Hello. I want to start off by saying have almost no knowledge in Lua, or other languages really, and decided today to modify the ansi color copier to work for our forums and copy them as BBCode.
I have modified the copycolourcodes.xml and lotj_colours.lua to instead of copying &R &G etc to instead copy the codes with "[/color][color=#800000]" for the different colors. This works perfectly it seems. Edited out the line about added &w to the end since we don't need it for posting.
The problem I am running into, I think because of my limited knowledge on how to make this script, is that we will always have the [/color] at the very beginning of a line. This works great to end the color before a new color begins, but is there a simple way to have it remove the first [/color]?
For example:
&YYou sense a change in the &Glife &Yforces surrounding you.&w'&w
becomes:
[/color][color=#FFFF00]You sense a change in the [/color][color=#00FF00]life [/color][color=#FFFF00]forces surrounding you.[/color][color=#C0C0C0]'
| Top |
|
Posted by
| Nick Gammon
Australia (23,070 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 08 Feb 2021 07:56 PM (UTC) |
Message
| Can you please provide a link to where you found those files? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Khonsu
(5 posts) Bio
|
Date
| Reply #2 on Mon 08 Feb 2021 09:41 PM (UTC) Amended on Mon 08 Feb 2021 09:42 PM (UTC) by Khonsu
|
Message
| |
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #3 on Tue 09 Feb 2021 02:57 AM (UTC) Amended on Tue 09 Feb 2021 03:07 AM (UTC) by Fiendish
|
Message
| The one you have came from me originally (for Aardwolf) and then it looks like someone modified it for a different game. The problem is that it's really built for a kind of system that only has color codes at the beginning, not ones that open/close on both sides of a text like you want.
There are also a bunch of things in the .lua file that definitely won't work that you don't need anyway (and so might benefit from just getting rid of).
I think instead of starting from the one you were given you should instead start from the one in http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=8821
No matter what, you're going to have to manually adjust the result to remove the [/color] at the front and add one to the end.
In Lua you can do that with something like (right before the line that says SetClipboard(copystring))
if copystring:sub(1,8) == "[/color]" then
copystring = copystring:sub(9).."[/color]"
end
|
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Khonsu
(5 posts) Bio
|
Date
| Reply #4 on Wed 10 Feb 2021 12:36 AM (UTC) |
Message
| Awesome that works perfectly.
I tried to use the one from the forum post you listed but I got some errors. I'll dig into it more later and see if I can get it work.
Thank you guys again.
If anyone wants a copy of these files I'll keep the drive link I posted earlier alive as long as that's OK. | 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.
13,684 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top