Author Topic: ChatTextIntercept
MishnaoftheRangers 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: ChatTextIntercept
I am trying to have an NPC message such as "Your fellowship is now locked." cause an event in my program. So far I have been trying to use the ChatTextInterceptEventArgs.

I have used the following code to initialize:
Core.ChatBoxMessage += new EventHandler<Decal.Adapter.ChatTextInterceptEventArgs>(Core_ChatBoxMessage);

And have set up the following function:

void Core_ChatBoxMessage(object sender, Decal.Adapter.ChatTextInterceptEventArgs e)
{

if (e.Text.ToString() == mStartTrigger)
{ TimerEventStart(); }

if (e.Text.ToString() == mAnnounceTrigger)
{ TimerEventProcessor(); }

if (e.Text.ToString() == "Arena One is now available for new warriors!")
{ Leader.PluginCore.Util.WriteToChat("Saw Announcement in Colliseum.");
}

The above does not work. Is e.text.ToString() the appropriate event arg to use. e.Text also does not work.

(My third e.Text is simply to try to determine when I finally get the function correct.)

I am using C#2010 Decal 2965 and the virindi bundle with my icon on the virindi bar.

Can anyone tell me what I am doing wrong and, if my entire choice of event arg is wrong, point me to the correct one to use. Many thanks for any help.

 

-----signature-----
Link to this post
EndyTheUnsane 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: ChatTextIntercept
I think you just need e.Text, but it's been a bit since I was messing with it.

I think you want it to look more like this:

if (e.Text == "Arena One is now available for new warriors!\n")

Note the \n on the end. To equal the full chat message, I believe it needs the new line command on there. Otherwise you could use something like e.Text.StartsWith("Arena One is now available ") where it just tries to match the beginning of the incoming text and not the whole message.

 

-----signature-----
Link to this post
MishnaoftheRangers 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: ChatTextIntercept
Thanks for the ideas Endy. I still can't trigger a message to me in chat line when arbitrator speaks which is my test case. I tried both the \n and the StartsWith and neither led to a trigger. Any other suggestions would be appreciated. Thx Mish

 

-----signature-----
Link to this post
EndyTheUnsane 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: ChatTextIntercept
I may be a bit tired tonight, but should it be more like this?
if (e.Text == "Master Arbiter says, \"Arena One is now available for new warriors!\"\n")

 

-----signature-----
Link to this post
FreestyleDT 
Posts: 4,851
Registered: Oct 14, '08
Extended Info (if available)
Real Post Cnt: 4,847
User ID: 1,331,273
Subject: ChatTextIntercept
try this

if (e.Text.Contains("Your Message"))
{
}

 

-----signature-----
Gingers don't shit, they asshole puke.
lil vulno perhaps looks like a young conan obrien (very intelligent), not some kind of fucking leprachaun - Darklord
Official Get Down Forums - www.gd-gaming.com
Link to this post
MishnaoftheRangers 
Posts: ????
Registered: ????
Extended Info (if available)
Real Post Cnt: 0
User ID: 0
Subject: ChatTextIntercept
Thank you FreestyleD. That worked.

 

-----signature-----
Link to this post

Valid XHTML 1.0 Transitional Powered by PHP