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.

help on java.util.timer

Featured Replies

I cannot seem to get past this error

first get Error:(38, 5) java: cannot find symbol
  symbol:   class Timer
  location: class Main.GEMaster

 

public class GEMaster extends Script {

    long Timer;
    Area shopArea = new Area(2953, 3205, 2960, 3202);
    Area grandexchangeArea = GRAND_EXCHANGE;
    Area tradingArea = VARROCK_WEST;
    static String Status = "Normal";
    boolean GotTradeOffer;
    Timer logTimer;
    Timer updateTimer;
    int numberofWSB;
    int numberofWLB;
    int numberofMSB;
    int numberofMLB;
    int numberofSA;
    int coinsinbank;

if i use import java.util.Timer;  i get Error:(51, 20) java: no suitable constructor found for Timer(int) 
    constructor java.util.Timer.Timer(boolean) is not applicable
      (argument mismatch; int cannot be converted to boolean)
    constructor java.util.Timer.Timer(java.lang.String) is not applicable
      (argument mismatch; int cannot be converted to java.lang.String)

 

 

so I add 

import java.util.Timer start;

I end up getting  Error:(21, 23) java: ';' expected noob coder buy the way just need a point in the way


 

 

Yes you need:

import java.util.Timer;

Wherever you are instantiating the Timer, you're doing it wrong.

Check the Java docs for the Timer class.

And follow some basic Java tutorials.

Also use a proper Java IDE, it will highlight where and what your errors are in your code.

Edited by Explv

  • Author
7 minutes ago, Explv said:

Yes you need:

import java.util.Timer;

Wherever you are instantiating the Timer, you're doing it wrong.

Check the Java docs for the Timer class.

And follow some basic Java tutorials.

Also use a proper Java IDE, it will highlight where and what your errors are in your code.

thank you and all the error is in this part

 

@Override

public void onStart() throws InterruptedException {

    logTimer = new Timer(0);
    updateTimer = new Timer(0);

    Timer = System.currentTimeMillis();

    try {
        File file = new File(getDirectoryData()+"info.txt");

        if(!file.exists()) {
            file.createNewFile();
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}


@Override

public int onLoop() throws InterruptedException {

    if(logTimer.Passed(1)){
        log("Current money stock " + (int) inventory.getAmount("Coins"));
        log("Current money stock in bank " + coinsinbank);
        logTimer.reset();
    }
    if(updateTimer.Passed(30)){
        Update();
        updateTimer.reset();
        sleep(random(2000,3000));
    }

    if(Status == "Normal") {
        if (!GotTradeOffer) {
            if (tabs.open(Tab.INVENTORY) && !trade.isFirstInterfaceOpen()) {
                if (inventory.contains("Willow longbow") && inventory.contains("Willow shortbow") && inventory.contains("Maple shortbow") && inventory.contains("Maple longbow")) {
                    GoToShop();
                }
                if (!inventory.contains("Willow longbow") || !inventory.contains("Willow shortbow") || !inventory.contains("Maple shortbow") || !inventory.contains("Maple longbow")) {
                    GoToGe();
                }
            }
        } else if (GotTradeOffer) {
            Trade();
        }
    }else if (Status == "Muling"){
        WalktoTrade();
    }

    return 100;
}

 

 

1 minute ago, markdmp said:

thank you and all the error is in this part

 


@Override

public void onStart() throws InterruptedException {

    logTimer = new Timer(0);
    updateTimer = new Timer(0);

    Timer = System.currentTimeMillis();

    try {
        File file = new File(getDirectoryData()+"info.txt");

        if(!file.exists()) {
            file.createNewFile();
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}


@Override

public int onLoop() throws InterruptedException {

    if(logTimer.Passed(1)){
        log("Current money stock " + (int) inventory.getAmount("Coins"));
        log("Current money stock in bank " + coinsinbank);
        logTimer.reset();
    }
    if(updateTimer.Passed(30)){
        Update();
        updateTimer.reset();
        sleep(random(2000,3000));
    }

    if(Status == "Normal") {
        if (!GotTradeOffer) {
            if (tabs.open(Tab.INVENTORY) && !trade.isFirstInterfaceOpen()) {
                if (inventory.contains("Willow longbow") && inventory.contains("Willow shortbow") && inventory.contains("Maple shortbow") && inventory.contains("Maple longbow")) {
                    GoToShop();
                }
                if (!inventory.contains("Willow longbow") || !inventory.contains("Willow shortbow") || !inventory.contains("Maple shortbow") || !inventory.contains("Maple longbow")) {
                    GoToGe();
                }
            }
        } else if (GotTradeOffer) {
            Trade();
        }
    }else if (Status == "Muling"){
        WalktoTrade();
    }

    return 100;
}

 

 

 

Ok well apparently I *still* have to do this for you...

If you look at the docs for Timer:

https://docs.oracle.com/javase/8/docs/api/java/util/Timer.html

You will see there is no constructor that takes a number as the parameter.

There is an empty constructor though.

So just change new Timer(0) to new Timer()

..............

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.