Log and example of your code.
var pot = InventoryManager.FilledSlots.FirstOrDefault(a => a.Name.Equals("Mega-Potion Of Dexterity"));
if (pot != null && pot.IsValid)
{ Logging.Write("[RebornCo] Found: " + pot.Name);
pot.UseItem();
}
Code:var pot = InventoryManager.FilledSlots.FirstOrDefault(a => a.Name.Equals("Mega-Potion Of Dexterity")); if (pot != null && pot.IsValid) { Logging.Write("[RebornCo] Found: " + pot.Name); pot.UseItem(); }
[23:34:30.850 D] DoAction Item 4595 0xE0000000
[23:34:10.577 N] [RebornCo] Found: Mega-Potion of Dexterity
[23:34:30.833 N] [RebornCo] Found: Potion of Dexterity
[23:34:30.850 D] DoAction Item 4595 0xE0000000
if the names are user settings and not hard coded, would a .Name be fine?Also if your going to be bad and use strings then make sure to compare both the englishname and the currentlocalename of objects so that it will work in other regions.
No, then you should really be using currentlocalenameif the names are user settings and not hard coded, would a .Name be fine?