powbot / issues

1 stars 0 forks source link

[BUG] Object doesn't return name or actions #237

Open BBpowbot opened 1 year ago

BBpowbot commented 1 year ago

Describe the bug This particular object does not return a name or any action. It does return valid and the correct tile.

To Reproduce/Line of code causing issue

val obj = Objects.stream().at(objTile).first()
                script.log.info("obj valid: ${obj.valid()}")
                script.log.info("obj name: ${obj.name()}")
                script.log.info("obj id: ${obj.id()}")
                script.log.info("obj tile: ${obj.tile()}")
                script.log.info("obj actions: ${obj.actions()}")
                script.log.info("obj action 1: ${obj.actions()[0]}")

[INFO] obj valid: true [INFO] obj name: [INFO] obj id: 10627 [INFO] obj tile: Tile(x=2658, y=3488, floor=0, localX=34, localY=32) [INFO] obj actions: [, , , , ]

Expected behavior .name() should return "Crate", and .actions() a list of the actions.

Screenshots https://ibb.co/H41VKRr

BBpowbot commented 1 year ago

Same problem with a crate at Tile(3498, 3507, 0)

BBpowbot commented 1 year ago

And also with a drawer at Tile(2921, 3577, 0)

BBpowbot commented 1 year ago

And Tile(2565, 3248, 0).

Using the code below "solves" the issue, just not as nice as getting .actions() from the object itself.

if(objTile.matrix().click() && Condition.wait { Menu.opened() }) {
       val commands = Menu.commands().map { it.action }
       script.log.info("Menus: $commands")
       var command: String? = null
       if(commands.contains("Open")) { command = "Open" }
       if(commands.contains("Search")) { command = "Search" }
       if (Menu.click { it.action == command }) {
              Condition.wait { Chat.chatting() }
       }
}