Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, 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
➜ Capturing ANSI
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| DarkSlayer
(5 posts) Bio
|
Date
| Sat 11 Nov 2006 11:12 PM (UTC) |
Message
| I was wondering if it is possible to capture only the ansified sections of a line and note/appendtonotepad them?
For example, (x) indicates x has ansi.
A (m)ulti(c)oloured li(n)e!
What I want to do is capture the m, c and n... possible?
Using JScript. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #1 on Sun 12 Nov 2006 04:13 AM (UTC) |
Message
| |
Posted by
| DarkSlayer
(5 posts) Bio
|
Date
| Reply #2 on Mon 13 Nov 2006 03:58 AM (UTC) |
Message
| Any chance you could give me an example?
Not sure how I could get the particular letters. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #3 on Tue 14 Nov 2006 07:41 PM (UTC) Amended on Tue 14 Nov 2006 07:42 PM (UTC) by Nick Gammon
|
Message
| It is easiest in Lua because that gives a trigger the style runs for the triggered line. I will show you the idea in Lua, you can adapt that to Jscript if you want.
The trigger (currently matches everything):
<triggers>
<trigger
enabled="y"
match="*"
script="my_trigger"
sequence="100"
>
</trigger>
</triggers>
And in my script file I had this code:
function my_trigger (name, line, wildcards, styles)
for k, v in ipairs (styles) do
print ("Style ", k,
" contents = ", v.text,
" colour = ", RGBColourToName (v.textcolour))
end -- for loop
end -- my_trigger
Running this on my prompt line gives me this:
Style 1 contents = < colour = silver
Style 2 contents = 100/100hp colour = yellow
Style 3 contents = 143/143m colour = cyan
Style 4 contents = 210/210mv colour = lime
Style 5 contents = 0/343xp colour = magenta
Style 6 contents = > colour = silver
You can see from this that the contents (the text of the style) is shown individually for each one, followed by its colour. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| DarkSlayer
(5 posts) Bio
|
Date
| Reply #4 on Wed 15 Nov 2006 05:43 AM (UTC) |
Message
| Thanks alot. :)
I'll see how I go making a jscript version.
Cheers
-DS | Top |
|
Posted by
| Onoitsu2
USA (248 posts) Bio
|
Date
| Reply #5 on Wed 15 Nov 2006 06:20 AM (UTC) |
Message
| Lots of luck to you in making the jscript version, but I don't think it will work, as the STYLES parameter that is passed into the function only exists in LUA.
In order to do it, you would have to get the number of the last line (the line that triggered the script to be called) and from there do a lot of mucking and tweaking of commands to parse it.
I suggest you start learning LUA, as it is the most powerful scripting language for plugin purposes, and it is not all that difficult, as if you know one language, you can easily transition its logic into LUA.
Again, good luck to you,
Laterzzz,
Onoitsu2 | Top |
|
Posted by
| DarkSlayer
(5 posts) Bio
|
Date
| Reply #6 on Thu 16 Nov 2006 11:37 PM (UTC) |
Message
| Is it possible to use a LUA plugin while I use jscript for everything else? I've got way too much script to change to LUA... | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #7 on Fri 17 Nov 2006 12:52 AM (UTC) |
Message
| Yes, every plugin can be in a different language. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| DarkSlayer
(5 posts) Bio
|
Date
| Reply #8 on Fri 17 Nov 2006 02:22 AM (UTC) |
Message
| Thanks a ton for the help guys. :)
DS | 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.
23,832 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top