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

Change ExampleRoutine settings from a plugin?

Dgc2002

Member
Joined
Jan 15, 2010
Messages
197
Reaction score
0
Is there a way/how would I change the settings of ExampleRoutine from a plugin? I'd like to be able to update the settings depending on the situation/skill bar.

Also:

I'm sure I'm missing something. How do I retrieve my inventory contents? I'm using
Code:
await Loki.Bot.v3.Coroutines.OpenInventoryPanel();
To open the panel but I'm not sure of the next step. I'd like to check for a skill gem then interact with it. I'll keep digging and remove this if I track it down.
 
Last edited:
Is there a way/how would I change the settings of ExampleRoutine from a plugin? I'd like to be able to update the settings depending on the situation/skill bar.

RoutineManager.CurrentRoutine.Settings (check for null for CurrentRoutine and Settings) will get you the base JsonSettings instance of the current routine's settings.

The GUI loads bots, routines, and then plugins, so the type will exist by the time you try to access it at complication. You'd just have:
Code:
using ExampleRoutine;

...

var settings = RoutineManager.CurrentRoutine.Settings as ExampleRoutineSettings;
// check for null in case the type isn't ExampleRoutineSettings. Otherwise, you can change stuff now.

To solve an issue of an unresolved type dependency, that is, you want to change plugin settings from a routine, I believe the only way is to use Reflection.

I'm sure I'm missing something. How do I retrieve my inventory contents? I'm using
Code:
await Loki.Bot.v3.Coroutines.OpenInventoryPanel();
To open the panel but I'm not sure of the next step. I'd like to check for a skill gem then interact with it. I'll keep digging and remove this if I track it down.

LokiPoe.InGame.InventoryPanel contains all the stuff you need to work with the inventory panel.

Some of the interaction stuff is covered in the An Overview of Loki: Exilebuddy's API for Path of Exile guide under LokiPoe.InventoryPanel.

The non-interaction stuff has tried to be made as intuitive as possible. LokiPoe.InGame.InventoryPanel.Main will give you all items in your main inventory, for example.
 
Thanks for the info pushed, you're always super helpful =)
 
Last edited:
Related question.

I'm attempting to equip a gem to my main weapon like this:

Code:
                    Log.InfoFormat("FOUND THE GEM IN OUR INVENTORY");
                    //*EQUIP GEM HERE
                    Log.InfoFormat("[GemEquip]: Open inventory...");
                    await Coroutines.OpenInventoryPanel();
                    Log.InfoFormat("[GemEquip]: Pick up gem...");
                    Loki.Game.LokiPoe.InGameState.InventoryPanel.PickupMainToCursor(starterGemItem);
                    Log.InfoFormat("[GemEquip]: Equip gem to left hand...");
                    Loki.Game.LokiPoe.InGameState.InventoryPanel.EquipSkillGem(LokiPoe.InGameState.InventoryPanel.LeftHand, 2);

However what this ends up doing is opening the inventory, grabbing the gem, moving the cursor to the middle of the screen then leaves the task. Here is an excerpt from the log

Code:
FOUND THE GEM IN OUR INVENTORY
[GemEquip]: Open inventory...
[OpenInventoryPanel]
[OpenInventoryPanel] The InventoryPanel is not opened. Now opening it.
[GemEquip]: Pick up gem...
[GemEquip]: Equip gem to left hand...
[ExploreTask] Now exploring to the location {414, 230} (131) [6.687898 %].
[ResetAnchorPoint] Setting AnchorPoint to {285, 241} for 1783905598.
[ResetAnchorPoint] Setting CurrentAnchorPoint to {285, 241} for 1783905598.
[ClearCursorTask]
[OpenInventoryPanel]
[ClearCursorTask] The item Fireball needs to be placed into the inventory.
[CloseBlockingWindows] LokiPoe.Gui.IsLeftPanelShown || LokiPoe.Gui.IsRightPanelShown. Closing them.

Any idea what the problem might be? I'm not sure how to grab a socket's index either or I'd use that as well. I tried manually entering some numbers but that had the same result as above.
 
Related question.

I'm attempting to equip a gem to my main weapon like this:

Code:
                    Log.InfoFormat("FOUND THE GEM IN OUR INVENTORY");
                    //*EQUIP GEM HERE
                    Log.InfoFormat("[GemEquip]: Open inventory...");
                    await Coroutines.OpenInventoryPanel();
                    Log.InfoFormat("[GemEquip]: Pick up gem...");
                    Loki.Game.LokiPoe.InGameState.InventoryPanel.PickupMainToCursor(starterGemItem);
                    Log.InfoFormat("[GemEquip]: Equip gem to left hand...");
                    Loki.Game.LokiPoe.InGameState.InventoryPanel.EquipSkillGem(LokiPoe.InGameState.InventoryPanel.LeftHand, 2);

However what this ends up doing is opening the inventory, grabbing the gem, moving the cursor to the middle of the screen then leaves the task. Here is an excerpt from the log

