-
Active Member
How to make advanced scripts - thought process framework with example
Because the question of creating advanced AHK triggers is returning one, I would like to present you with general framework that should help you better understand the process of creating good scripts. In example I use GameHelper (GameHelper: A light version of PoeHUD/Exile-Api), but it can be applied to other great tools and outside of PoE (or even gaming).
In general, you need to think about:
- What and how often do you want to trigger?
- What do I need to use skill/flask?
- When you don't want to trigger?
- When you want to trigger?
I will explain this using the following example:
I am Ranger, and I would like to keep my ballista totem up when I am fighting Rares and Uniques.
1. What and how often do you want to trigger
- Ballista Totem up to my totems cap (which is 4)
- I don't want to spam it, so I should add some delay between casts
2. What do I need to use skill/flask
- Skill has to be usable (ofc!)
- I need to have mana to cast all four
3. When you don't want to trigger
- When there are no enemies or there is only small pack of Normal / Magic monsters
- When I'm running (because I am repositioning to avoid something or looting and cast "stun" me)
- When I have all totems alive already
- When I have low mana (I don't want to be unable to attack because I've used all mana for this casts)
4. When you want to trigger
- When there arer Rare and/or Unique enemy
- When I am actively attacking
Ok, now we have more specific description of what I need to script. Let's turn them into more technical "conditions".
1. What and how often do you want to trigger
We want to create and keep up to 4 totems. This will also cover condition from section 3. (don't cast when I have all totems up). This condition would look like:
DeployedObjectsCount[5] < 4 (we use Deployed Object Count Condition)
How do I know what ID (here: 5) my totems have?
Core -> Misc Tools -> Data Visualisation
Then: States -> InGameStateObject -> CurrentAreaInstance->Player->Components->Actor -> Deployed Objects
We don't want to spam, co we set cooldown to something comfortable and human-like - 0.222 should be ok.
2. What do I need to use skill/flask
Skill needs to be usable, so we use IS_SKILL_USABLE condition
Condition would look like: PlayerSkillIsUseable.Contains("ArtilleryBallista")
We need mana to cover all casts (and - looking at what we wrote in section 3. - also to keep on attacking).
We will use VITALS condition:
PlayerVitals.MANA.CURRENT >= 44
I should cover all 4 totem casts and some attack time untill kills / regen / flasks let us recover mana.
3. When you don't want to trigger
We don't want to waste time for small packs. But, later on (section 4.) we have condition that we want to attack when unique/rare is near. There is no need to create two conditions here, in fact - they both describe similar state.
After adjusting how big is our detection circle (see Core tab, nearby monsters counter), we will use nearby_consters_counter.
Result should look like:
MonsterCount(MonsterRarity.AtLeastRare, MonsterNearbyZones.OuterCircle) > 0
To be safe, we will add here Component with wait time of around 0.232s (we will require to see Rare/Unique monster for at least this time to trigger; this will be more human-like).
We don't want to cast when running, this is something opposite to condition for using Quicksilver flask:
!PlayerAnimation.Equals(Animation.Run)
Mind "!" which means "not" or "negate".
We will add component that we stop running for around 0.500s - this will prevent us from casting when we fight, dodge and loot while attacking.
Rest of conditions was covered in previous sections.
4. When you want to trigger
Presence of Rare/Unique was covered in section 3.
What active attack means? In this case, it would mean keeping main attack button pressed for some time.
We will use ON_KEY_PRESS_FOR_ACTION condition and connect it to our main attack button. We also need to add time component - how long button needs to be pressed to count for ongoing attack? Let's make it around 1.5s. Condition will look like:
IsKeyPressedForAction(VK.RBUTTON)
We covered all conditions. To sum it up (without delays added):
Use KEY_T with cooldown 0.222 when:
PlayerSkillIsUseable.Contains("ArtilleryBallista")
MonsterCount(MonsterRarity.AtLeastRare, MonsterNearbyZones.OuterCircle) > 0
IsKeyPressedForAction(VK.RBUTTON)
PlayerVitals.MANA.CURRENT >= 66
DeployedObjectsCount[5] < 4
!PlayerAnimation.Equals(Animation.Run)
I wish you good luck Exiles! Let me know if this framework helped you with creating better automation scripts
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
FAQ
How to use tinctures?
As for now (Aug 2024) Tinctures are buffs that come with mana-burn de-buff in form of stacks gained every 0,5s. When you get to 0 mana, tuncture will drop off and you will need time to re-use it.
Active tincure is visible as buff, for example: tincture_oakbranch. But also, it applies Mana Burn debuff, visible as: tincture_mana_burn. This debuff has charges.
I case of Game-Helper, You can check this in Data Visualisation (Core tab -> States dropdown -> InGameStateObject -> CurrentAreaInstance->Player->Components->Status Effects).
Conditions would look like:
!PlayerBuffs.Has("tincture_oakbranch") -> because we want to activate it when it is not on
MonsterCount(MonsterRarity.AtLeastRare, MonsterNearbyZones.InnerCircle) > 0 -> because we want to have it only when there is someone important to hit
You will also need to add cooldown / wait timers to avoid spamming tincture when it is on cooldown.
Last edited by EthEth; 08-16-2024 at 03:49 AM.
Reason: Add FAQ: tincture use
-
Post Thanks / Like - 5 Thanks
-
Member
I want to make one macro for autohotkey trigger on gamehelper
aura name is Zealotry, if this aura turn off that i want to turn on automatically with macro
How can i do that?
aura1.jpg
when i press W key that turn on and make curcle display
Some time this aura turn off remove curcle
that have trigger or not
Please advice for me.
Last edited by ilikejbl; 08-06-2024 at 10:01 AM.
-
thanks, i have linked this thread in my GH post. let's move all these questions/answers here so people can search without going through 5000 pages of text.
If I did not reply to you, it mean the question you are asking is stupid.
-
Post Thanks / Like - 1 Thanks
EthEth (1 members gave Thanks to GameHelper for this useful post)
-
Member
Your tools are helping me a lot
Thanks as always.
-
Member
Originally Posted by
GameHelper
thanks, i have linked this thread in my GH post. let's move all these questions/answers here so people can search without going through 5000 pages of text.
Your tools are helping me a lot
Thanks as always.
-
Active Member
Originally Posted by
GameHelper
thanks, i have linked this thread in my GH post. let's move all these questions/answers here so people can search without going through 5000 pages of text.
Thank you! I will try to gather the most popular questions from the main GH thread when I get more time.
-
Member
srsly i need help with my 2 Tinctures on Num 2 & 3, i just want to trigger once using Vaal LS on Rares & Bosses please help me
-
Member
I tried to identify but I couldn't find any specific animation for opening strongboxes. There is any condition which would be possible to trigger a skill when opening a strongbox?
-
Member
Is there a status effect for how many Skeletons I have currently summoned? I'd like it to auto re-cast them whenever they die.. I found player buffs but it is not in there
-
Member
As I understand it, auto pumping of gems is not provided for?
Last edited by itolol; 08-29-2024 at 04:15 AM.
-
Active Member
Originally Posted by
abnersajr
I tried to identify but I couldn't find any specific animation for opening strongboxes. There is any condition which would be possible to trigger a skill when opening a strongbox?
I don't know if there is a possible trigger for skill use on opening strongboxes. My approach would be: play smarter or trigger when stationary and there are X monsters around. But the latter is too general condition to be usable.
Originally Posted by
itolol
As I understand it, auto pumping of gems is not provided for?
1. Wrong post - this one describes approach to automation
2. If you are asking about GameHelper - no, GH does not auto-level up gems, try ExileAPI / PoeHelper
Originally Posted by
jusikapide
Is there a status effect for how many Skeletons I have currently summoned? I'd like it to auto re-cast them whenever they die.. I found player buffs but it is not in there
In general - minions, totems, traps, mines, etc... are not buffs on character, but objects deployed by player. Each type of minion/totem is a separate "object" that you need to count. In case of GameHelper you need to use DEPLOYED_OBJECTS_COUNT condition. In example from the main post I wrote about balista totems - I included explanation how to find how many totems you have and how to set up the script. You should follow simmilar path and get something like this: DeployedObjectsCount[X] < 8, where X is object type coresponding to Sceletons.
-
Member
On GameHelper I'm trying to get cyclone to activate if an enemy comes in range but it's channeled. Is there any way to continuously use a skill? It seems to just quickly press the associated key.
-
Member
Any idea how to release channeling skills at an specific stage? I'm using the condition PlayerBuffs.Has("snipe_stacks") and using cooldown to get to 2 stages so i can release 2 skills. The snipe_stacks buff has the stages attribute, is there a way to use it in a condition? something like stages > 1 -> press button.