Jump to content

How to delay checks


Daviyow

Recommended Posts

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

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.

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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