Jump to content

Need help with object list


blokus

Recommended Posts

Hey there, I've been trying to learn how to organize object lists, desperately need help with this.

When I call List<RS2Object> it returns a whole page of hex numbers and id, i'm not sure what to do with it. 

Spoiler

[INFO][Bot #1][06/20 06:03:08 PM]: [org.osbot.rs07.api.model.WallObject@177b570c, org.osbot.rs07.api.model.GroundDecoration@19bcab93, org.osbot.rs07.api.model.WallObject@1d833c7c, org.osbot.rs07.api.model.GroundDecoration@5881a1a8, org.osbot.rs07.api.model.WallObject@158f4e83, org.osbot.rs07.api.model.GroundDecoration@69139f92, org.osbot.rs07.api.model.WallObject@6df72e10, org.osbot.rs07.api.model.GroundDecoration@38ae5ee7, org.osbot.rs07.api.model.WallObject@573af427, org.osbot.rs07.api.model.GroundDecoration@22201e5d, org.osbot.rs07.api.model.WallObject@76f323a7, org.osbot.rs07.api.model.WallObject@3ce002f8, org.osbot.rs07.api.model.GroundDecoration@3cfb428f, org.osbot.rs07.api.model.GroundDecoration@1e8b61bb, org.osbot.rs07.api.model.GroundDecoration@710a87d6, org.osbot.rs07.api.model.GroundDecoration@4d41accd, org.osbot.rs07.api.model.GroundDecoration@2b4870d0, org.osbot.rs07.api.model.GroundDecoration@6e0b5abb, org.osbot.rs07.api.model.GroundDecoration@4b9a549b, org.osbot.rs07.api.model.GroundDecoration@bfdaee1, org.osbot.rs07.api.model.GroundDecoration@63db81be, org.osbot.rs07.api.model.GroundDecoration@5731d1fc, org.osbot.rs07.api.model.GroundDecoration@4e16690d, org.osbot.rs07.api.model.GroundDecoration@28fa4c88, org.osbot.rs07.api.model.GroundDecoration@1793ee58, org.osbot.rs07.api.model.GroundDecoration@4ef47367, org.osbot.rs07.api.model.GroundDecoration@335725b5, org.osbot.rs07.api.model.GroundDecoration@4933a15b, org.osbot.rs07.api.model.GroundDecoration@41da670b, org.osbot.rs07.api.model.GroundDecoration@2c584b1c, org.osbot.rs07.api.model.InteractableObject@2628a9af, org.osbot.rs07.api.model.GroundDecoration@72c5fd48, org.osbot.rs07.api.model.InteractableObject@2628a9af, org.osbot.rs07.api.model.GroundDecoration@60b52e24, org.osbot.rs07.api.model.GroundDecoration@edb9985, org.osbot.rs07.api.model.GroundDecoration@6d5d3c20, org.osbot.rs07.api.model.GroundDecoration@302fa37e, org.osbot.rs07.api.model.GroundDecoration

This goes on for quite a lot longer^

What i want: to find all potatoes on screen and make a list of closest to furthest from my character. Also will want to know which tile each is on if possible. Thanks in advance <3

Edited by blokus
Link to comment
Share on other sites

On 6/20/2017 at 3:00 PM, blokus said:

Hey there, I've been trying to learn how to organize object lists, desperately need help with this.

When I call List<RS2Object> it returns a whole page of hex numbers and id, i'm not sure what to do with it. 

  Reveal hidden contents

[INFO][Bot #1][06/20 06:03:08 PM]: [org.osbot.rs07.api.model.WallObject@177b570c, org.osbot.rs07.api.model.GroundDecoration@19bcab93, org.osbot.rs07.api.model.WallObject@1d833c7c, org.osbot.rs07.api.model.GroundDecoration@5881a1a8, org.osbot.rs07.api.model.WallObject@158f4e83, org.osbot.rs07.api.model.GroundDecoration@69139f92, org.osbot.rs07.api.model.WallObject@6df72e10, org.osbot.rs07.api.model.GroundDecoration@38ae5ee7, org.osbot.rs07.api.model.WallObject@573af427, org.osbot.rs07.api.model.GroundDecoration@22201e5d, org.osbot.rs07.api.model.WallObject@76f323a7, org.osbot.rs07.api.model.WallObject@3ce002f8, org.osbot.rs07.api.model.GroundDecoration@3cfb428f, org.osbot.rs07.api.model.GroundDecoration@1e8b61bb, org.osbot.rs07.api.model.GroundDecoration@710a87d6, org.osbot.rs07.api.model.GroundDecoration@4d41accd, org.osbot.rs07.api.model.GroundDecoration@2b4870d0, org.osbot.rs07.api.model.GroundDecoration@6e0b5abb, org.osbot.rs07.api.model.GroundDecoration@4b9a549b, org.osbot.rs07.api.model.GroundDecoration@bfdaee1, org.osbot.rs07.api.model.GroundDecoration@63db81be, org.osbot.rs07.api.model.GroundDecoration@5731d1fc, org.osbot.rs07.api.model.GroundDecoration@4e16690d, org.osbot.rs07.api.model.GroundDecoration@28fa4c88, org.osbot.rs07.api.model.GroundDecoration@1793ee58, org.osbot.rs07.api.model.GroundDecoration@4ef47367, org.osbot.rs07.api.model.GroundDecoration@335725b5, org.osbot.rs07.api.model.GroundDecoration@4933a15b, org.osbot.rs07.api.model.GroundDecoration@41da670b, org.osbot.rs07.api.model.GroundDecoration@2c584b1c, org.osbot.rs07.api.model.InteractableObject@2628a9af, org.osbot.rs07.api.model.GroundDecoration@72c5fd48, org.osbot.rs07.api.model.InteractableObject@2628a9af, org.osbot.rs07.api.model.GroundDecoration@60b52e24, org.osbot.rs07.api.model.GroundDecoration@edb9985, org.osbot.rs07.api.model.GroundDecoration@6d5d3c20, org.osbot.rs07.api.model.GroundDecoration@302fa37e, org.osbot.rs07.api.model.GroundDecoration

This goes on for quite a lot longer^

What i want: to find all potatoes on screen and make a list of closest to furthest from my character. Also will want to know which tile each is on if possible. Thanks in advance <3

You do know about the closest function already?

RS2Object potato = objects.closest("Potato");

As for the list, you would want to use a filter to filter all rs2objects like so:

List<RS2Object> potatoes = objects.filter(t -> t != null && t.getName().equals("Potato") && t.hasAction("Pick")); 
//hasAction is redundant but it might fix problems if there were fake potatoes you couldn't pick.

for (RS2Object potato : potatoes) {
    //spit out some individual potato positions
    log(potato.getPosition());
}

From here you could find out which tile each potato is on.

Good luck!

  • Like 2
Link to comment
Share on other sites

46 minutes ago, Hayase said:

You do know about the closest function already?


RS2Object potato = objects.closest("Potato");

As for the list, you would want to use a filter to filter all rs2objects like so:


List<RS2Object> potatoes = objects.filter(t -> t != null && t.getName().equals("Potato") && t.hasAction("Pick")); 
//hasAction is redundant but it might fix problems if there were fake potatoes you couldn't pick.

for (RS2Object potato : potatoes) {
    //spit out some individual potato positions
    log(potato.getPosition());
}

From here you could find out which tile each potato is on.

Good luck!

You're beautiful :) ya i've been playing with objects.closest for a few days now, this time I'm trying to randomize things a bit and gain better control over my script.

 

Can you explain the t -> t!= null? All i have is c,c++ experience. I've noticed in paint it's 'g ->', how do you know, and what does it mean? 

Edited by blokus
Link to comment
Share on other sites

58 minutes ago, blokus said:

You're beautiful :) ya i've been playing with objects.closest for a few days now, this time I'm trying to randomize things a bit and gain better control over my script.

 

Can you explain the t -> t!= null? All i have is c,c++ experience. I've noticed in paint it's 'g ->', how do you know, and what does it mean? 

It's just syntax you can use whatever name you want there.

https://www.mkyong.com/java8/java-8-streams-filter-examples/

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