Skip to content

Write your own rotation

Hassliebe edited this page Nov 22, 2022 · 13 revisions

We're going to go over some basics on how to make your very own rotation and have it up and running in no-time.

Preparation

Although technically you can write your whole rotation in Notepad i have some suggestions for you to make your life easier. Get at least Notepad++ or better yet Visual Studio Code. Both are free and have a lot of features that will make your life easier. I will be using Visual Studio Code for this guide. You can download it here: VS Code Download

It's also strongly recommended to get at least these 2 Addons:

The following Addons are personal recommendations:

You can set up Details! Streamer mode and itll show you a window with your casts (technically BR can do that but i prefer Details)

Extensions

There are some very useful extensions when coding a wow rotation. In Visual Studio Code on the left side you have a menu. Click on the Extensions icon and search for the following extensions: Lua / Lua Auto End / WoW Api. Install them and you're good to go.

LUA (in World of Warcraft)

LUA is the language that is used in World of Warcraft. If you want to learn more about LUA you can check out this website: Lua.

Also remember that LUA is interpreted from top to bottom and left to right.

And just some other things to note about coding in general:

  • Use spaces in your rotation file when starting out. Make everything you code easy for yourself to understand and read.

  • Use comments to explain what you are doing. This will help you and others understand your rotation better. You can use -- for single line comments and --[[ for multi line comments. Use them extensively.

  • When you write your rotation you can just /reload in game and it will reload your changes. Especially useful when you changed alot of stuff and it broke your rotation and you need to figure out what went wrong.

  • for BR purposes we try to stick to camelCase for variables/functions/spells. This is not a rule but it is a good practice to follow. Means no spaces and the first letter of every word is capitalized. Example: myVariableName

    camelCase

  • While LUA itself is updated every now and then wow is only using LUA 5.1 so you can't use any functions that are not in LUA 5.1. Not really a problem but something to keep in mind.

  • Keep a keen eye on your commas and brackets and make sure you close your statements properly. LUA is very picky about that and will throw errors if you don't.

Sample Rotation File

One of the most important things to understand is how the rotation file is structured and where stuff belongs. We'll go into details later but for now just enjoy my MSpaint masterpiece.

We'll go over each part seperately.

1.) First thing you should do when creating a rotation is go the class/spec folder copy/paste the sample rotation and rename it. You can call it whatever you like.

2.) Scroll to the bottom of the file and fill in your spec ID (can find it here Spec IDs)

3.) I'm going to go over the sample rotation file from top to bottom as you can see in the picture, explaining a little bit about the "sections" of it. Rule of thumb is if you dont want/need the in-depth explanation of something just try and reproduce something similar to other rotations.

createToggles part

As you can see here we just create whichever toggles we want our rotation to have. These toggles can be controlled with macros so put stuff here that you need changed ad-hoc. In general when getting into rotations you probably don't need to create alot of toggles yourself. This example is taken from the sampleRotation file

Explanation
Explanation

As LUA is read from top to bottom and we want to create a toggle like in .System/UI/Toggles/ToggleFunctions.lua with the following syntax we do:

function br.ui:createToggle(table,name,col,row)

You'll see that the function createToggle expects a table then a name then a column then a row. As we cannot use something that we don't have yet we have to create the table first. This is done by creating a

local RotationModes = {},

This creates a table called RotationModes. We fill it with whatever options we want our toggle to have.

[2] = { mode = "Mult", value = 2 , overlay = "Multiple Target Rotation", tip = "Multiple target rotation used.", highlight = 0, icon = br.player.spell.bladestorm },

Now we can use this table to create our toggle like so:

br.ui:createToggle(RotationModes,"Rotation",1,0)

The 1,0 as said above is column and row respectively. If you want your own toggle button to show up above the other ones you just add it in another row. Be careful here, you can technically "stack" all your toggle buttons if you don't pay attention to these numbers.

Useful tip: We can macro toggles. So if you want to toggle the toggle with the number 2 you would use the following macro:

/br toggle rotation 2 

By the way just as a reminder, the following 2 do exactly the same. As we've said before lua is interpreted from top to bottom and left to right. So the first screenshot is the same as the second one. It's just a matter of preference and keeping it readable.

Spells.lua

A little more on Spells.lua: On the Top level there are the class tables but there is also a shared table for all classes. Thats where spells go that ALL classes share e.g. AutoAttack etc. Within each class table there are spec tables and below those is another shared table but this time its for all spell IDs that the CLASS shares between specs. If one spec within that class does not have an ability it does not go here. And finally each class table and each spec table are subtabled by the type of spell (Is it an ability or a buff or a debuff). Please note that an ability can have IDs in different subtables. E.g. in the example bwlow dancingRuneWeapon is an ability that you can cast as Blood but it also gives you a buff with a different ID.