Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Buy OSRS Gold

Sell OSRS Gold
Sign in to follow this  
Guest

Better Cannon Clicker (BCC)

Recommended Posts

Guest

A script that places a cannon where you're standing and proceeds to click on it randomly every 20-30+ seconds. It's my first script under Tribot and I'm still learning the API but figured I'd release it. Give it a try and let me know what I can change, etc.

 

Download here.

Source code here.

 

9bd143fb59e9075a3277d7ac64aa1bac.png

Edited by BizarreAlex
  • Like 1

Share this post


Link to post
Share on other sites
Guest
4 hours ago, Naton said:

Nice release! If you ever want feedback on your code from others you can open source your script.

Went ahead and open sourced it.
If anyone experienced with the Tribot API wants to give me a couple pointers that'd be great.

Share this post


Link to post
Share on other sites
Guest
9 minutes ago, HeyImJamie said:

Looks good. My only suggestion would be to cache the cannon's position when you place it and filter for objects at that position, just in case someone sets up a cannon close to it and the script somehow moves.

 

The RSObject representing the cannon is stored to a variable at first load attempt and for future attempts referenced again to click. To my knowledge that should prevent clicking anyone else's cannon unless for whatever reason the bot deploys the cannon inside of another which I don't even think is possible.

Please correct me if I'm wrong.

4b508a43e90b4ed1a25a9c119e83dd21.png

The nearest object should always be the cannon that the player deploys because right after deployment the bot walks onto the same tile as the cannon.

Edited by BizarreAlex

Share this post


Link to post
Share on other sites
1 minute ago, BizarreAlex said:

 

The RSObject representing the cannon is stored to a variable at first load attempt and for future attempts referenced again to click. To my knowledge that should prevent clicking anyone else's cannon unless for whatever reason the bot deploys the cannon inside of another which I don't even think is possible. The nearest object should always be the cannon that the player deploys because right after deployment the bot walks onto the same tile as the cannon.

 

Please correct me if I'm wrong.

4b508a43e90b4ed1a25a9c119e83dd21.png

That's correct, but you call walking once and can't guarantee it will walk to that exact tile everytime. If it missclicks and runs away, you could end up caching someone else's cannon. I know this is unlikely, but I see no reason to write code to prevent things like that happening. It's not a big deal, but just a suggestion. :) 

Share this post


Link to post
Share on other sites
Guest
2 minutes ago, HeyImJamie said:

That's correct, but you call walking once and can't guarantee it will walk to that exact tile everytime. If it missclicks and runs away, you could end up caching someone else's cannon. I know this is unlikely, but I see no reason to write code to prevent things like that happening. It's not a big deal, but just a suggestion. :) 

 

The "placeCannon" method will return false if the player's location isn't on the same tile as the cannon which would stop the script and notify the user.

fa1098f7ed3e88611da1ec24eda507fb.png"x" = player's X coordinate prior to placing the cannon (which will be the cannon's position"

"y" = player's Y coordinate prior to placing the cannon (which will be the cannon's position"

Share this post


Link to post
Share on other sites
7 minutes ago, BizarreAlex said:

 

The "placeCannon" method will return false if the player's location isn't on the same tile as the cannon which would stop the script and notify the user.

fa1098f7ed3e88611da1ec24eda507fb.png"x" = player's X coordinate prior to placing the cannon (which will be the cannon's position"

"y" = player's Y coordinate prior to placing the cannon (which will be the cannon's position"

Ah yeah, just re-read it. I'd still filter it out of preference, makes no sense not too. Good job anywho

Share this post


Link to post
Share on other sites

Things you might want to consider improving:

 

 long timeRan = System.currentTimeMillis() - startTime;

Using Script.getRunningTime() would be ideal, because it takes into account the script's breaks. Using system time does not.

 

private int startXP = Skills.getXP(Skills.SKILLS.RANGED);
private int startLevel = Skills.getCurrentLevel(Skills.SKILLS.RANGED);

This will malfunction if the user doesn't start the script logged in. You need to initialize those variables after the player had a chance to log in and cache this data.

 

RSItem[] data = Inventory.find("Cannon base");
RSObject[] objects = Objects.findNearest(15, 5);

You might want to use more suggestive, less ambiguous names for your variables. For example, since the first array of RSItems might contain Cannon base(s), instead of data a more appropriate name would be cannonBase.

 

 if (!(started))

Will still compile and work correctly, but the inner braces are not necessary.

 

 

Thank you for your contribution.

WkqyHuJ.png  :cool:

 

Share this post


Link to post
Share on other sites
Guest
14 hours ago, Einstein said:

Things you might want to consider improving:

 

 long timeRan = System.currentTimeMillis() - startTime;

Using Script.getRunningTime() would be ideal, because it takes into account the script's breaks. Using system time does not.

 

private int startXP = Skills.getXP(Skills.SKILLS.RANGED);
private int startLevel = Skills.getCurrentLevel(Skills.SKILLS.RANGED);

This will malfunction if the user doesn't start the script logged in. You need to initialize those variables after the player had a chance to log in and cache this data.

 

RSItem[] data = Inventory.find("Cannon base");
RSObject[] objects = Objects.findNearest(15, 5);

You might want to use more suggestive, less ambiguous names for your variables. For example, since the first array of RSItems might contain Cannon base(s), instead of data a more appropriate name would be cannonBase.

 

 if (!(started))

Will still compile and work correctly, but the inner braces are not necessary.

 

 

Thank you for your contribution.

WkqyHuJ.png  :cool:

 

I’ve been developing with Java for several years now and have developed my own personal style of coding which includes the inner braces when checking booleans. As for what you claim to be ambiguous naming, that’s completely preference but giving an Array a singular name such as “cannonBase” isn’t something I’d do. I’ll consiser doing the first thing you mentioned but as already stated in the script description the user should start the script at their location so they should already be logged in.

Share this post


Link to post
Share on other sites
8 hours ago, BizarreAlex said:

I’ve been developing with Java for several years now and have developed my own personal style of coding

 

If you can't even comprehend a different opinion, stop asking for feedback.

 

Good luck with your own personal special style.

 

Edited by Einstein

Share this post


Link to post
Share on other sites
Guest
5 hours ago, Einstein said:

 

If you can't even comprehend a different opinion, stop asking for feedback.

 

Good luck with your own personal special style.

 

I asked for tips regarding the API, not for irrelevant information about how I choose to negative check booleans. I thank you for the other suggestions you made but it seemed to me like you were nitpicking.

Share this post


Link to post
Share on other sites
Guest
9 hours ago, Einstein said:

Then follow the first two suggestions that are 100% API related.

As for the code suggestions, I took some of my time to read your source and tried to be helpful towards a new member, so you have no reason to get aggressive, unless you are hysterical.

I don't give a shit about your years of coding experience. Bad practices are still bad practices. If you want to call them "style preferences" then go ahead, you can do whatever you want. But don't expect others not to point them out when you publish them.

 

Also, as a side note. Your logic is complete garbage and the code structure is the ugliest thing I've seen in a long time. So instead of focusing on your special magic unique style preferences, you might want to try and adhere at least partially to some real code preferences, or at least remove the profanity from your source code because this is funny only for kids with down syndrome.

 

 

Haha, I'm not the one being aggressive. I'm not sure where you learned Java, but how I check booleans is not bad practice and (imho) looks cleaner. However, at the end of the day they both compile down to the same thing so your point is irrelevant.

I spent five minutes looking at the API before I wrote this script, so I apologize if the structure is not to your liking, but you've been a member of these forums for a over year whereas I joined less than two weeks ago.

I asked for pointers regarding the API, and as I've already stated, thank you for the advice you gave pertaining to that. However, again, as stated previously, you seem to be nitpicking quite a bit (I mean seriously, you're bitching about profanity in my SOURCE code?).

