java - Generate a random interger within a case: in a Loop() -
i have functioning script game, uses java client.
i trying generate random number upon loop each time case: comes up.
public int onloop() throws interruptedexception { switch (getstate()) { case attack: entity seagull = npcs.closest("seagull"); if(seagull.exists()) { seagull.interact("attack"); sleep(random(1500, 2000)); } break; case attacking: int decide = random(1, 3); if(myplayer().isanimating()) { getskills().hoverskill(skill.strength); log("checking stats..."); sleep(random(1000, 9000)); }else if(decide == 3) { getmouse().moveoutsidescreen(); sleep(random(5000, 30000)); log("afking"); } break;
here using generate random int:
int decide = random(1, 3);
and trying pull number with:
else if(decide == 3) {
but have had no luck!
function numbers(objid) { var rand_inta = math.floor(math.random()*5); // first number document.getelementbyid(objid).innerhtml=(rand_inta); //print second box }
<span id="numbers"></span><br> <a onclick="numbers('numbers')"> <input type="submit" value="get random number">
Comments
Post a Comment