Jump to content
Worthy

Node Framework Tutorial [increase efficiency and clarity]

Recommended Posts

5% of my plans can be accomplished without making a new API or Framework, that's cool. At least when I finish my framework, I can code things quicker without having run into errors, and flawlessly integrate more and more tasks together, which play like me, and pickup playing after I stop playing. 

 

The code I'm making is used to run code alongside the tasks for the player to do. I think you're missing that wastedbro. It's not just a call to the api in some thread just because, it has to do with the task itself.

 

The skeleton will be straightforward and very involved, not just do this and that repeat.

 

Say you want to use states and such, but you also want to do some sort of state for moving the mouse, but you use it very often and it's not just moveMouse(position), it's change an item's position in your inventory, and then drag it back to where it was. It would be handled before continuing the tasks, rather than having all of these states to track where you are in the task. Without while loops or anything.

 

And as far as I know, when using the walking methods, all other method calls before the walking is complete, will not be processed until.

 

So......?

 

Multithreading is fine. But this would also add to simplicity, essentially doing the same thing, without adding a thread.

Edited by Karmik

Share this post


Link to post
Share on other sites

5% of my plans can be accomplished without making a new API or Framework, that's cool. At least when I finish my framework, I can code things quicker without having run into errors, and flawlessly integrate more and more tasks together, which play like me, and pickup playing after I stop playing. 

 

The code I'm making is used to run code alongside the tasks for the player to do. I think you're missing that wastedbro. It's not just a call to the api in some thread just because, it has to do with the task itself.

 

The skeleton will be straightforward and very involved, not just do this and that repeat.

 

Say you want to use states and such, but you also want to do some sort of state for moving the mouse, but you use it very often and it's not just moveMouse(position), it's change an item's position in your inventory, and then drag it back to where it was. It would be handled before continuing the tasks, rather than having all of these states to track where you are in the task. Without while loops or anything.

 

And as far as I know, when using the walking methods, all other method calls before the walking is complete, will not be processed until.

 

So......?

 

 

Multithreading. 

 

It's actually quite easy.

  • Like 1

Share this post


Link to post
Share on other sites

Looking over this the only thing i'm not understanding is under my scripts package do i create a sub package for the script alone and create other sub packages inside it for he nodes? or do i create a node package in my scripts package and leave the main in the scripts package.

E.g: .tribot > src > scripts > "script name" > nodes + main script. OR
E.g: .tribot  > src > scripts > nodes + main scripts.

Share this post


Link to post
Share on other sites

Looking over this the only thing i'm not understanding is under my scripts package do i create a sub package for the script alone and create other sub packages inside it for he nodes? or do i create a node package in my scripts package and leave the main in the scripts package.

E.g: .tribot > src > scripts > "script name" > nodes + main script. OR

E.g: .tribot  > src > scripts > nodes + main scripts.

Doesn't really matter, but I do it like so:

4a4f15a468.png

Share this post


Link to post
Share on other sites

Call me ignorant, but....

 

I'm really not seeing the real benefits of nodes. Could someone please tell me why people use them?

They provide an efficient and effective way to split up code in scripts.

As stated in the main post, you can additionally swap nodes in and out, interchangeably, depending on the circumstances of the script as well.

Share this post


Link to post
Share on other sites

They provide an efficient and effective way to split up code in scripts.

As stated in the main post, you can additionally swap nodes in and out, interchangeably, depending on the circumstances of the script as well.

 

But, it loops through each node even when not completely needed... I guess it's just for validation. I really do like the cleanness of it, especially when it comes to changing nodes and going back to projects. It'll help with my un-neat code.

 

I've found this very useful, thanks.

Share this post


Link to post
Share on other sites

But, it loops through each node even when not completely needed... I guess it's just for validation. I really do like the cleanness of it, especially when it comes to changing nodes and going back to projects. It'll help with my un-neat code.

 

I've found this very useful, thanks.

It just calls the validation method for each node. That's usually a simple boolean, so it is nothing strenuous.

