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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Python
➜ Get colour styles from a trigger
|
Get colour styles from a trigger
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Aryzu
(12 posts) Bio
|
| Date
| Tue 20 Jan 2009 04:12 PM (UTC) Amended on Tue 20 Jan 2009 04:14 PM (UTC) by Aryzu
|
| Message
| Hi,
I want to write some lines, matched by a trigger and send to script, draw on a floating window.
But I have one big problem: How can I get the colour or style informations of that line?
I have looked at Nick Gammon Map script and found a relevant part:
His trigger is a bit simpler than mine, but exacly analogue:
<trigger
enabled="y"
match="<MAPSTART>"
script="map_redirect"
omit_from_output="y"
name="map_start"
sequence="100"
>
</trigger>
You can see, that he is calling map_redirect of a Lua-Script (I have removed some non relevant parts):
function map_redirect (name, line, wildcards, styles)
local len = #line
table.insert (map_lines, styles)
max_width = math.max (max_width, len)
end -- if
end -- function map_redirect
You can see that the function provide 4 parameter. But when I set up the same function in Python. I get an error, that only 3 parameters are allowed.
Do I have to enable something in the script to get the colour work? On the documentation for triggers, calling a script file, I have found:
"Lua only - a table of all the styles in the line"
Can I get the style information of the line anyway?
Aryzu
| | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Tue 20 Jan 2009 07:35 PM (UTC) |
| Message
| |
| Posted by
| Aryzu
(12 posts) Bio
|
| Date
| Reply #2 on Tue 20 Jan 2009 10:36 PM (UTC) Amended on Tue 20 Jan 2009 10:37 PM (UTC) by Aryzu
|
| Message
| it works, thanks!
Anyway I have decided to move the whole thing, wich has quite some triggers, to a extra plugin in order to cleanup the script file. Furthermore I will write it in Lua for better distributability, because it just needs some basic calls.
Aryzu | | 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.
15,146 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top