OSRSB / OsrsBot

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

[BUG] Trading players with names that contain space #318

Closed willkopec closed 1 year ago

willkopec commented 1 year ago

Hello. I am working on a script that involves trading players but when I use trade.tradePlayer() function with a name that has a space in it, the script just hovers over the player with the mouse but does not right click or trade the player. I have tried an alternative such as RSPlayer.doAction("Trade with") but the same thing occurs. Not sure why this is the case but I can't figure out a solution.

GigiaJ commented 1 year ago

Check if undoing changes in #285 help first if you don't mind

willkopec commented 1 year ago

Check if undoing changes in #285 help first if you don't mind

Hey I found a fix for this issue. When a target name has a space in it, the space ends up turning into a special character. In order to fix this, you need to go to Menu.java and change targets[i] = entries[i].getTarget().replaceAll("<.?>", " "); TO targets[i] = entries[i].getTarget().replaceAll("<.?>", " ").replaceAll("\W", " ");

So far I have noticed this for character target names, not sure if it is the same for NPC's. I will request a change to it now.

willkopec commented 1 year ago

I realized I cannot request a change, someone who can edit the repo must do it.

GigiaJ commented 1 year ago

You are welcome to make PRs as well, or this can be added by someone else.

willkopec commented 1 year ago

You are welcome to make PRs as well, or this can be added by someone else.

Done. Thanks, I will now close this issue.