Share this post


Link to post
Share on other sites

They provide an efficient and effective way to split up code in scripts.

As stated in the main post, you can additionally swap nodes in and out, interchangeably, depending on the circumstances of the script as well.

Smh... Stop making tutorials. How will your Node framework be beneficial in circumstances where you need to immediately stop and go to another Node? No where did you elaborate on this.

Edited by swagger417

Share this post


Link to post
Share on other sites

Smh... Stop making tutorials. How will your Node framework be beneficial in circumstances where you need to immediately stop and go to another Node? No where did you elaborate on this.

If you are coding correctly, each node will know to stop execution if it is ever no longer valid. IE, if you have a "Walk" node, you set a timeout and check to make sure the location is still valid to walk.

 

Stop needlessly spreading your stupidity across the forums. You aren't helping anyone, and you don't sound smart or cool.

 


 

PS: Of course you can expand upon this framework to improve functionality and versatility. If you are doing that, however, you wouldn't need a tutorial to make the framework in the first place. That is what makes this tutorial useful.

  • Like 1

Share this post


Link to post
Share on other sites
On 12/2/2014 at 9:34 AM, Worthy said:

Good luck. When you create a good script using your advanced super amazing framework, tag me in the post and show me a long proggie and some (or all) of the source with your framework.

i like you haha  :P

Edited by sank2014

Share this post


Link to post
Share on other sites
On 9/8/2013 at 10:41 AM, Worthy said:

package scripts.powerminer.api; public abstract class Node { public abstract void execute(); public abstract boolean validate(); }

I really like this guide and would very much like to write my scripts like this. Thanks for the guide it totally helped me clear up a lot of confusion. I am a newbie at scripting and hope to complete my first script within a week. Currently reading these guides and examining source code to learn. 

Share this post


Link to post
Share on other sites
2 hours ago, 1brian3 said:

I really like this guide and would very much like to write my scripts like this. Thanks for the guide it totally helped me clear up a lot of confusion. I am a newbie at scripting and hope to complete my first script within a week. Currently reading these guides and examining source code to learn. 

:)

Share this post


Link to post
Share on other sites

Sequential nodes:

 

I am working on a rebuild class for when accounts are banned, obviously this is like one big quest script.  Each task is sequential: Tutorial island, train skill 1, train skill 2, quest 1, quest 2, etc.

 

When an account is first made, all task nodes' validate() methods would return true, since none of the tasks have been completed yet.  To prevent switching tasks prematurely, should the for-loop be modified? What is the best way to accomplish this? I was thinking:

 

for(final Node node : nodes) {

            if(node.validate()) {

                node.execute();

                //sleep for some amount
                
                break;

            } else {

                nodes.remove(node);

            }

        }

 

