Daviyow Posted April 7, 2014 Share Posted April 7, 2014 How do you guys delay checks like getting the range xp or what the user is wearing, do i really need to do it onLoop with a boolean, (just to check once), at the moment im doing it with onStart(), but it isnt that good because when the user is logged out and lets say the user starts the script it would be null ofcourse because he/she wasnt logged in. so i would like to hear what you guys do, just simply onLoop? Link to comment Share on other sites More sharing options...
Novak Posted April 7, 2014 Share Posted April 7, 2014 what are you talking about? put it in the onStart Link to comment Share on other sites More sharing options...
Jack Posted April 7, 2014 Share Posted April 7, 2014 (edited) I put nothing in the onStart() method and just run a loop in the start of the onLoop() method. This logs the user in and then you can check the xp and gear. Edited April 7, 2014 by Jack Link to comment Share on other sites More sharing options...
Deffiliate Posted April 7, 2014 Share Posted April 7, 2014 I know what you're saying. If you put it o nthe onStart() and the person starts logged out it will f up ur xp tracking. However the best way is to just use the expTracker class in OSb's api. Link to comment Share on other sites More sharing options...
Daviyow Posted April 7, 2014 Author Share Posted April 7, 2014 I know what you're saying. If you put it o nthe onStart() and the person starts logged out it will f up ur xp tracking. However the best way is to just use the expTracker class in OSb's api. Yeah, but stil would be a problem for checking equipmentTab what the player is wearing :P Link to comment Share on other sites More sharing options...
Ande Posted April 7, 2014 Share Posted April 7, 2014 I think you could put something like this in your onloop if(!checked && client.getLoginState() == 30){ checkThings(); } 1 Link to comment Share on other sites More sharing options...
Karmik Posted April 7, 2014 Share Posted April 7, 2014 What the guy above me said. If you want to check things once, either set the variable to something it wouldn't be possible to reach when checked through the loop, or use a boolean to lock the if statement forever once the code is run. int startXP = -1; public void update(Script script){ if(startXP == -1){ startXP = script.getXP(); } } Since players don't ever have negative xp, it doesn't matter what we set that to. I do suggest that if you are needing multiple checks, to just make a superate class and place the update method at the start of your onLoop() method so it doesn't clutter stuff up for you. 1 Link to comment Share on other sites More sharing options...