Get colour styles from a trigger

Posted by Aryzu on Tue 20 Jan 2009 04:12 PM — 3 posts, 17,172 views.

#0
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

Amended on Tue 20 Jan 2009 04:14 PM by Aryzu
Australia Forum Administrator #1
Yes you can, it is just a bit fiddlier. I answered a similar question in some detail in this post:

http://www.gammon.com.au/forum/bbshowpost.php?id=7842


#2
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