Is there a better way?  Sorry for being a total noob at node framework and tasking. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Worthy
      Welcome to Worthy Scripts
      |w| Zulrah Slayer
      Features
      Automatic Grand Exchange restocking! When out of supplies, the bot can sell loot, ready up, buy more, and continue! Using the resource tracker, the bot automatically calculates how many supplies it needs Essentially with enough GP you can run the bot forever!  Loot tracker. Analyze your drops! This data along with other statistics are saved every run time by the Zulrah Sessions System. Resource tracker. Track every item the bot consumes while playing (and how much it cost!) This data is saved and used to compute exactly how many supplies are needed when doing the automatic Restocking With this tool your pure profit is displayed  Resizeable mode compatible! This is one of the most human-like antibans any botting client can offer. Looking Glass compatible The script now functions smoothly with TRiBot's beta feature Looking Glass Unlimited multi-kill performance The bot will determine if it has enough supplies to start another Zulrah battle after killing the boss the previous time. It can continue doing this until it runs out of food, allowing a single, double, triple, or quad+ kill. Zulrah fight CPU efficient! Ability to run the client minimized.  Dynamically prioritized combat framework Many Travel methods Zul-Andra teleport scrolls Charter Travel Camelot port [via Camelot teleports] Catherby port [via Catherby port lunar teleport] Khazard port [via Khazard port lunar teleport] Fairy Ring Network Fairy ring via Varrock Teleport Fairy ring via Quest Cape Fairy ring via Ardougne Cloak Fairy ring via Salve Graveyard Teleport Fairy ring via slayer ring Fairy ring via House Teleport (mounted) Ornate pool support If so, the script will use castle wars bank instead Jewelry box support If so, the script will use a custom kill / bank loop (with no Ring of Dueling) Or use another player's house! Ability to input a list of names. There is almost every customizeable option for every travel method. Please ask in the discord support server if you have questions  There are also combinations of some of the above travel methods Reorganizes inventory! Drags and drops items like a real player Swaps between range and magic sets  Or instead use magic gear only and use a custom positioning algorithm to hide behind pillars Option to skip the blue pattern which deals the most damage   Repairs barrows armor  Supports TRiBot breaking system Hiscores system (below) Dynamic signatures (below) Automatic screenshot progress report system every hour
      Detailed session log dump. Keep track of exactly how all your bots do!
      TRiBot Antiban Compliance V2 Level 10/10 The script is also packed with custom statistic-based antipattern I have personally developed  Swaps gear and prays efficiently Smart options to determine when to use long range or keep level 1-def Tracks and handles JAD phases flawlessly Deathwalk - SAFE BOSS: never lose your items on death Recharges Trident of the Seas, Trident of the Swamp, Toxic Blowpipe, Serpentine Helm (all forms) Tracks ammunition and recharges special weapons Resizable mode options to optimize gameplay Supports serpentine helmets Supports cooked karambwans Supports special attacks Supports ring of suffering Supports prayer potions / super restores Supports stamina potions Supports summer pies for agility boost Supports imbued heart Supports custom world hopping Supports new rigour and augury prayers Supports vengeance spell with optimal timing Ability to use these with rune pouch Supports custom script ending conditions Supports multiple algorithms to fight Zulrah for click-related functions Supports custom f-key bindings Picks up and banks the Zulrah pet  
      Official Discord Discussion
      http://discord.gg/yeCVsad
       
      External Documentation Thread
      A lot of the specific information about the features above is on the Documentation thread.
      It can be found by pressing the "READ ME" button on the GUI after the script is purchased.
      It will help you:
      Create an armor preset Decide what gear to wear Set up the GUI to be tailored to your RuneScape character Start the script correctly Other notable information  
      Proggies





      More: http://imgur.com/a/HNaQZ
      Even more: http://imgur.com/a/lsh82

      Requirements
      - 80 to 85+ range/magic (85+ magic necessary as it is the most important stat). If using LG, have at least 85 of both.
      - High defence and hp (>= 70 for barrows), HP recommend at least 75
      - 43+ prayer
      - Regicide, Underground pass, Biohazard, and Plague City required

      Live Hiscores System
      V1 Hiscores (OLD) V2 Hiscores (CURRENT)
      Dynamic Signatures:
      Automatically load an image of your current stats, which updates as you bot!
      http://www.worthy.rs/tribot-php/ZulrahSlayerV2/sigs/USERNAME_HERE.png Just replace USERNAME_HERE with your TRiBot username (make sure it is all lowercase), and copy and paste it the image link itself into your signature here:
       (should be on the bottom right of your signature edit box).


      Pricing
      The Casual Botter
      - 14.99 CREDITS | 1 auth for 2 weeks
      - 24.99 CREDITS | 1 auth for 1 month
      Note you can buy multiple of the above as well

      Gold Farmer's Discount
      - 79.99 CREDITS | 5 auths for 1 month
      - 134.99 CREDITS | 10 auths for 1 month
      - 174.99 CREDITS | 15 auths for 1 month
      - 224.99 CREDITS | 25 auths for 1 month
      - 299.99 CREDITS | 50 auths for 1 month
      Note: the number of auths designates the number of RS accounts you can run on this script at a given time.


      Click below to purchase or for FREE TWO HOUR TRIAL:

       
      Generic troubleshooting guide:
       
      Happy Botting!
      Worthy 
    • By Worthy
      Accessible now through the script's GUI!
      Just click "READ ME!"

      If you are botting on a remote machine and have difficulties browsing the web (and thus the documentation), pressing the "READ ME" button will also print your link and access token in the Client Debug. You may view this link in any web browser for 5 minutes to view the documentation on any computer.
      So, once pressing the "READ ME" button, the following link to view the documentation is generated in the Client Debug: http://worthy.rs/ZulrahSlayer/documentation.php?user=worthy
      (except it will show your TRiBot name).
    • By Worthy
      Welcome to Worthy Scripts
      |w| Zulrah Helper
       
      NOTE: This script does NOT kill Zulrah for you. It guides you through the kill process and tracks information.
      Think of it as a plugin for RuneScape (as the script never directly interacts with the game, but just paints information on the screen).

      Features
      No risk of ban from the script itself (the only other factor could be the Client but @TRiLeZ states it is undetectable) Easy to set-up GUI Hiscores system (below) Automatic screenshot progress report system every hour Supports resizable mode! (side-panels and transparent chat box support). The bot can remind you to Recharge the blowpipe/trident/serpentime helmets Select the best prayers Wear the selected armor Change combat styles Eat food Cure venom Equip rings of recoil Drink prayer/mage/range potions Use special attacks Repair barrows armor Pickups pets The script guides you to kill Zulrah in the most efficient manner, even taking in Melee safe spots into account Now supporting resizable mode! You may even adjust the size of the script while the script is active!
       
      GUI Settings

       
      How it works (note this is a human playing)
       

      How to setup an equipment profile (from my Zulrah Slayer but same concept)
       
      Requirements
      - 80 to 85+ range/hp/def/magic
      - 43+ prayer
      - Regicide, Underground pass, Biohazard, and Plague City required

      Hiscores System
      Link
       
      Proggies

       
      Pricing
      - 9.99 CREDITS | 6 Months | 1 Auth
      Get it here now!

       
      Dynamic Signature

      [center][url=https://tribot.org/forums/topic/53608-/][img=http://www.worthy.rs/tribot-php/ZulrahHelper/sigs/USERNAME_HERE.png][/url][/center]  
      Things to note:
      Green tiles are where you should currently stand Blue tiles are where you should get ready to stand next Red tiles are where Zulrah will spawn Do use karambwans and magic/range potions for faster kills. Do use function keys (esc, f5) so switch tabs quicker. If a karambwan and food is glowing in green, eat the food first and then the karambwan. When battling a certain Zulrah phase, hover over the blue dot on the minimap, and the second Zulrah dives into the ground, click the blue square. Afterwards then wear your new armor, pray the new prayers, eat (if needed), and change combat styles (if needed). Watch this informative video detailing how to deal with the JAD phase  This script is just an overlay, it is not supposed to be meant with LG as it does not interact with the game. TRiLeZ has stated the client is undetectable, and the script does not interact with the game, so there is no chance of a ban, thus LG is not plausible to use. IF using Looking Glass, use 64-bit OSBuddy. Additionally go into File > Settings on the TRiBot client and increase the paint delay to 50+ to reduce lag.  
      With the required stats, you should be able to "legit" Zulrah in a few kills.
      There is also a two hour trial with the script! Don't be alarmed if you don't kill it on the first try though, it could take a few times to get into the rhythm.

      Regards,
      Worthy
    • By Worthy
      (When searching for my name on skype - Right Click > View Profile)
      WATCH OUT FOR THE SKYPE IMPOSTERS:
      worthytb. (WITH A PERIOD) live:worthytb
      Greetings,
       
      To have a private script created and customized to your needs:
      Add me on skype. (worthyTB) - always ask for a PM. Have a detailed list of steps ready that the bot must do or find a video of these actions being done. More details (prices, questions, etc.) will be discussed over Skype.
      On each authorization, you will be able to run up to 100 instances for 6 months on your TRiBot account and only yours. 
      You will also receive free and quick bug support.
      Private script methods will never be disclosed.
      Pricing will be higher this session due to limited time. 
       
      Vouches:


      Regards,
      Worthy
    • By Worthy
      Save and Load GUI Settings Tutorial
      by Worthy
       
      In this tutorial
      We will be using java.util Propteries class to save and load settings from your GUI (or anything else that is applicable)

      ________
      Adding the proper variables for preparation.
      In your Main class add the location to save the GUI settings
       
      In your GUI class we must create the Save and Load settings methods
       
      Implementing the methods
      On the "Start" button, we will call saveSettings();
      On the script initiation we will call the loadSettings(); (after the GUI has been loaded)
       
      -->Alternatively you can just create seperate save and load buttons on the GUI.


      Tying everything together:
      The first thing the script will do is declare the File Path, and initiate the Preferences file.
      When the GUI loads, the script will then call loadSettings(), loading the settings (if any).
      If no settings are saved, it well then create a new file in the path.
      Right before the GUI is disposed it will save all the settings the user has applied in TRiBot's storage directory. (You can print out the location if you don't know where that is for your OS).

      _________
      Complete Example script:
      GUISettings.java (Main class)

      GUIExample.java (GUI class)
       
       

      Regards,
      Worthy
       
       
    • By Worthy
      AIO Constructor
      By Worthy
       
      Features
      Construct Any Item Including: Planks Bagged plants - FARMING XP! Nails Marble Multiple Banking Methods Manual banking - Rimmington/Falador, Yanille Ring of Dueling and House Teleports Phials unnoting planks Servants Synchronized Servant Support Cook Butler Demon Butler User Experience This entire script has been rewritten optimized for efficiency and flawlessness  Antiban Compliance (ABC) Level 10/10 Quick and easy to use GUI setup Save, Create, and Load presets with ease (documentation below) Sexy mousepaint and paint Dynamic signature system (more info below) Hiscores page  
      Set-up
      Disable middle wheel mouse zoom and fully zoom out! If using Looking Glass, hook the client to 64-bit OSBuddy! Set up a preset following the documentation below Once created, select the preset item which you would like to make and fill out the rest of the GUI Start with just a hammer and saw in Inventory Only if using Servants have coins in Inventory too. Only if using Phials Unnoting have noted planks in Inventory too Only if using RoD/Tele Banking have house tabs in Inventory too  
      Recommended Items to Build
      Levels 1 - 19 → Crude Wooden Chairs (need 138 planks and nails) Levels 19 - 33 → Oak Chairs (need 238 oak planks) Levels 33 - 70  → Oak Larders Levels 70 - 99 → Oak Dungeon Doors 
      OR Levels 52 - 99 → Mahogany Tables (fastest if you have $$)  
      Documentation
       
      Click to buy or try a free 2 hour trial:
       
      4.99 CREDITS for 1 MONTH per Auth
      Or 9.99 CREDITS for 6 MONTHS per Auth
      OR 14.99 CREDITS for 6 MONTHS per 3 Auths
       

      Check your hiscore ranking here!
      Grab your dynamic signature by going to the follow site:
      http://www.worthy.rs/tribot-php/AIOConstructor/sigs/YOUR_TRIBOT_USERNAME_HERE.png  
      Enjoy! 
      Worthy 
    • By Lambda
      Looking at the tutorials I didn't notice anyone using a graph-based framework, so I thought that either people hadn't thought of it or at least the newer or less experience programmers weren't aware of using this, so I thought I'd share it. GraphScript is a graph based framework, using a cyclical graph to model the functionality (where each vertex would be the same as a Node or Task from other frameworks) the advantage of this, is that when doing stuff that is rotational such as a skill or simple minigame (I use Wintertodt as an example, something like Hunter would be a fantastic example as well) then it makes sense to use something that more correctly models a human's behavior.
      What do I mean by cyclical? Take a look at this flow chart I made for Wintertodt
       

       
      To breakdown what is happening in the framework, the bottom section is the overlying framework. It decides whether to bank, or go play the minigame. This area also will potentially go into the wait functionality, if the game hasn't started yet but it doesn't need to bank.
       
      The top section is a little more interesting, essentially the arrows are ways to traverse between eachother. So for example burn will never traverse back to fletch, fletch will never traverse back to chop. The advantage of this is that everything is self contained, you don't have to write code worrying about messing up the burn in the fletching class, since that'll be in its own section. For these simple cyclical things it makes everything much more self contained and easy to work with.
       
      The downside is that you have to be more careful in your coding, if it gets stuck in the chopping class for example, while it's below the door outside of the minigame, the entire script is stuck. Typically it's pretty easy to avoid this happening, it just requires a little extra thought.
       
      Here's the source code: https://github.com/Mkerian10/GraphScript
      I re-wrote this on my pc so and I haven't ran through it so if anyone sees any issues lmk. Of course you don't (and probably shouldn't) directly copy this framework, but rather use the ideas to implement your own.
  • Our picks

    • This release will:

      Add LG support for Runelite


      Fix NPCChat issues


      Fix a bug where the camera angle setter would just hold down a key for 5 seconds (the timeout)


      Slightly adjust the rotation via keys to be more accurate


      Add the ability for asynchronous camera movement via keys


      Make Camera rotation via mouse more fluid, with more antiban, and work much better in resizable mode


      Add a "Camera#setCamera" method, allowing the rotation and angle to be set in parallel


      Increase the likelihood of using the mouse for camera movements


      Add support for adjusting the camera to positionable entities (Positionable#adjustCameraTo)



      Upcoming updates:

      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Thanks
        • Like
      • 44 replies
    • This update will:

      Allow for clicking through the chat box when possible (Thanks @Todd)


      Fix Combat#selectIndex (Thanks @Encoded)


      Ensure worlds stay sorted and added a check to avoid misclicks in the in-game world hopper (Thanks @erickho123)


      Fix out-dated Options API interface indices (Thanks @Todd)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 12 replies
    • This release will:

      Fix login bot after today's game update (Thanks @JoeDezzy1)


      Fix latest in-game world hopping issues (Thanks @erickho123)


      Compact Settings UI and set location relative to TRiBot (Thanks @JoeDezzy1)


      Fix an older implementation of GrandExchange#getWindowState (Thanks @JoeDezzy1)


      Improve the preformance of NPCChat by only searching in certain interface parents (Thanks @JoeDezzy1)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      LG support for RuneLite


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Thanks
        • Like
      • 16 replies
    • This release will:

      Fix bytecode manipulation in order to prevent the modification of parameters within the Filter and Condition classes themselves (thanks @wastedbro)


      Fix NPE caused by non-null value in GE API (thanks @erickho123)


      Add and fix equals methods for api2007.types (thanks @JoeDezzy1)


      Modify Mouse#leaveGame to make the mouse leave the game from top, left, right, or bottom (thanks @erickho123)


      Add Entrana area to Ships API (thanks @erickho123)


      Fix raid prayers index/settings in Prayer API (thanks @erickho123)



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Like
      • 29 replies
    • This update will:

      Implement better canvas locking/synchronization mechanism


      Fix small Login API bug


      Remove the requirement for xbooting Java classes


      Use ExecutorService to perform canvas work in parallel


      Add "Account Management" game tab to GameTab API (thanks @Encoded)


      Fix NPCChat#getMessage (thanks @Encoded )


      Fix NPCChat#selectOption (thanks @Encoded )


      Fix Banking API after today's update (thanks @Encoded )


      Fix in-game world hopper after today's update (thanks @Encoded )



      Upcoming updates:

      Break handler bug fix


      Improved CLI support


      Much more



      Note: If you are using LG, please restart both the RS client and TRiBot
        • Thanks
        • Like
      • 38 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×