Spork Posted January 3, 2017 Share Posted January 3, 2017 I can't figure out how to send a message ingame, I can figure out how to send key events to the bot but I don't think splitting strings to char arrays and for looping through them to send messages is very efficient lol. Is there a better way? I can't find one in the API and have thoroughly googled. Quote Link to comment Share on other sites More sharing options...
Muffins Posted January 3, 2017 Share Posted January 3, 2017 (edited) http://osbot.org/api/org/osbot/rs07/input/keyboard/TypeStringEvent.html http://osbot.org/api/org/osbot/rs07/api/Keyboard.html#typeString-java.lang.String- ? you obviously didnt look very hard or at all Edited January 3, 2017 by Muffins 4 Quote Link to comment Share on other sites More sharing options...
Spork Posted January 3, 2017 Author Share Posted January 3, 2017 Shit lol I keep asking dumb questions Sorry, and thanks. Quote Link to comment Share on other sites More sharing options...
Spork Posted January 3, 2017 Author Share Posted January 3, 2017 http://osbot.org/api/org/osbot/rs07/input/keyboard/TypeStringEvent.html http://osbot.org/api/org/osbot/rs07/api/Keyboard.html#typeString-java.lang.String- ? you obviously didnt look very hard or at all Edit: messages = (ArrayList<String>) getChatbox().getMessages(MessageType.PLAYER); String message; if(messages.size() > 0) { message = messages.get(messages.size() - 1); } else { message = ""; } This code works when the bot loads, but after the chatbox updates with a new public message it crashes with an indexOutOfBounds exception: -1 @line 45 After researching this it seems others have this issue and it might have been a game update that broke this function? Quote Link to comment Share on other sites More sharing options...
Team Cape Posted January 4, 2017 Share Posted January 4, 2017 Edit: messages = (ArrayList<String>) getChatbox().getMessages(MessageType.PLAYER); String message; if(messages.size() > 0) { message = messages.get(messages.size() - 1); } else { message = ""; } This code works when the bot loads, but after the chatbox updates with a new public message it crashes with an indexOutOfBounds exception: -1 @line 45After researching this it seems others have this issue and it might have been a game update that broke this function? Don't cast it like that. Just use the array. Quote Link to comment Share on other sites More sharing options...
Spork Posted January 4, 2017 Author Share Posted January 4, 2017 (edited) Don't cast it like that. Just use the array. Eclipse throws an error when I don't cast ArrayList<String> for some reason. I think I'll clean and rebuild my project and see if that resolves. Edit: Clean > Rebuild resolved the issue. Edited January 4, 2017 by Spork Quote Link to comment Share on other sites More sharing options...