PaintBuilder API
The PaintBuilder API is a simple API that provides an easy way to display paint for your bit with in-built progress tracking various in game events such as levelling up.
Creating the builder
The PaintBuilder is a fluent API meaning you can call numerous functions on the API before building it.
Positioning your paint
To position your paint you can set the paint on the X
and Y
axis of the emulator by calling the x()
and y()
functions like so
Tracking Skill
The PaintBuilder has in-built methods for tracking skills. Without passing skill options, the paintbuilder will handle it all and display all the fields.
Tracking Skill Options
If you wanted to only display for example the experience gained you can pass skill options to customise the paint to your liking as below.
PaintBuilder.newBuilder()
.trackSkill(Skill.Fishing, "This is a custom label", TrackSkillOption.Exp)
.build()
The TrackSkillOption
enum provides 4 options
TrackSkillOption.Exp
TrackSkillOption.Level
TrackSkillOption.LevelProgressBar
TrackSkillOption.TimeToNextLevel
Track Items
Along with tracking skills, we can also track items or inventory changes. For example someone looting molten glass would want to know how much glass they've looted.
Similarly to the above, you can pass the item to the call and let the builder do the rest, or your can pass options later.
To change the display on what details are shown, you can pass TrackInventoryOption with the following variablesTrackInventoryOption.QuantityChange
TrackInventoryOption.valueOf()
TrackInventoryOption.values()
TrackInventoryOption.Price
Custom Strings
Sometimes the paint builder doesn't offer the exact method you need to track what you need. In this case you can use custom strings to display information that you're tracking yourself.
To add a custom string to the output paint you can call the addString()
. This takes a string and a callable, if you're new to callables, Intellij will practically write it for you however
they can be written like so.
PaintBuilder.newBuilder()
.addString("Method: ", new Callable<String>() {
@Override
public String call() throws Exception {
return userMethod;
}
})
.build()
Adding A CheckBox
If you wanted to add a checkbox to turn on/off certain features you can do so by doing the following:
The first argument is the text to display next to the checkbox, the second is the id to associate with the checkbox and the third is the default state for the checkbox. When a user interacts with the checkbox a PaintCheckboxChangedEvent
will be sent, you should write an event handler to intercept this.
Remove Script Version
The paint builder automatically shows the script version from the ScriptManifest
to remove this default behaviour you can call the removeScriptNameVersion()
function.
Disabling Discord progress uploads
By default when calling the PaintBuilder progress reports will be sent to the progress-reports channel in the Powbot discord. If you want to disable this default functionality you need to call the withoutDiscordWebhook()
as part of your builder.
Adding paint
Once you have built your paint using the PaintBuilder API you need to call addPaint
function which takes a type of Paint
which your PaintBuilder returns