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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Colors

Colors

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by CanadianChris   (2 posts)  [Biography] bio
Date Thu 03 Jun 2004 12:57 AM (UTC)
Message
Hi there,

I'm having some trouble setting up a script that has a trigger that is color-sensitive.

Say the trigger is waiting for a blue line, what is the code I use for the trigger?

Thanks :)
[Go to top] top

Posted by CanadianChris   (2 posts)  [Biography] bio
Date Reply #1 on Thu 03 Jun 2004 01:03 AM (UTC)
Message
I know how to set the trigger colors using the user-interface. But I want to know how to code the actual script for it instead of doing it through MUSH itself.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Thu 03 Jun 2004 01:39 AM (UTC)
Message

One approach is to use ImportXML. This lets you set up things (like triggers) using the XML syntax that is used in the world file. What you could do is set one up using the GUI user-interface, and then copy it to the clipboard. This would give you the format. Then use that function to create additional ones whenever you want.

Another approach is to use SetTriggerOption - this lets you change trigger configurations for the things that are not directly supported by AddTrigger.


- Nick Gammon

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

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #3 on Thu 03 Jun 2004 02:03 AM (UTC)
Message
Youll probably going to end up using the SetTriggerOption, because it sounds like youre using a script to make a trigger, or change the match color, or whatnot.

Via scripting, the XML thing would require a lot of work you dont need.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 03 Jun 2004 10:26 PM (UTC)
Message
A lot of work? Just a single call, to set up the trigger exactly how you want it. Otherwise you have to add it, and then maybe do three or four SetTriggerOption calls to get it exactly right.

- Nick Gammon

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

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #5 on Fri 04 Jun 2004 12:01 AM (UTC)
Message
Its a lot of overhead to importxml via a script, to just change an option.

I guess it depends on whether hes changing his trigger to match on different colors, or if hes making new ones.

I was under the impression he was changing it via script.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #6 on Fri 04 Jun 2004 10:15 PM (UTC)
Message
In the debug build of MUSHclient, which is typically about 5 times as slow as the release build, I got this figure importing a fairly complex trigger:


Time taken: ImportXML = 0.000726 seconds.


That is less than 1/1000 th. of a second to import a trigger via ImportXML.

Hang on a tic, I'll check the release build ...


Time taken: ImportXML = 0.000189 seconds.


Yep, about 4 times as fast. So, you could import over 5,000 triggers using ImportXML in under a second. Since I am assuming he will want to do a couple every now and then, I don't think the overhead is a big worry.

Plus, as I said, to do an AddTrigger, followed by four or five SetTriggerOption calls, will probably take as long, due to the overhead of setting up scripting calls inside COM.

- Nick Gammon

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

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #7 on Sat 05 Jun 2004 07:54 AM (UTC)

Amended on Sat 05 Jun 2004 08:05 AM (UTC) by Flannel

Message
My point was, if he wasnt adding, merely changing a trigger, as if sometimes he wanted to match on red, and others on blue. Anyway, its moot.

I was talking about scripting overhead, not resources, simply ease in coding. But again, its been covered.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[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.


16,828 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]