// the following porting code worked for me in my test
var locationsToPort = ff14bot.Managers.WorldManager.AvalibleLocations;
ff14bot.Managers.WorldManager.Teleport(locationsToPort[0].Name);
Could you do proper polling or make it so that the api doesn't recreate the info everytime you poll the api. Makes it a lot harder to code plugins when I have to figure out polling instead of the already built api that has most of that info.
What?
PartyManager.AllMembers
Your currently fetch the most current values from memory when a consumer requests them. For example, if I do:
Code:PartyManager.AllMembers
I receive the latest copy from memory -- this is desirable in some cases but it requires myself to implement my own polling. This means if I ask for the value now, assign it a UserControl and have it monitor that reference, I can't do that. This is because the value is only updated when I make an explicit call to the getter. This causes two complications:
1: The data isn't being updated in the background by anything. Is this by design, and up to the author to solve?
2: This means data binding cannot possibly work. This is because nothing is ever truly changed.
using (Core.Memory.TemporaryCacheState(true))
{
somefield = PartyMemberobj.CurrentHealth;
}
We do caching at the memory library level. The bot caches data for 1 tick and then clears the cache. If the bot is not 'started' then youll run into issues where youll get objects that don't update. If your storing the object results from the partymanager you can work around this by wrapping where you update the fields with
Code:using (Core.Memory.TemporaryCacheState(true)) { somefield = PartyMemberobj.CurrentHealth; }
example this quick a dirty.Can you post an example of how you databinded partymanager to a user control please?
using System.Windows.Forms;
using ff14bot.Managers;
namespace Reborn_Healer.Controls
{
public partial class test : UserControl
{
private PartyMember _member;
public void DataBind()
{
progressBar1.DataBindings.Add("Maximum", Member, "MaxHP");
progressBar1.DataBindings.Add("Value", Member, "CurrentHP");
}
public test(PartyMember member)
{
_member = member;
InitializeComponent();
}
public PartyMember Member
{
get { return _member; }
set { Member = value; UpdateUI(); }
}
public void UpdateUI()
{
DataBind();
}
}
}
public void OnPulse()
{
UpdateForm();
}
public void UpdateForm()
{
if (Core.Me.InCombat)
{
using (Core.Memory.TemporaryCacheState(true))
{
MethodInvoker action = () => _form.progressBar1.Value = (int)Core.Me.CurrentHealthPercent;
_form.BeginInvoke(action);
}
}
}
I'm trying to understand and learn this, i'm currently using this to update my form - it works for the first tick but then doesn't constantly update the progress bar with my health.
Code:public void OnPulse() { UpdateForm(); } public void UpdateForm() { if (Core.Me.InCombat) { using (Core.Memory.TemporaryCacheState(true)) { MethodInvoker action = () => _form.progressBar1.Value = (int)Core.Me.CurrentHealthPercent; _form.BeginInvoke(action); } } }
I'm just trying to get a form updated in real time with info from the game.
are you doing that inside of the one .cs file that inherits the main plugin? I tried to keep those separated. I sent you a Skype request easier to chat on there then forums lol. But what I can do is fix your code to bare minimal of what you want your form or w/e to do atm and zip it up and put on forums ill edit it and get It running for ya so you can see the code. Then you can go from there.
Well upload your current code. So I can take a look at it.Damn man, if you could do that that would be awesome.