Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
Yawodo

Free Cookies / Easy Script Help Plz / Click Bait OP

9 posts in this topic

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

1 person likes this

Share this post


Link to post
Share on other sites

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) {

 

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

1 person likes this

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

1 person likes this

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  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.