Jump to content

Trying to use Paint but the guides scuffed and Ima noob


Elixar

Recommended Posts

Trying to make my first script

  • Looked at lots of post from 2014-2017 on the forum
  • Has basic understanding of java
  • Stolen some scripts to try reverse engineer then gave up because its not THA WAE:gnome:
  • Checked API but couldnt find anything because its my first time working with an api
  • Followed @Explv Paint guide which is seemed to be the most credible but the code won't run

 

Can someone please tell me why i get the error
Error:(23, 9) java: 'catch' without 'try'

 

import org.osbot.rs07.api.model.NPC;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;


@ScriptManifest(
    author = "Elixar",
    name = "F2p King",
    info = "Eats ass",
    version = 1.0,
    logo = "https://i.imgur.com/a4BQ0h2.png")



public class F2pKing2 extends Script {
    BufferedImage background;
    @Override
    public void onStart() {
        {
            background = ImageIO.read(F2pKing2.class.getResourceAsStream("/resources/background.png"));
        }
        catch(IOException e){
            log(e);
        }
    }
    @Override
    public int onLoop(){
                if (getInventory().contains("Fly fishing rod", "Feather")) {
                    NPC spot = getNpcs().closest("Lure");
                }
        return 1000;
    }
    @Override
    public void onExit(){
        this.log ("Shutting Down F2p King");
    }
    @Override
    public void onPaint(Graphics2D g) {
        if(background != null){

            g.drawImage(background, null, x, y);
        }

    }
}

I assume theirs a problem with the 'Catch" method or whatever it is,

Is their a library I'm missing that contains this code?

Do i need some kind of java Import?

Is catch Deprecated?!

Link to comment
Share on other sites

  • Alek locked this topic
Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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