mistahmikey
New Member
- Joined
- Jun 29, 2015
- Messages
- 161
I am trying to modify the TalkTo tag behavior to work with an NPC that requires a long series of question popups to be answered. I am using y2crazy's TalkToPlus tag approach for the most part, where he inherits from TalkTo and overrides TalkTo.CreateBehavior to provide Quest-specific dialog interaction. I have modified his TalkToPlus.CreateBehavior to sequence the correct answers to all the dialogs that pop up during Quest step 4. The problem I am seeing is that it appears RB is somehow interacting with the NPC outside of my code. Here is the tag, which has been reduced to just interact with the NPC at the proper quest step:
Right off the bat something unexpected happens. After I interact with the NPC, the resulting talk dialogs are getting automatically dismissed somehow, even though I have suppressed that behavior by not calling TalkTo.CreateBehavior at the bottom of my PrioritySelector. There is no code associated with the TalkToPlus tag that is calling Talk.Next(). I have no idea how these dialogs are getting dismissed.
However, I am able to answer the first five questions, and I see the log messages of their associated Decorators indicating my code is doing the answering. Again, the talk dialogs that result after answering a question are being magically dismissed. Once it gets to question 5, the remainder of the question dialogs that get popped up are being automatically answered somehow outside of my code - I see no more of the log messages that would occur if my code was selected to answer them, yet the quest progresses forward, albeit incorrectly, and winds up getting into an endless question/answer loop due to the wrong "auto" answers. Here is the log snippet from running the code:
I have tried removing all 3rd party plugins and botbases (except for ExBuddy) but it doesn't make any difference. Any ideas as to how RB is interacting with the NPC outside of my tag code would be appreciated.
Thanks.
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Media;
using System.Diagnostics;
using Clio.Utilities;
using Clio.XmlEngine;
using ff14bot.Behavior;
using ff14bot.Helpers;
using ff14bot.Managers;
using ff14bot.Navigation;
using ff14bot.NeoProfiles;
using ff14bot.RemoteWindows;
using TreeSharp;
using Action = TreeSharp.Action;
namespace ff14bot.NeoProfiles.Tags
{
[XmlElement("TalkToPlus")]
class TalkToPlusTag : TalkToTag
{
private int question = -1;
private void Log(string text, params object[] args)
{
Logging.Write(Colors.White, "[TalkToPlus] " + text + " ", args);
}
protected override void OnResetCachedDone()
{
question = -1;
base.OnResetCachedDone();
}
protected override Composite CreateBehavior()
{
return new PrioritySelector(
new Decorator(ret => QuestId == 67669 && QuestLogManager.GetQuestById(QuestId).Step == 4 && question == -1,
new Action(r =>
{
GameObjectManager.GetObjectByNPCId((uint)NpcId).Interact();
question = 1;
Log("QuestId 67669, Step 4, Interact");
return RunStatus.Success;
})
),
new Decorator(ret => question == 1 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("The killer is among us"))
{
Log("QuestId 67669, Step 4, Question {0}, The killer is among us",question);
question = 2;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 2 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("Yes"))
{
Log("QuestId 67669, Step 4, Question {0}, Yes",question);
question = 3;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 3 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("mixed in his drink"))
{
Log("QuestId 67669, Step 4, Question {0}, mixed in his drink",question);
question = 4;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 4 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("smell his glass"))
{
Log("QuestId 67669, Step 4, Question {0}, smell his glass",question);
question = 5;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 5 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("already on the table"))
{
Log("QuestId 67669, Step 4, Question {0}, already on the table",question);
question = 6;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 6 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("phial"))
{
Log("QuestId 67669, Step 4, Question {0}, phial",question);
question = 7;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 7 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("Senor"))
{
Log("QuestId 67669, Step 4, Question {0}, Senor",question);
question = 8;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 8 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("true killer"))
{
Log("QuestId 67669, Step 4, Question {0}, true killer",question);
question = 9;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 9 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("gambling habit"))
{
Log("QuestId 67669, Step 4, Question {0}, gambling habit",question);
question = 10;
}
return RunStatus.Success;
})
),
new Decorator(ret => question == 10 && SelectString.IsOpen,
new Action(r =>
{
if (SelectString.ClickLineContains("Roland"))
{
Log("QuestId 67669, Step 4, Question {0}, Roland",question);
question = -1;
}
return RunStatus.Success;
})
)
);
}
}
}
Right off the bat something unexpected happens. After I interact with the NPC, the resulting talk dialogs are getting automatically dismissed somehow, even though I have suppressed that behavior by not calling TalkTo.CreateBehavior at the bottom of my PrioritySelector. There is no code associated with the TalkToPlus tag that is calling Talk.Next(). I have no idea how these dialogs are getting dismissed.
However, I am able to answer the first five questions, and I see the log messages of their associated Decorators indicating my code is doing the answering. Again, the talk dialogs that result after answering a question are being magically dismissed. Once it gets to question 5, the remainder of the question dialogs that get popped up are being automatically answered somehow outside of my code - I see no more of the log messages that would occur if my code was selected to answer them, yet the quest progresses forward, albeit incorrectly, and winds up getting into an endless question/answer loop due to the wrong "auto" answers. Here is the log snippet from running the code:
Code:
[13:48:56.911 V] [Poi.Clear] Reason: Current behavior changed to TalkToPlusTag: IsDone: False, NpcId: 1017051, InteractDistance: 5, BypassTargetChange: False, XYZ: <53.18424, 20.99973, 77.31863>, NPC: Ollier 0x14228E50, HighPriority: False, LineNumber: 315, InCombat: False, QuestId: 67669, StepId: 0, PostCombatDelay: 0, QuestName: And Then There Were Some, IsDoneCache: False, Behavior: TreeSharp.PrioritySelector, .
[13:48:56.911 D] Replaced hook [ProfileOrderBehavior_Hook] 1605b537-7d86-40c1-ad41-2f28760f526f
[13:48:56.913 D] Interacting with Ollier 0x14228E50
[13:48:56.913 N] [TalkToPlus] QuestId 67669, Step 4, Interact
[13:48:57.841 N] [TalkToPlus] QuestId 67669, Step 4, Question 1, The killer is among us
[13:48:58.673 N] [TalkToPlus] QuestId 67669, Step 4, Question 2, Yes
[13:49:21.492 N] [TalkToPlus] QuestId 67669, Step 4, Question 3, mixed in his drink
[13:49:27.719 N] [TalkToPlus] QuestId 67669, Step 4, Question 4, smell his glass
[13:49:37.112 N] [TalkToPlus] QuestId 67669, Step 4, Question 5, already on the table
I have tried removing all 3rd party plugins and botbases (except for ExBuddy) but it doesn't make any difference. Any ideas as to how RB is interacting with the NPC outside of my tag code would be appreciated.
Thanks.
Last edited: