Jump to content
Sign in to follow this  
Yawodo

Free Cookies / Easy Script Help Plz / Click Bait OP

Recommended Posts

Hey guys, just got my first home made script working (I followed a tutorial, guilty.. but I learnt a lot, and am about ready to start on something unique.

So building on that I want to fix the Timer problem in my script by using the one inside the TRiBot API, I see that there is a Timing class.

Would anyone be kind enough to share with me the line of code that I would need to write to implement that class into the script I currently have. And then there are no (reset) or (isRunning) methods within that class (because the original was from PowerBot, don't ban me plz xD) so what would I have to replace those with to achieve the dynamic mining functionality that I was trying to achieve.

Thank you in advance and I hope I have made my problem clear, if not please say !

Timer1.PNG

Timer2.PNG

Edited by Yawodo
Language

Share this post


Link to post
Share on other sites

Not quite understanding your question, but you would want to use dynamic sleeps like so. 

				Timing.waitCondition(new Condition() {
					@Override
					public boolean active() {
						General.random(200, 400);
						return Player.getAnimation() == -1;
					}
				}, General.random(700, 1200));

That is a basic dynamic sleep, you would want to change the return based on whatever you're doing along with the time out. Also you should be checking the length of that rock array, you don't need to null check. Only rock.length > 0

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, godspower33 said:

Not quite understanding your question, but you would want to use dynamic sleeps like so. 

				Timing.waitCondition(new Condition() {
					@Override
					public boolean active() {
						General.random(200, 400);
						return Player.getAnimation() == -1;
					}
				}, General.random(700, 1200));

That is a basic dynamic sleep, you would want to change the return based on whatever you're doing along with the time out. Also you should be checking the length of that rock array, you don't need to null check. Only rock.length > 0

Thanks for the quick responce. A dynamic sleep? Is that a sleep timer that has a degree of randomisation to it? and 700ms and 1,200ms are standardised timings you use? If so that sounds good to me.

 

21 minutes ago, Encoded said:

If you want exact replication of your current code:

rock.click("Mine");
long time = System.currentTimeMillis();
while (Player.getRSPlayer().getAnimation() == -1 && Timing.timeFromMark(time) <= 3000) {

 

Great, if you don't mind me asking how do I go about loading the 'Timing' class from TRiBot into my script. It really is as nooby a question as it sounds. Sorry and thanks !

Share this post


Link to post
Share on other sites
44 minutes ago, Yawodo said:

Thanks for the quick responce. A dynamic sleep? Is that a sleep timer that has a degree of randomisation to it? and 700ms and 1,200ms are standardised timings you use? If so that sounds good to me.

 

Great, if you don't mind me asking how do I go about loading the 'Timing' class from TRiBot into my script. It really is as nooby a question as it sounds. Sorry and thanks !

https://tribot.org/doc/

Share this post


Link to post
Share on other sites
34 minutes ago, Worthy said:

I've tried to add the class how I think its supposed to be added. This has caused the class to load in from the TRiBot API great, however it is telling me its currently an unused import statement. @Worthy

Probaby because get this red text on 'waitCondition' now which basically says cannot resolve method and i've no idea what mess i've got myself into :D@godspower33

Timing.PNG

Test2.PNG

Share this post


Link to post
Share on other sites
import org.tribot.api.Timing;

Import timing and you have access to the timing class. Do you have all the imports? Is there an import error for that? Also what that dynamic sleep does is it will wait until the return condition is either satisfied or you reach the time-out which is .7-1.2 seconds. You would want to change that based on your activity. So in short, if it doesn't return your condition within 1.2 seconds it will just continue with the script

  • Like 1

Share this post


Link to post
Share on other sites
7 hours ago, godspower33 said:
import org.tribot.api.Timing;

Import timing and you have access to the timing class. Do you have all the imports? Is there an import error for that? Also what that dynamic sleep does is it will wait until the return condition is either satisfied or you reach the time-out which is .7-1.2 seconds. You would want to change that based on your activity. So in short, if it doesn't return your condition within 1.2 seconds it will just continue with the script

@godspower33 thanks buddy got it all working now with your help and some persistance. You'll notice at the bottom of my script i've a return 120; is that how long it waits before looping or can I delete it ? Not sure right now what it relates to thanks a ton!

If you or any other scripters had some good quality open source basic project i'd like to look at them to see the logic, how you implement methods etc. Feel free to PM me if you don't want them public!

:)

 

return120;.PNG

Share this post


Link to post
Share on other sites
3 hours ago, Yawodo said:

@godspower33 thanks buddy got it all working now with your help and some persistance. You'll notice at the bottom of my script i've a return 120; is that how long it waits before looping or can I delete it ? Not sure right now what it relates to thanks a ton!

If you or any other scripters had some good quality open source basic project i'd like to look at them to see the logic, how you implement methods etc. Feel free to PM me if you don't want them public!

:)

 

return120;.PNG

I highly suggest learning the basics of Java before you guess about how to do everything.

The return statement at the bottom of your method returns an integer, as your method signature says.

 

These things are extremely basic, and you should know them very well before you attempt/guess at scripting.

https://docs.oracle.com/javase/tutorial/index.html

  • Like 1

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
Sign in to follow this  

  • Our picks

    • This release includes:

      Fix shift clicking option selecting


      Fix high paint delay settings saving


      Update prayer IDs for the quick select menu


      Remove RS3 support


      Fix hooks



      RS3 Support Removed

      The RS3 client hasn't been updated since our Old-School version of TRiBot was released, as many of you may have noticed. Keeping all of the RS3 code in the client made the client as a whole harder to maintain, larger, slower, and messier. As hardly anyone still uses the RS3 client, and since the RS3 API was hardly functioning, we made the decision to completely remove it from TRiBot.

      For the average user, this means that the client will be smaller, cleaner, and faster. Future updates will also take less work meaning there will be more frequent updates.

      If you were one of the few users still using the RS3 client, we apologize for the inconvenience. No future support for RS3 is planned. There are many other botting clients which has support for RS3, so we recommend finding an alternative if you wish to continue botting on RS3.
        • Thanks
        • Like
      • 22 replies
    • Please welcome our new developers, @JoeDezzy1, @erickho123, @Encoded, and @wastedbro.

      These members will be responsible for working on, maintaining, and improving TRiBot.

      This means that bug fixes and improvements will now come at a much faster pace! We're committed to providing users with the best botting experience possible!
        • Thanks
        • Like
      • 30 replies
    • This release includes:

      More 3rd party libraries for script writers to use


      Apache Commons Codec


      Apache Commons Collections


      Apache Commons Configuration


      Apache Commons IO


      Apache Commons Lang


      Apache Commons Math


      GSON


      Guava


      JFoenix




      Hint arrow API


      Game#getHintArrowX


      Game#getHintArrowY




      Fix player hooks including Player#getSkullIcon and Prayer#getPrayerIcon
        • Thanks
        • Like
      • 49 replies
    • This update includes:

      Fix broken hooks


      Fix login bot for the message "No reply from login server. Please wait 1 minute and try again."


      Fix bug relating to which bot tab is sent human input


      General#randomLong bug fix involving negative numbers


      Fix GE API



      Please note: There are still some issues with the login bot due to a change in the game mechanisms handling the login screen. We're working on a fix and will upload it when ready.
        • Thanks
        • Like
      • 37 replies
    • This release will:

      Fix key event handling issue


      Fix other event handling issue


      Fix RSServer hook


      Update world hopper to have it use OCR, thanks to Todd


      Use proper disposal of old Graphics objects


      Reformat code


      Rearrange code


      Organize code imports


      Apply around 8000 automated code refactorings


      Make preparations for Java 9


      Fix 11 various bugs


      Add more reliable debugging support


      Fix mouseEntered/Exited event dispatching bug


      Fix minimap walking bug where it opens the map


      Fix broken hooks for today's game update
        • Thanks
        • Like
      • 100 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×