Jump to content

[withdrawing an addy scim with getbank().withdraw method] Not sure if bug or something weird with my code (possible bug?)


Satire
 Share

Recommended Posts

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 by lol0
Link to comment
Share on other sites

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 by nosepicker
Link to comment
Share on other sites

 

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 by lol0
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 smile.png

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 by lol0
  • Like 1
Link to comment
Share on other sites

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

  • Like 1
Link to comment
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.

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.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...