Despite your name, you're anything but a genius my dude, so calm down.

 

Share this post


Link to post
Share on other sites

@BizarreAlex

Script seems to be broken. I'll provide the crash debug below. 

 

  • [19:15:21] Starting base functions...
  • [19:15:21] Checking for cannon base..
  • [19:15:31] Failed to place cannon, script stopping.
  • [19:15:31] Exception in thread "pool-7-thread-5"
  • [19:15:31] java.lang.IllegalMonitorStateException
  • [19:15:31] at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(Unknown Source)
  • [19:15:31] at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(Unknown Source)
  • [19:15:31] at java.util.concurrent.locks.ReentrantLock.unlock(Unknown Source)
  • [19:15:31] at java.util.concurrent.LinkedBlockingQueue.take(Unknown Source)
  • [19:15:31] at java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source)
  • [19:15:31] at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  • [19:15:31] at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  • [19:15:31] at java.lang.Thread.run(Unknown Source)

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Our picks

    • To better support the upcoming changes (TRiBot X, new repository), we're switching our login handler to Auth0. Instead of logging in with the standard form, you'll now be required to login through our Auth0 application.

      All existing accounts which have been used within approximately the past year have been imported into Auth0 using the same email and password combination which has been stored on the forums.

      What does this mean for users?

      Your account credentials are now even more securely stored


      You'll be able to login via Facebook, Google, and others in the future


      Is there anything users have to do differently now?

      Existing users: You'll have to login with the standard login, open your Account Settings, then link your Auth0 account


      New users: You'll be redirected to our Auth0 app (auth.tribot.org) where you'll be able to create an account


      Why was this change made?

      The new apps we are creating (such as the new repository) aren't able to use the forums to handle user logins


      To centralize all user accounts in one area


      To ensure that the client login doesn't go down when the forums are having problems


      To speed up our development


      Other considerations

      There's no documentation or official support for using Invision Community combined with Auth0, so there are still a few kinks we're working out


      We're in the works of creating an account management panel specifically for Auth0 accounts (ETA August)


      It's not possible to change email addresses for the time being (this will be resolved this August)


      Changing passwords is a weird process for the time being. To change your password, you'll have to use the "Don't remember your password" tool on the Auth0 login page
        • Like
      • 10 replies
    • Over the past month, we've been working hard on TRiBot's new repository - a much needed update. This change has been deemed necessary for TRiBot X, and will allow us to really speed up development of all aspects of TRiBot.

      Today we are going to share what we've been working on!


      Now you must be wondering what kind of features the new repository will have.... well, you'll have to be patient for a little while longer. We're still figuring out various technical aspects so we can't provide answers to all possible questions. We're also focusing on development rather than writing about it so that everyone can get access to our latest developments at lightning speed. I will however answer a few users' questions.

      We're planning on a release of this early to mid August, giving users some goodies before TRiBot X's release.

      Thank you all for being patient. I hope everyone is excited as much as I am!
        • Like
      • 17 replies
    • Over the past few months, I’ve been working diligently on a new project - TRiBot X. Everything has been written from the ground up, with all of the best practices of software engineering. Every aspect of TRiBot has been re-imagined to support three main goals: flexibility, useability, and reliability.
        • Like
      • 50 replies
    • Come give us feedback on the next version of TRiBot!
        • Thanks
        • Like
      • 86 replies
    • TRiBot is looking to improve a lot of its customer relationship management, customer on boarding process, customer experience, design elements, community engagement and pretty much everything else you can imagine when it comes to marketing.

      Our goal: To ensure that the marketing done TRULY reflects the experience and does not shine an inaccurate light on what TRiBot is lacking in.

      So I ask, what do you love about TRiBot and what do you hate about TRiBot? What does O S Bot, Rune M8, PowR Bot and Dre amBot do better? (yes I purposely didn't spell it right 😂).

      Love, 

      RileyZ
        • Like
      • 26 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...