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.

How to fill correct values for int[][]?

Featured Replies

I've been making a smithing bot and I've struggled with int arrays when it comes to setting the location of the furnace. 

I have this in my main class:

public static int[][] furnacePlace;
private Area furnaceArea = new Area(furnacePlace);

However, in the gui class I'm struggling to get it to take all 4 int values.

if (location.equals("Port Phasmatys")) {
    KaliRings.furnacePlace[][] = { x, y, x ,y}
}

I am getting an error on the x and y values. Am I writing it wrong? or can someone explain the use of int arrays a little better to me please? Thanks. 

Edited by Kalispel

I suppose you could read this:

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

 

but it should be:

if (location.equals("Port Phasmatys")) {
    KaliRings.furnacePlace[][] = {x,x}, {y,y}
}

To get them out of there:

//This will get the first x and y
Position pos = new Position(KaliRings.furnace[0], KaliRings.furnace[0]);
//this will get the second x and y
Position pos = new Position(KaliRings.furnace[1], KaliRings.furnace[1]);

Edited by Vilius

I've been making a smithing bot and I've struggled with int arrays when it comes to setting the location of the furnace. 

I have this in my main class:

public static int[][] furnacePlace;
private Area furnaceArea = new Area(furnacePlace);

However, in the gui class I'm struggling to get it to take all 4 int values.

if (location.equals("Port Phasmatys")) {
    KaliRings.furnacePlace[][] = { x, y, x ,y}
}

I am getting an error on the x and y values. Am I writing it wrong? or can someone explain the use of int arrays a little better to me please? Thanks. 

Well... I guess you got an error in the second part of the code. But anyway in order to construct an Area you need the southwest corner and northeast corner x and y coordinates. I don't really understand why you need to use matrices when you need 2 positions.

The most logical thing to do is get the furnace Position (as a 3D vector meaning x, y and z) and then you can construct an Area relative to that Position (if you really want an Area).

public static Position furnacePosition = new Position(a, b, c);
// you get a, b, c ingame

public static Area getFurnaceArea() {
    x = furnacePosition.getX();
    y = furnacePosition.getY();
    // define a set of rules to create a custom rectangular area
    // I assume in this case that the furnace is on the eastern wall of a room
    // which I believe it is so in Port Phasmantys
    Area furnaceArea = new Area(x - 6, y - 2, x, y + 2);
    // so this Area is supposed to be 6x4 (6 squares in front of furnace including the furnace
    // and 2 on each side)
    return furnaceArea;
}

You don't need int arrays.

Edited by Token

new Area(0,0,0,0).setPlane(0)

Op btw you are trying to make a 2d array that's why your messing up

Example got from link above

String[][] names = {

{"Mr. ", "Mrs. ", "Ms. "},

{"Smith", "Jones"}

};

// Mr. Smith

System.out.println(names[0][0] + names[1][0]);

// Ms. Jones

System.out.println(names[0][2] + names[1][1]);

Edited by Joseph

if (location.equals("Port Phasmatys")) {
    KaliRings.furnacePlace[][] = { x, y, x ,y}
}

 

This is a 1D array, not a 2D. 2D would look like:

if (location.equals("Port Phasmatys")){ KaliRings.furnacePlace[][] = {x,y},{x,y} }
  • Author

 

I suppose you could read this:

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html

 

but it should be:

if (location.equals("Port Phasmatys")) {
    KaliRings.furnacePlace[][] = {x,x}, {y,y}
}

To get them out of there:

//This will get the first x and y
Position pos = new Position(KaliRings.furnace[0], KaliRings.furnace[0]);
//this will get the second x and y
Position pos = new Position(KaliRings.furnace[1], KaliRings.furnace[1]);

 

Thanks

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.