Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Keeps lighting logs while im already lighting

Featured Replies

hi ive been trying to work on my first script, which just checks for logs on the ground and lights them. however the problem is that when the script starts to light a fire and the animation comes on, the loop keeps repeating itself over and over without stopping so it keeps lighting the same log over and over before it has time to even light. i know there is something to do with player animations but im new to java so im a bit stuck. (dont mind the sleep times)

source - 

package org.Hello.Sebby;

import org.osbot.rs07.api.model.GroundItem;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;




import java.awt.*;

@ScriptManifest(name = "Skeleton", logo ="", info ="Script Info", version = 0.1, author ="08egans")
public class skeleton extends Script{

    public void onStart(){
        log("Our Script has started");

    }

    public int onLoop() throws InterruptedException {

        GroundItem item =   getGroundItems().closest("Logs");
        if(!myPlayer().isAnimating()) {
            item.interact("Light");
            sleep(random(2000, 3000));

        }

        return random(2000, 1800);
    }
    public void onExit(){
        log("Script has stopped");
    }
    public void onPaint(Graphics g){

    }
    public void onMessage(String s){
        log("on Message: " + s);
    }
}

the firemaking animation is weird,it stops animating regularly (when you stand up it actually stops the animation before starting again meaning !myPlayer().isAnimating() will think its not animating, unlike during fishing/wc where it doesn't stop the animation), its not the best way to check, honestly I would try something simpler as your first script

add an else, so when it does see it has an animation, it will go back to sleep for x time, is what id do although never looked into firemaking

 

First off I would really recommend looking up a tutorial and trying to work on it using state based logic.

 

But anyways, given your current code with the intention of trying to do what you want to do,

 

I would just keep track of your xp gains. If you haven't gained exp since the last time you tried to light a log, then presumably you're not done burning that log yet, so don't try to light another one.

  • Author

thanks for the replies guys! I was originally going to do state coding but it seemed a bit advanced for my level ive only been trying to teach my self Java for a few days now. Thanks for the idea for tracking the xp gains, wouldn't have thought of that i'll try it now! :)

if (myPlayer().isAnimating()) { //if we are animating
                *LONG VARIABLE TO STORE THE TIME* = System.currentTimeMillis(); //Grabs the time

} else if (System.currentTimeMillis() > (*THE VARIABLE U CREATED* + 5000)) { //If we are not animating, and 5 seconds has passed without us animating, then do stuff.

//Do your stuff here such as lighting the log

};

 

Reference -> 

 

Edited by Viston

  • Author
4 hours ago, Viston said:

if (myPlayer().isAnimating()) { //if we are animating
                *LONG VARIABLE TO STORE THE TIME* = System.currentTimeMillis(); //Grabs the time

} else if (System.currentTimeMillis() > (*THE VARIABLE U CREATED* + 5000)) { //If we are not animating, and 5 seconds has passed without us animating, then do stuff.

//Do your stuff here such as lighting the log

};

 

Reference -> 

Thank you for the help! :)

 

Create an account or sign in to comment

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.