GaetanoH Posted April 30, 2017 Posted April 30, 2017 Is there any way to check if an user is trading you? It's been a while
harrypotter Posted April 30, 2017 Posted April 30, 2017 Pretty sure you can check your messages: https://osbot.org/api/org/osbot/rs07/api/ui/Message.html 1
scape Posted April 30, 2017 Posted April 30, 2017 3 minutes ago, GaetanoH said: Is there any way to check if an user is trading you? It's been a while getTrade().isCurrentlyTrading()
GaetanoH Posted April 30, 2017 Author Posted April 30, 2017 Yeah, getType returns a: receivedTrade. Thank you! Just now, scape said: getTrade().isCurrentlyTrading() That's when you are already trading, I ment getting the trade request
harrypotter Posted April 30, 2017 Posted April 30, 2017 (edited) 2 minutes ago, GaetanoH said: Yeah, getType returns a: receivedTrade. Thank you! That's when you are already trading, I ment getting the trade request If you're trying to check that a certain user send the request, you can parse the game message using the API class I sent in my previous post. Edited April 30, 2017 by harrypotter
scape Posted April 30, 2017 Posted April 30, 2017 18 minutes ago, GaetanoH said: Yeah, getType returns a: receivedTrade. Thank you! That's when you are already trading, I ment getting the trade request I made this to grab the name from messages: public String getNameFromTrade(String s) { String line = ""; for (int i = 0; i < s.length(); i++) { if (s.substring(i, i + 4).contains("wish")) break; else line += s.substring(i, i + 1); } return line; }
naaiz Posted April 30, 2017 Posted April 30, 2017 https://osbot.org/api/org/osbot/rs07/api/Trade.html#getLastRequestingPlayer-- If this returns null you don't have one, I'm pretty sure it only checks for the past 15 seconds or so 1
GaetanoH Posted April 30, 2017 Author Posted April 30, 2017 32 minutes ago, scape said: I made this to grab the name from messages: public String getNameFromTrade(String s) { String line = ""; for (int i = 0; i < s.length(); i++) { if (s.substring(i, i + 4).contains("wish")) break; else line += s.substring(i, i + 1); } return line; } Lol, you can check it from the Message API man, if(msg.getType() == Message.MessageType.RECEIVE_TRADE){ log("TRADING: " + msg.getUsername()); } 1