Jump to content

Conditional Sleeps


5uck

Recommended Posts

New java class (call it what you want)

public class NAMEHEREConditionalSleep extends ConditionalSleep {

private final Script SCRIPT;

public NAMEHEREConditionalSleep(int arg0, Script script) {
super(arg0);
this.SCRIPT = script;
}

@Override
public boolean condition() {
return CONDITION HERE(If this is true, it will sleep.);
}

}

An example of a somthing to put in CONDITION HERE would be

 

return client.getMyPlayer().isAnimating();

Now whenever you call you conditional sleep, and your playing is animating, it will sleep until he stops animating.

 

Hope this helped! enjoy!

Link to comment
Share on other sites

 

 

Use it like so.

 

New java class (call it what you want)

public class NAMEHEREConditionalSleep extends ConditionalSleep {

private final Script SCRIPT;

public NAMEHEREConditionalSleep(int arg0, Script script) {
super(arg0);
this.SCRIPT = script;
}

@Override
public boolean condition() {
return CONDITION HERE(If this is true, it will sleep.);
}

}

An example of a somthing to put in CONDITION HERE would be

 

return client.getMyPlayer().isAnimating();

Now whenever you call you conditional sleep, and your playing is animating, it will sleep until he stops animating.

A new class isn't needed... very inefficient and doesn't follow oop

 

 

as for the doesnt follow loop part, it is only called from within the loop, so yeah it does follow the loop.

 

Dumbass oop stands for Object-orientated programming, why don't you learn it?

might aswell continue it here

Link to comment
Share on other sites

Simplified

public void sleepCondition(boolean condition, int sleepTime) {
        while(condition) {
            sleep(sleepTime);
        }
}

Tho still wondering why you would need this

What if the condition was never to return false? Enjoy doing nothing endlessly. Also, why would you not finalize your objects? Also, why should the condition has to be a boolean, why can't it be something else, such as a numerical value?

Edited by Pseudo
Link to comment
Share on other sites

Use it like so.

New java class (call it what you want)public class NAMEHEREConditionalSleep extends ConditionalSleep {

private final Script SCRIPT;

public NAMEHEREConditionalSleep(int arg0, Script script) {

super(arg0);

this.SCRIPT = script;

}

@Override

public boolean condition() {

return CONDITION HERE(If this is true, it will sleep.);

}

}

An example of a somthing to put in CONDITION HERE would be

return client.getMyPlayer().isAnimating();

Now whenever you call you conditional sleep, and your playing is animating, it will sleep until he stops animating.

A new class isn't needed... very inefficient and doesn't follow oop
as for the doesnt follow loop part, it is only called from within the loop, so yeah it does follow the loop.
Dumbass oop stands for Object-orientated programming, why don't you learn it?

might aswell continue it here

He never asked for anything related to oop. He simply asked fora code like the one 5uck gave. By nature java is an oop language, it doesn't matter if he used objects here or not. Sooo learn2geteducation before trying to act like you know anything about anything.
Lol your joking right? i did this because he came n commented on my shit

i never asked for his opinion on my shit

Do you know the concept behind OOP? creating a new class for each check definitely does not follow an OOP design or isn't organized

"He never asked for anything related to oop", this should be expected when releasing java code

You should realize that classes are part of Java making them part of oop. You think your methods are better and he thinks his are better. He has multiple very successful scripts, so I would follow his over yours. If it works it works. Get over it.
Omg are you serious? OOP is a programming concept that you take into consideration when writing a java program

just because java is a object-orientated programing language doesn't mean that the concept should be thrown out

Why don't you learn what i'm talking about before you comment back with ignorant replies. i never said my method was better than his i simply simplified what he has and said what he is doing is completely unneccassary

Lolol someone doesn't like to be wrong.

Objects of the same orientation or purpose should be classed together, try n learn what the factory concept in java is then come back
Lolol. Do you even know how to make an object? Do you even know what object attributes are? Have you even heard of an object constructor?

Get a brain then come back.

Edited by Mysteryy
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...