Jump to content

Running Local Scripts


Jar

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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 :).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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