Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
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 will:

      Fix LG for both OSBuddy and RuneLite


      Fix issue where the resizable client isn't able to be made smaller (Thanks @JoeDezzy1)


      Fix detection of the logout game tab when resizable mode and side panels are enabled (Thanks @JoeDezzy1)


      Add initial support for Sentry to allow us to identify and easily debug exceptions happening with all TRiBot users


      Add methods to determine if the bank is actually loaded, and not just the overarching interface (Thanks @wastedbro)



      Upcoming updates:

      Improved CLI support


      Full Sentry support


      Much more
        • Like
      • 57 replies
    • This release will:

      Fix NPE in Camera API (Thanks @wastedbro)


      Update deposit box interface ids (Thanks @Encoded)


      Add various bank methods (Thanks @wastedbro)


      Banking#getWithdrawXQuantity


      Banking#getDefaultWithdrawQuantity


      Banking#arePlaceholdersOn




      Fix resizeable minimap bug (Thanks @wastedbro)


      Remove Java 8 requirement


      Please note: TRiBot is not yet fully compatible with Java 10+




      Fix the break handler issues by ensuring the break handler thread never gets paused


      Fix broken settings hooks



      Upcoming updates:

      Improved CLI support


      Much more



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

      Add support for using custom F key bindings to switch between game tabs (Thanks @erickho123)


      Fix tab opening for "Skills" and "Kourend Tasks" (Thanks @erickho123)



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

      Fix an issue where breaks would stop firing


      Fix Combat#getWildernessLevel, use dynamic search for text and cache ID for later calls


      Fix an NPE in the Combat API


      Fix Mouse#leaveGame bug where the mouse wouldn't actually leave the game screen
        • Like
      • 21 replies
    • 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
      • 59 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×