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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Python
. . -> [Subject]  Get colour styles from a trigger

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Get colour styles from a trigger

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Aryzu   (12 posts)  [Biography] bio
Date Tue 20 Jan 2009 04:12 PM (UTC)  quote  ]

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

[Go to top] top

Posted by Nick Gammon   Australia  (18,769 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Tue 20 Jan 2009 07:35 PM (UTC)  quote  ]
Message
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



- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Aryzu   (12 posts)  [Biography] bio
Date Reply #2 on Tue 20 Jan 2009 10:36 PM (UTC)  quote  ]

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
[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.


1,495 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

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

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]