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

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

    • This release will:

      Fix prayers and world hopper API (Thanks @JoeDezzy1 and @erickho123)


      Improve banking API (Thanks @Encoded)


      Adds methods for returning and using Java Lists, rather than arrays


      Slightly randomizes some hardcoded behaviour


      Removes sleeps from waitConditions; the efficiency saving potential is negligible in these use-cases, therefore cleaner code is preferable


      Other back-end improvements





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

      Add new internal framework for capturing exceptions


      Fix issue with not selecting the last column in world hopper (Thanks @Todd)


      Add a message about pin usage in Banking#openBank (Thanks @Todd)


      Disable the firewall by default (Thanks @Todd)


      Fix handling of the welcome screen after login (Thanks @Encoded)


      Fix wrong amount bank withdrawal (Thanks @Encoded)


      Fix Screen#isInViewport


      Fix Game#isInViewport (Thanks @Encoded)


      Call onBreakEnd for ListenerManager Breaking Listeners (Thanks @Encoded)


      Fix Prayer#getPrayerPoints NumberFormatException (Thanks @JoeDezzy1)



      Note: If you are using LG, please restart both the RS client and TRiBot.
        • Thanks
        • Like
      • 28 replies
    • 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
      • 64 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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...