Jump to content

Running Local Scripts


Recommended Posts

Posted (edited)
33 minutes ago, Aftermath said:

Check the scope of your onloop in the class file or if you're relying on conditional execution that the criteria is being met?

import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;

@ScriptManifest(name = "ScriptTest", author = "Jar", version = 1.0, info = "", logo = "")

public class ScriptTest extends Script {

    @Override

    public void onStart() {

        log("ScriptTest has started!");

    }

    @Override

    public void onExit() {

        log("ScriptTest has ended!");

    }

    @Override

    public int onLoop() {
        log("started loop");

        return 100; //The amount of time in milliseconds before the loop starts over

    }

    @Override

    public void onPaint(Graphics2D g) {

        //This is where you will put your code for paint(s)

    }

}

I wasn't sure if I had to execute onLoop by calling it in onStart, but then every script I've seen doesn't do that, it just simply writes tasks within onLoop & they're executed simultaneously.

 

Edited by Jar
Posted (edited)
1 hour ago, Jar said:

import org.osbot.rs07.api.ui.RS2Widget;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;

@ScriptManifest(name = "ScriptTest", author = "Jar", version = 1.0, info = "", logo = "")

public class ScriptTest extends Script {

    @Override

    public void onStart() {

        log("ScriptTest has started!");

    }

    @Override

    public void onExit() {

        log("ScriptTest has ended!");

    }

    @Override

    public int onLoop() {
        log("started loop");

        return 100; //The amount of time in milliseconds before the loop starts over

    }

    @Override

    public void onPaint(Graphics2D g) {

        //This is where you will put your code for paint(s)

    }

}

I wasn't sure if I had to execute onLoop by calling it in onStart, but then every script I've seen doesn't do that, it just simply writes tasks within onLoop & they're executed simultaneously.

 

 
 

You're correct, no need to execute onLoop through onStart, it handles it by itself.

Are you sure that you're running the correct output file (not sure if you've maybe made changes)? I've run exactly what you posted and it is logging the loop output.

Edited by Aftermath
Posted
13 minutes ago, Aftermath said:

You're correct, no need to execute onLoop through onStart, it handles it by itself.

Are you sure that you're running the correct output file (not sure if you've maybe made changes)? I've run exactly what you posted and it is logging the loop output.

I forgot to refresh my scripts in the selector ?

 

Thanks for your time & help though :).

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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