OSRSB / OsrsBot

A RuneLite bot automation extension API for Old School RuneScape
https://discord.gg/CGBXNrHREP
GNU General Public License v3.0
137 stars 72 forks source link

Interaction and api updates #301

Closed Nubebuster closed 1 year ago

Nubebuster commented 1 year ago

This branch contains some bug fixes and code improvements. Most notable changes:

Bugs found

See Inventory.java:175 the condition is always true. Author: @Fire-Swan See RSModel.java:343 this loop always returns with n=0. Author(s): @PhobicHD and/or @GigiaJ

Nubebuster commented 1 year ago

https://chat.openai.com/share/633e2b6f-6e7b-43e7-8a8a-7fbe47c0aa4b

ChatGPT helped me understand that the first bug is not a big deal.

The second bug also seems like a minor issue fixed. Please confirm the new behaviour is the intended behaviour @PhobicHD @GigiaJ

Nubebuster commented 1 year ago

In commit cd751f6 I only did formatting. In all the commits I did formatting. Most notably I made sure to make the spaces/tabs consistent. The project mainly uses tabs and so should everyone contributing therefore.

This is going to be a bit of a mess while merging with the other pull requests. I recommend to merge the other requests first, and then resolve the conflicts in IntelliJ when merging.

If I can help with resolving conflicts at some point I would love to.

Nubebuster commented 1 year ago

Now we use the clickbox of the TileObject and try to get the middle of that if it exists. If that is not on screen or it does not exist, the old system is used. The old system tries to get a center polygon of the model on screen. If that also fails, the new system is used which tries to get a random polygon on the screen. The latter does not look specifically for a center and may therefore hit a polygon which is on screen while the middle of the model is not on screen.

Combining these three methods creates a very high success rate for many shapes. I also changed the click to allow a user to specify how many tries the mouse makes to move onto the object. The default is set from 2 (which was not in a loop) to 3 as a loop.