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

Beta

WhereIsMyMind

Member
Joined
Oct 12, 2013
Messages
848
Reaction score
5
Beta Exilebuddy 0.1.2889.79 get rarity

Hi,

I am receiving grief from Loki.Game.Objects.Monster.get_Rarity(). Was it changed since 1.2.n? If not then it is all me pushing things too hard


[bestTarget.Rarity]System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException()
at Loki.Game.Utilities.ComponentInformation.(String )
at Loki.Game.Utilities.ComponentInformation.(String )
at Loki.Game.Utilities.ComponentInformation.get_ObjectMagicPropertiesComponent()
at Loki.Game.Objects.Monster.get_Rarity()
at ExampleRoutine.ExampleRoutine.<Logic>d__7.MoveNext() in c:\ExilebuddyBETA 0.1.2929.969\Routines\ExampleRoutine\ExampleRoutine.cs:line 356

I try/catch it and move on.

wimm
 
Last edited:
The structure changed for 1.3, but it shouldn't affect how you use the API. I'll double check the API, but it's possible you're just seeing the memory issue that results from an object in the client being removed in the middle of a coroutine, so when you go to access a cached object's data, it throws an exception since it no longer exists.

That issue is attempted to be solved in ExampleRoutine by caching all the data for the object before doing anything that would cause the coroutine to wait a game frame. E.g.,

Code:
var cachedPosition = bestTarget.Position;
var targetPosition = bestTarget.ModelCenterWorld;
var cachedId = bestTarget.Id;
var cachedName = bestTarget.Name;
var cachedRarity = bestTarget.Rarity;
...

If you're not doing that in your code, you should, and pass along the data and not re-access it between frames.
 
Merry Christmas pushedx,

Yeah, the monster is dead by the time the rarity is attempted cached. I presume it is possible to happen on the other 'cachings' but rarity is the only one I noted.
I solved it with:


Code:
var cachedRarity = Rarity.Normal;
try
{
[INDENT][/INDENT]cachedRarity = bestTarget.Rarity;
}
catch (Exception ex)
{
[INDENT][/INDENT]Log.Error("[bestTarget.Rarity]", ex);
[INDENT][/INDENT]return false;
}

wimm
 
Back
Top