atoo Posted November 16, 2017 Posted November 16, 2017 (edited) Code bellow works fine when we are not breaking, but when im breaking it fucks up and either goes up like 2+ extra logs even though we dont have that many logs. example : we have chopped 200logs, but it returns 240 logs chopped. if(myPlayer() != null) { long oaksInInventory = getInventory().getAmount("Oak logs"); if(oaksInInventory > oakpreviousInvCount){ oakChopped += (oaksInInventory - oakpreviousInvCount); oakpreviousInvCount = oaksInInventory; } else if (oaksInInventory < oakpreviousInvCount){ oakpreviousInvCount = oaksInInventory; } } Reason im asking for some help or tips is because when we have X logs chopped i want it to do something. Edited November 16, 2017 by atoo
Explv Posted November 16, 2017 Posted November 16, 2017 12 minutes ago, atoo said: Code bellow works fine when we are not breaking, but when im breaking it fucks up and either goes up like 2+ extra logs even though we dont have that many logs. example : we have chopped 200logs, but it returns 240 logs chopped. if(myPlayer() != null) { long oaksInInventory = getInventory().getAmount("Oak logs"); if(oaksInInventory > oakpreviousInvCount){ oakChopped += (oaksInInventory - oakpreviousInvCount); oakpreviousInvCount = oaksInInventory; } else if (oaksInInventory < oakpreviousInvCount){ oakpreviousInvCount = oaksInInventory; } } Reason im asking for some help or tips is because when we have X logs chopped i want it to do something. I believe there is a chatbox message you could listen for? Override the onMessage method or add a message listener etc. Or just divide XP gained by xp per log. XP gained can be obtained from the ExperienceTracker 2
atoo Posted November 16, 2017 Author Posted November 16, 2017 9 minutes ago, Explv said: Or just divide XP gained by xp per log. XP gained can be obtained from the ExperienceTracker Thanks for the tip, that seems to work git gud. Gonna check so its flawless even if we are using breaks.
Apaec Posted November 16, 2017 Posted November 16, 2017 As Explv said, there are a numebr of ways. I'd probably rank (in terms of tidiness/reliability) them as follows: Message listener (easiest way is to override onMessage) Inventory listener - you'll have to implement this yourself Calculating from xp gain. Not ideal as it requires xp data which is subject to change, plus relies on being logged in and having valid xptracker data 1
atoo Posted November 16, 2017 Author Posted November 16, 2017 2 minutes ago, Apaec said: As Explv said, there are a numebr of ways. I'd probably rank (in terms of tidiness/reliability) them as follows: Calculating from xp gain. Not ideal as it requires xp data which is subject to change, plus relies on being logged in and having valid xptracker data But it keeps the value of how much xp you have gained even though you log out, which is nice.
HeyImJamie Posted November 16, 2017 Posted November 16, 2017 int logCount; @Override public void onMessage(Message m){ if (m.getType().equals(Message.MessageType.GAME) && m.getMessage().toLowerCase().contains("oak logs")){ logCount++; } } 1
atoo Posted November 16, 2017 Author Posted November 16, 2017 39 minutes ago, HeyImJamie said: int logCount; @Override public void onMessage(Message m){ if (m.getType().equals(Message.MessageType.GAME) && m.getMessage().toLowerCase().contains("oak logs")){ logCount++; } } Lit, thanks.
Apaec Posted November 16, 2017 Posted November 16, 2017 1 hour ago, atoo said: But it keeps the value of how much xp you have gained even though you log out, which is nice. Yeah, but you may find that if you start the script when logged out and stop the script before onStart currently executes, the exp-gained will be some very unpredictable (potentially massive) value as it is not initialised. Not a problem for runtime paint data, but if you start saving data this could be an issue. 1
atoo Posted November 16, 2017 Author Posted November 16, 2017 1 hour ago, Apaec said: Yeah, but you may find that if you start the script when logged out and stop the script before onStart currently executes, the exp-gained will be some very unpredictable (potentially massive) value as it is not initialised. Not a problem for runtime paint data, but if you start saving data this could be an issue. been botting for 2 hours and had 8 breaks. seems to still work fine 1
Apaec Posted November 16, 2017 Posted November 16, 2017 25 minutes ago, atoo said: been botting for 2 hours and had 8 breaks. seems to still work fine 2 hours ago, Apaec said: Yeah, but you may find that if you start the script when logged out and stop the script before onStart executes, the exp-gained will be some very unpredictable (potentially massive) value as it is not initialised. Not a problem for runtime paint data, but if you start saving data this could be an issue.
atoo Posted November 16, 2017 Author Posted November 16, 2017 5 minutes ago, Apaec said: Oh shit didnt read properly, my bad. But doing what u described seems something pretty stupid to do?
Apaec Posted November 16, 2017 Posted November 16, 2017 6 minutes ago, atoo said: Oh shit didnt read properly, my bad. But doing what u described seems something pretty stupid to do? Yeah, but nonetheless you've got to account for it! That's what programming is about ;p 1
atoo Posted November 17, 2017 Author Posted November 17, 2017 19 minutes ago, Apaec said: Yeah, but nonetheless you've got to account for it! That's what programming is about ;p Well said man, well said.