Naton 1028 Posted February 2, 2022 Share Posted February 2, 2022 The Basic Paint Template is an easy-to-use and flexible way to draw a basic paint for your script. It's influenced by Fluffee's paint builder here (which I know many still use). Notes: We're looking for feedback on this. We want to know what you like, don't like, and what else we could add. In the future, we'd even like to build a generic powerful paint system to build almost any style of paint. Let us know! How to use: The paint is created through the org.tribot.script.sdk.painting.template.basic.BasicPaintTemplate class Example: People often learn best through an example so here you go! PaintTextRow template = PaintTextRow.builder().background(Color.green.darker()).build(); // template is optional stuff to not repeat same colors/fonts for every row BasicPaintTemplate paint = BasicPaintTemplate.builder() .row(PaintRows.scriptName(template.toBuilder())) .row(PaintRows.runtime(template.toBuilder())) .row(template.toBuilder().label("Test").value("ing").onClick(() -> Log.log("CLICKED!")).build()) .row(template.toBuilder().label("Resources").value(() -> this.resourcesCollected).build()) .location(PaintLocation.TOP_RIGHT_VIEWPORT) .build(); Painting.addPaint(g -> paint.render(g)); This will draw a paint at the top right of the game screen with four rows - one of the script name, one with the script runtime, one that says Testing:ing that will print CLICKED in the debug when clicked, and a final row that gives the number of "resources" collected by getting a variable. Adding rows: Simply call .row(PaintRow) on the PaintTextRowBuilder to add a new row of text. The only row type that exists at the moment is PaintTextRow. Create one through PaintTextRow.builder(). The builder contains various configuration methods to customize the row. Using the same style for all rows: You probably want to use the same color/font for all your rows. If you don't want the defaults, create a template row as shown in the example above. You can then call toBuilder() on this template row to use as the base for all the paint rows. This essentially allows you to specify the default values for the builder object. // Create the template PaintTextRow template = PaintTextRow.builder().background(Color.green.darker()).build(); // Use the template PaintTextRow row = template.toBuilder().label("My label").value(() -> Skill.ATTACK.getActualLevel()).build(); // row has a background color of Color.green.darker() Location: You can customize the location by specifying a preset location via .location(PaintLocation) when building the paint, or you can specify the base point to draw at, and whether it is left-to-right and top-to-bottom or not via builder.drawOrigin(point).leftToRight(true).topToBottom(true) Preset rows: There's a few preset rows that you can add through the PaintRows class. For example, this contains rows for the script name or script runtime. Let us know your experiences and how we can improve! Quote View all my bots on the TRiBot store! (premium) (free) Need assistance with any of my bots? Join the nScript support discord (link below). nScripting.com nScript Support Discord Refund Policy Automate your bot management through nRestocker and the TRiBot Bulk Launcher Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.