January 3, 20179 yr 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.
January 3, 20179 yr 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, 20179 yr by Muffins
January 3, 20179 yr Author 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?
January 4, 20179 yr 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.
January 4, 20179 yr Author 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, 20179 yr by Spork
Create an account or sign in to comment