With the advent of patch 1.8 and some new features like coordinates I decided to revisit my old RiftCastSequencer and see if could be improved to be more intuitive and functional. The end solution is I believe a worthy sibling to the original NerfedButtons addon for Warhammer Online.
Warning and disclaimer: Unlike the original WAR addon, NerfedButons4Rift does use an external program and therefore using it may/will get your account banned. NB4R is the result of a couple of afternoons where I needed a break from my day-job coding and is an exercise in 'is it possible?' rather than something designed to be used in-game.What is NB4R
Just like it's older sibling, NB4R allows you to define prioritised conditions sequences of abilities. This is easiest explained using and example:
Rift itself supports a powerful macro facility that allows players to bind multiple abilities to a button. Here is a simple example of a basic Rift macro:
cast AbilityA
cast AbilityB
cast AbilityC
When the button is then pressed, Rift cycles through each ability and will 'use' the first ability that passes Rifts own internal 'condition checks':
- the ability is not on cooldown
- the target is in range of the ability
- the ability can be cast on the target
- etc.
Therefore if you have 3 abilities with a 10 second cooldown (and no other constraints), the following will happen each time you press the button tied to this macro:
- 1st press: AbilityA will be cast and will begin cooldown.
- 2nd press: AbilityB will be cast and will begin cooldown.
- 3rd press: AbilityC will be cast and will begin cooldown.
- 4th press: If this press happens with 10 seconds of the 1st press then all the abilities will already be on cooldown and nothing will happen.
- 5th press: If AbilityA has completed it's cooldown then Ability will be cast again.
- etc.
A problem arises if AbilityB and Ability C do not have cooldowns. In such a situation AbilityB it will always fire if AbilityA is on cooldown and we will never reach AbilityC. To solve this NerfedButtons provides a facility where you can add custom 'condition checks'. One sech check is 'virtual cooldown', where you can attach a cooldown to an ability even if doesn't have one (or increase the cooldown of an ability that does have one).
Virtual cooldown is just one example of the custom condition checks provided by NerfedButtons, others include: is my (or my target's health) below a certain threshold? Do I have X combo/attack points? Do I have a specific buff/debuff etc etc.
Adding custom condition checks into ability sequences can prove very powerful and enable to player to auto respond to events quicker (just like Rift macros, but in a more powerful manner).
Okay, that's enough of an intro, hopefully you haven't got bored and walked away just yet...
Using abilities and casting spells
The initial problem is that Trion (quite sensibly) do not allow you to do the following from an addon:
- Cast spells or use abilities
- Change the abilities bound to actionbar buttons
- Rewrite macros on the fly when in combat
The original NerfedButtons used option 2 to constantly update the abilities bound to actionbar buttons based on whatever checks were in your defined sequences. This is not possible in Rift (the addon api dev seems pretty sharp and is sensibly taking great care to limit what is possible via the addon API based on what Trion deem acceptable).
Overcoming the use/cast problem
As the addon API itself cannot use abilities I need something that can. To get around the limitation we have a simple AutoHotkey script that reads any output to the Rift console log file and if sees a string containing a hotkey in a specific format, it Send the hotkey to Rift, just as if the player pressed the button themselves.
To send output to the Rift console log all you need to do is type /log (into chat) and then any chat messages or addon console messages (sent with the print() function) will appear in the Rift logfile (Log.txt in the Rift directory).
The missing link
Now that we have one mechanism for sending key requests (the print("MYHOTKEY")) function and another mechanism for receiving these requests and acting upon them (the AutoHotkey script), we just need to write an addon that allows you to:
- define sequences of abilities/spells
- attach conditions to each ability/spell in the sequence
- work out which spell/ability should be used/cast when a button is pressed.
whew... still some work to do!
Defining sequences
Rift players are already familiar with the in-game macro facility and therefore NB4R sequences are also defined int he macro editor with a slightly different format. Instead of using the 'cast' keyword in your macro, you use nb, following by the ability name, then your conditions and finally a hotkey (we'll come to the hotkey bit last).
therefore instead of:
cast AbilityA
cast AbilityB
cast AbilityC
we have
nb AbilityA <conditions> <hotkey>
nb AbilityB <conditions> <hotkey>
nb AbilityC <conditions> <hotkey>
simply huh?
If you have no conditions you want attached to an ability then you can use the work 'None' as the conditions. Doing this for all 3 abilities will give us the same basic capabilities as the original macro.
nb AbilityA None <hotkey>
nb AbilityB None <hotkey>
nb AbilityC None <hotkey>
What is this <hotkey> parameter?
As we said earlier, Rift addons cannot use/cast abilities/spells. To get around this we put our abilities/spells on unused hotbars/buttons (side bars are a good choice) and bind keys that we don't normally use in gameplay to these buttons.
I for one never use keys with ALT-SHIFT or CTRL-SHIFT modifiers during gameplay, therefor I add a few sidebars and put abilities AbilityA, AbilityB and AbilityC onto these sidebars with keybinds ALT-SHIFT-1, ALT-SHIFT-2, ALT-SHIFT-3.
NB4R has a shorthand for modifier keys:
^ = CTRL
! = ALT
+ = SHIFT
therefore ALT-SHIFT-1 would be !+1. This gives us the following sequences:
nb AbilityA None !+1
nb AbilityB None !+2
nb AbilityC None !+3
What about those check conditions?
NerfedButtons would be nothing without its custom condition checking. Condition checks are defined as a colon seperated of key=value pairs as follows:
<CHECK>=<VALUE>:<CHECK>=<VALUE>:<CHECK>=<VALUE>
A collection of useful condition checks has been added to NB4R:
VC (Virtual Cooldown) [0-3600]
TC (Target Calling) [M,W,R,C]
PH (Player Health) [percent]
TH (Target Health) [percent]
CP (Combo Points) [1-5]
PB (Player De/Buff) [name of buff, alphanumerics only]
TB (Target De/Buff) [name of buff, alphanumerics only]
Lets add virtual cooldowns to the out example sequence:
nb AbilityA None !+1
nb AbilityB VC=10 !+2
nb AbilityC VC=10 !+3
now AbilityB and Ability have 10s cooldowns. :)
Sequence Examples
The 'buff yourself' sequence
Some buffs have cooldowns and others haven't making it often a pain to keep yourself buffed. The virtual cooldown checks will help in this situation, but what if you only want to reapply buffs that are missing/stripped, saving time in the middle of combat from having to rebuff everything from scratch. Some buffs are toggles and therefore a simple virtual cooldown based check will just remove the buffs. We need some intelligent buffing! welcome to the PB (Player Buff) check.
Here are the buffs we want our BM/WL/VK warrior to keep up.
- Bond of Might
- Bond of Feline Grace
- Bond of Vigor
- Battlefield Distraction
- Battlefield Awareness
- Void
placing these into a NB4R macro would look like (we capitalise and remove all spaces from the ability names):
nb Bond of Might PB=BONDOFMIGHT ^+1
nb Bond of Feline Grace PB=BONDOFFELINEGRACE ^+1
nb Bond of Vigor PB=BONDOFVIGOR ^+1
nb Battlefield Distraction PB=BATTLEFIELDDISTRACTION ^+1
nb Battlefield Awareness PB=BATTLEFIELDAWARENESS ^+1
nb Void PB=VOID ^+1
hope you think that's as cool as I do :)
Target modifiers
Unfortunately nb4r does not support target modifiers @self, @focus like normal cast macro lines :(
You can however get around this by using seperate target lines in your macro:
nb ....
nb ....
target @self
nb ....
targetlasttarget
nb ....
== Reactives ==
If you have any abilities that are reactives then simply add them to your sequence as normal cast lines.
cast reactive
cast reactive
nb ....
nb ....
Off GCD Abilities
As per reactives, place your off GCD abilities before your nb lines in your sequence. A GCD firing will not affect NB4R from also firing an ability with the same keypress, no need to have your off-GCD abilities 'after' your on-GCD abilities (in fact that won't work very well anymore, put them first!).
Future Improvements
I've come to the end of my 8 or so hours developing NB4R and I doubt I'll work on this project again as this has been more an exercise in what can be achieved with no real consideration of whether this is good thing or not.
The autohotkey integration is very likely a violation of the license agreement (I haven't read it). If you do decide to try NB4R in-game and will likely get your account suspended/cancelled, so to be safe, don't use it!
Some potential improvement could include:
Get the addon to use coloured 1px x 1px frames to broadcast hotekeys instead of using the console log. AUtohotekey could then use it's pixel reading capabilities to check the colours of these frames and determine what hotkey to send.
Macros 'can' be tied to frames, but the macros must be 'clicked' (no keybinding). This may allow for small frames with each of the abilities in sequences to be precreated and for autohotkey to click these, removing the need to have sidebars with all the abilities you want to sequence on them. I like this idea, instead of sending hotkeys, the addon would send x,y coordinates for autohotkey to click these frames.
You can get the addon/script from here.
Install Instructions
Install the addon just like any other Rift addon, run the NB4R.ahk script (you'll need autohotkey), turn on chat loggin in-game (/log) and enjoy.
That's all for now.
Have fun coding,
NerfedWar