What's new
  • Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • Visit Resources
  • Visit Downloads
  • Visit Portal

[QUESTION] How to force an update on your backpack

StrangerThanFiction

New Member
Joined
Nov 24, 2012
Messages
241
Reaction score
3
Not sure if this is going to be core DB or Trinity Caching...

Trying to fix a glitch in the AutoEquipper CheckMerchant and BuyPotion methods...

Essentially when you issue the
Code:
ZetaDia.Actors.Me.Inventory.BuyItem
method you can not immediately find the item in your backpack....

In the case of potions:
Code:
ZetaDia.Me.Inventory.Backpack.Where(i => (i.IsPotion) && (i.RequiredLevel <= ZetaDia.Me.Level)).OrderByDescending(p => p.ItemStackQuantity).FirstOrDefault()

But get a null result.... Same thing happens with items..

However after waiting 1-2 pulses it will finally return an ACDItem....


I can think of 2 ways around this..

1) Wait for 2 pulses before continuing (Current Solution, But is very ugly [Sometimes results in an exception -_-])

2) Force an update...

Tried using the Update method but no dice...
Code:
using (ZetaDia.Memory.AcquireFrame())
{
	ZetaDia.Actors.Update();
}


The only other thing I can think of is that the method itself locks the memory.. And that a memory update would not take place until the method is finished....

See this in a exception when I try to let it run with a null
Code:
[GilesEquipper 1.7.5.3] System.NullReferenceException: Object reference not set to an instance of an object.
   at Zeta.MemoryManagement.FrameLock.Dispose()
   at GilesEquipper.GilesEquipper.CheckPotions()
   at GilesEquipper.GilesEquipper.OnPulse()


Am at a loss O_o
 
Last edited:
Resolved... Apparently looping the "ZetaDia.Actors.Update();" method on a while loop was able to resolve this..... A single call just wasn't getting the job done.. O_o
 
Back
Top