VaultNetwork.net Vault Network Boards
Author Topic: ChatTextIntercept [Locked]
MishnaoftheRangers
Posts: 28
Registered:
I am trying to have an NPC message such as "our 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.
EndyTheUnsane  1 star
Posts: 51
Registered:
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.
MishnaoftheRangers
Posts: 28
Registered:
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
EndyTheUnsane  1 star
Posts: 51
Registered:
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"
FreestyleDT  2 stars
Posts: 260
Registered: 2008-10-14 14:18:41
try this

if (e.Text.Contains("our 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
MishnaoftheRangers
Posts: 28
Registered:
Thank you FreestyleD. That worked.

VaultNetwork.net is an independently operated community forum and is not affiliated with, endorsed by, or technically based on IGN, GameSpy, FilePlanet, GameStats, or the former IGN/GameSpy Vault Network.
References to VaultNetwork.net mean this site/domain. VNBoards-style presentation is a visual homage only. By using this site, you agree to the forum rules.