Code:
FOUND THE GEM IN OUR INVENTORY
[GemEquip]: Open inventory...
[OpenInventoryPanel]
[OpenInventoryPanel] The InventoryPanel is not opened. Now opening it.
[GemEquip]: Pick up gem...
[GemEquip]: Equip gem to left hand...
[ExploreTask] Now exploring to the location {414, 230} (131) [6.687898 %].
[ResetAnchorPoint] Setting AnchorPoint to {285, 241} for 1783905598.
[ResetAnchorPoint] Setting CurrentAnchorPoint to {285, 241} for 1783905598.
[ClearCursorTask]
[OpenInventoryPanel]
[ClearCursorTask] The item Fireball needs to be placed into the inventory.
[CloseBlockingWindows] LokiPoe.Gui.IsLeftPanelShown || LokiPoe.Gui.IsRightPanelShown. Closing them.

Any idea what the problem might be? I'm not sure how to grab a socket's index either or I'd use that as well. I tried manually entering some numbers but that had the same result as above.
You want to use this
Code:
Loki.Game.LokiPoe.InGameState.InventoryPanel.EquipSkillGemToLeftHand(int)
where int is the socket index, you probably need to grab the socket information first before doing this.
or letit handle it for you b
Code:
Loki.Game.LokiPoe.InGameState.InventoryPanel.EquipSkillGem(Loki.Game.Objects.Item)
Item has to be in inventory and not stash, to get the item
or
Code:
Loki.Game.LokiPoe.InGameState.InventoryPanel.EquipSkillGem(Loki.Game.Objects.Item, int)
where int is the index, again you should grab and verify the sockets exist, and color prior to doing this.

edit, OH I see, ok when you add the task, use
Code:
TaskManager.AddBefore(new GemEquip(), "ClearCursorTask")
Because ClearCursorTask is being called it's probably clearing the item on cursor before even getting a chance to put it where it belongs,
Can you pm me your script? or just post it here i'll help ya out.

Code:
Loki.Game.Objects.Components.SocketsComponent.GetItemSockets(out byte[], out Loki.Game.GameData.SocketColor[])
is probably what you want to use to grab socket info, I havent' dabbed into this yet but it's on the agenda.
 
Last edited:
I have to hit the sack for the night but thanks for the input. I don't THINK it's an issue with the ClearCursorTask interfering since, as far as I'm aware, between the time it picks up the gem and the time it should attempt to equip it, it doesn't leave that task. Looking at the equipskillgem methods I'm pretty sure it should equip the gem on it's own without an index being provided if there is a slot available. I'll do some more digging tomorrow and maybe by the time I'm out of classes Pushed will drop one of his novels of a post with some inside knowledge =) Barring that I'll write up a little example to recreate this.
 
I'll need some more information about your setup.

Is GemEquip a task or just a plugin? If it's a task, where is it getting registered.

In general, you'll want to save the return value from API functions and output them so you know why something goes wrong. Add some logging of the return value of all the API functions and you should be able to see an error.

One thing you'll need to do is some soft waits after doing any action that generates a server response. When you try to pickup an item to the cursor, the API will perform the action, but it's up to the user to make sure it as performed. A sleep around 1s or so should be sufficient most of the time, but you'll also want to check client state to make sure the action was performed.

In the case of picking up a skillgem to the cursor, you'll want to check the cursor to make sure the item you want is on it.

For EquipSkillGem, you can specify the index it should go in, or you can use the convenience functions to drop it into the first available slot: EquipSkillGemToLeftHand, for example. Make sure to output the return value to know if it worked or not!
 
Right now it's happening inside of another task that's added before ExploreTask. When I get home I'll split this gem equip stuff off into another task on it's own. The soft waits make sense now that I think about it, I was getting too used to coroutines holding up the execution until it was done doing it's thing.
 
Right now it's happening inside of another task that's added before ExploreTask. When I get home I'll split this gem equip stuff off into another task on it's own. The soft waits make sense now that I think about it, I was getting too used to coroutines holding up the execution until it was done doing it's thing.
so are you getting it added out of town or inside town? I believe ExploreTask only runs outside of towns. And I had the same issue with the items going off cursor automatically.
Try
Code:
TaskManager.Remove("ClearCursorTask");
And see if it works, it does there is your problem.
You can do
Code:
TaskManager.Add ("ClearCursorTask");
after the logic for socketing item into slot has finished.
 
Adding a couple 250ms wait did the trick, thanks pushed!

Code:
                        await Coroutines.OpenInventoryPanel();
                        Loki.Game.LokiPoe.InGameState.InventoryPanel.PickupMainToCursor(invItem);
                        await Coroutine.Sleep(Utility.LatencySafeValue(250));
                        Loki.Game.LokiPoe.InGameState.InventoryPanel.EquipSkillGem(LokiPoe.InGameState.InventoryPanel.LeftHand);
                        await Coroutine.Sleep(Utility.LatencySafeValue(250));
 
Back
Top