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 update will:

      Fix GE inventory item positioning bug


      Fix broken object hooks
      • 23 replies
    • This release will:

      Fix some ClosedChannelException bug


      Fix bug in RSObject#getAllTiles


      Add game tab support for "Kourend Favour"
      • 15 replies
    • This release will:

      Fix Settings UI placement bug


      Fix game object location bug


      Fix small layout bug making the client shift up and down


      Fix client crashing bug where loading the client with a small display area will cause the client to crash


      Fix annoying Linux bug relating to painting events and peers


      Fix settings saving bug where settings are saved to disk more often than they should


      Fix RSInterface#isBeingDrawn bug affecting a limited amount of people


      Drop Java 1.7 bytecode version for 1.8


      Important: Since the downloadable RS client uses Java 7, it will no longer be compatible with Looking Glass. To make up for this, we will add support for using other clients such as RuneLite (at a later date).


      This change was necessary to allow us to use Java 8 syntax. It also paves the way for Java 9/10/11 support.
      • 40 replies
    • This update will:

      Fix the RSMenuNode bug which also fixes the bug with bank opening


      Fix the incorrect object positions bug


      Fix and re-enable the LG Objects API Accelerator


      Fix the RSObject#getAllTiles bug
      • 22 replies
    • Try our development release by checking "Development Release" on the TRiBot Loader. Note that these new features are currently in beta.

      This release features:

      Re-sizable mode support for both LG and the regular client


      Slightly improved login bot


      Removed final access modifiers from API classes


      Added RSServer hook wrapper to get the client's cached list of server/world info


      [NEW] Bug fix for intelligent banking


      [NEW] Improvement to the stability of LG over time


      [NEW] Vastly improved the reliability and speed of Screen#getColorAt on both LG and the regular client


      [NEW] Fix LG login problems


      [NEW] Fixed re-sizable mode container bug


      [NEW] Fixed re-sizable mode mouse bug


      [NEW] Use of public constants in the Banking API


      [NEW] Use of other various constants such as Projection#NULL_PT and Screen#EMPTY_COLOR



      More features to come very soon!

      Please test it and let us know here if there are any new bugs introduced in this release.
      • 12 replies
  • Recently Browsing   0 members

    No registered users viewing this page.

×