Satire Posted December 9, 2016 Share Posted December 9, 2016 (edited) So I have no idea wtf is happening. I thought I coded something wrong, maybe it's just my computer. So I have an id for all the scimitars in the game. When I call getBank().withdraw(idname, 1); My client lags so god damn hard like something is going to shit. So I tried it with food, strangely enough no lag. Could this be a bug with my code or this certain ID?So I have int idname = theid; in this case its 1331. Now when I call it on purpose this happens https://puu.sh/sJik7/fb7c80c853.mp4 notice when I pushed stop the mini map stops lagging and everything goes well. Now if I was to recreate this with food, this is the result https://puu.sh/sJios/0194facc6e.mp4 So I'm not sure what is exactly happening.... Forcing both of them the exact same way, is it a bug? EDIT3: Solved, if this occurs for you then it's your OnPaint method somewhere. I fixed it by removing a line. Edited December 9, 2016 by lol0 Quote Link to comment Share on other sites More sharing options...
Butters Posted December 9, 2016 Share Posted December 9, 2016 (edited) Best would be not to use ID's. Better hardcode the names of the scimitars. bank.withdraw("Adamant scimitar", 1); Edit: Also a good idea would be to use conditional sleeps between each withdrawal, like: new ConditionalSleep(3000, 500) { @[member=Override] public boolean condition() throws InterruptedException { return bank.withdraw("Adamant scimitar", 1); }.sleep(); Have your logger opened when trying do withdraw stuff your way. I suspect a null pointer exception. Edited December 9, 2016 by nosepicker Quote Link to comment Share on other sites More sharing options...
Satire Posted December 9, 2016 Author Share Posted December 9, 2016 (edited) Best would be not to use ID's. Better hardcode the names of the scimitars. bank.withdraw("Adamant scimitar", 1); Tried with strings too, still the same result. There's a bug with the method somewhere. I'm not sure if it's only for the addy scim. I will test it out for the other scims too! Edit: Also a good idea would be to use conditional sleeps between each withdrawal, like: new ConditionalSleep(3000, 500) { @[member='Override'] public boolean condition() throws InterruptedException { return bank.withdraw("Adamant scimitar", 1); }.sleep(); Have your logger opened when trying do withdraw stuff your way. I suspect a null pointer exception. I always have the logger opened. I tried with condition sleeps and without condition sleeps and even normal sleeps, still the same thing... No null pointer exception. I declare it, a bug... Edited December 9, 2016 by lol0 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted December 9, 2016 Share Posted December 9, 2016 Maybe it's something else in your code, I never has any issues with things lik that. Mind showing your whole code? if you have a npe in your paint, no error will be shown in the logger, but lagg can occur Try to start the client from cmd line with -debug paramater,t hat way you can see every single error. Quote Link to comment Share on other sites More sharing options...
Satire Posted December 9, 2016 Author Share Posted December 9, 2016 (edited) Maybe it's something else in your code, I never has any issues with things lik that. Mind showing your whole code? if you have a npe in your paint, no error will be shown in the logger, but lagg can occur Try to start the client from cmd line with -debug paramater,t hat way you can see every single error. Lmfao yep, it was. Commented the whole paint line out and boom, no lagg. By all means, what does NPE mean? I've never heard of NPE. NPC Entity? (sorry if it's wrong) Null Pointer Exception, took me a while to realize (was too busy focusing on my script). But why did it only occur with adamant scims and nothing else? Super weird. g.setColor(Color.WHITE); //Time Drawn on the Screen timeRan = System.currentTimeMillis() - this.timeBegan; g.drawString(ft(timeRan), 125, 392); //Drawing Numbers of the Screen currentXPAttack = skills.getExperience(Skill.ATTACK); xpGainedAttack = currentXPAttack - beginningXPAttack; currentLevelAttack = skills.getStatic(Skill.ATTACK); levelsGainedAttack = currentLevelAttack - beginningLevelAttack; g.drawString("" + xpGainedAttack + " (" + levelsGainedAttack + ")", 136, 440); currentXPStrength = skills.getExperience(Skill.STRENGTH); xpGainedStrength = currentXPStrength - beginningXPStrength; currentLevelStrength = skills.getStatic(Skill.STRENGTH); levelsGainedStrength = currentLevelStrength - beginningLevelStrength; g.drawString("" + xpGainedStrength + " (" + levelsGainedStrength + ")", 140, 465); currentXPHitpoints = skills.getExperience(Skill.HITPOINTS); xpGainedHitpoints = currentXPHitpoints - beginningXPHitpoints; currentLevelHitpoints = skills.getStatic(Skill.HITPOINTS); levelsGainedHitpoints = currentLevelHitpoints - beginningLevelHitpoints; g.drawString("" + xpGainedHitpoints + " (" + levelsGainedHitpoints + ")", 140, 413); g.drawString("Status:",27,53); g.drawString(getState().toString(),75,53); This is the whole onPaint code. It lags when I have it on and I want to keep it on. I'm assuming its the time ran which is causing it to go all crazy. How would I solve it without having to remove it? Edit found the problem "g.drawString("Status:",27,53); g.drawString(getState().toString(),75,53);" I had this in there temp for debugging purposes as I like to use the console for the actual loops.... I guess I'll have to find another way. Edited December 9, 2016 by lol0 1 Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted December 9, 2016 Share Posted December 9, 2016 Lmfao yep, it was. Commented the whole paint line out and boom, no lagg. By all means, what does NPE mean? I've never heard of NPE. NPC Entity? (sorry if it's wrong) Null Pointer Exception, took me a while to realize (was too busy focusing on my script). But why did it only occur with adamant scims and nothing else? Super weird. g.setColor(Color.WHITE); //Time Drawn on the Screen timeRan = System.currentTimeMillis() - this.timeBegan; g.drawString(ft(timeRan), 125, 392); //Drawing Numbers of the Screen currentXPAttack = skills.getExperience(Skill.ATTACK); xpGainedAttack = currentXPAttack - beginningXPAttack; currentLevelAttack = skills.getStatic(Skill.ATTACK); levelsGainedAttack = currentLevelAttack - beginningLevelAttack; g.drawString("" + xpGainedAttack + " (" + levelsGainedAttack + ")", 136, 440); currentXPStrength = skills.getExperience(Skill.STRENGTH); xpGainedStrength = currentXPStrength - beginningXPStrength; currentLevelStrength = skills.getStatic(Skill.STRENGTH); levelsGainedStrength = currentLevelStrength - beginningLevelStrength; g.drawString("" + xpGainedStrength + " (" + levelsGainedStrength + ")", 140, 465); currentXPHitpoints = skills.getExperience(Skill.HITPOINTS); xpGainedHitpoints = currentXPHitpoints - beginningXPHitpoints; currentLevelHitpoints = skills.getStatic(Skill.HITPOINTS); levelsGainedHitpoints = currentLevelHitpoints - beginningLevelHitpoints; g.drawString("" + xpGainedHitpoints + " (" + levelsGainedHitpoints + ")", 140, 413); g.drawString("Status:",27,53); g.drawString(getState().toString(),75,53); This is the whole onPaint code. It lags when I have it on and I want to keep it on. I'm assuming its the time ran which is causing it to go all crazy. How would I solve it without having to remove it? Edit found the problem "g.drawString("Status:",27,53); g.drawString(getState().toString(),75,53);" I had this in there temp for debugging purposes as I like to use the console for the actual loops.... I guess I'll have to find another way. Yes it's a nullpointer exception, meaning that you are trying to acces a variable that is null. I'm glad you found your issue now, if you any more questions, feel free to ask me 1 Quote Link to comment Share on other sites More sharing options...