bool ReplaceCallback(ColorMessage msg, Match match, object userdata)
        {
            if (m_subst == null)
            {
                m_subst = new TriggerManager.TriggerSubst(m_script);
            }

            List <object[]> inserts = new List <object[]>();

            while (match.Success)
            {
                string str = m_subst.Replace(msg.Text, match);
                inserts.Add(new object[] { match.Index, match.Length, str });
                match = match.NextMatch();
            }

            inserts.Reverse();

            foreach (object[] insert in inserts)
            {
                int    idx = (int)insert[0];
                int    len = (int)insert[1];
                string str = (string)insert[2];
                msg.Remove(idx, len);
                msg.Insert(idx, str);
            }

            return(false);
        }
 public void Compile()
 {
     if (m_triggerType == TriggerType.Script)
     {
         string parsedScript = TriggerManager.TriggerSubst.ReplaceScript(m_script);
         m_scriptAction = PythonInterface.PythonEngine.CreateMethod <TriggerAction>(parsedScript);
     }
     else
     {
         m_subst = new TriggerManager.TriggerSubst(m_script);
     }
 }
        bool SendCallback(ColorMessage msg, Match match, object userdata)
        {
            if (m_subst == null)
            {
                m_subst = new TriggerManager.TriggerSubst(m_script);
            }

            string str = m_subst.Replace(msg.Text, match);

            if (PythonInterface.Network.IsConnected)
            {
                PythonInterface.Network.SendLine(str);
            }
            return(false);
        }