Rawrstin Posted May 20, 2016 Share Posted May 20, 2016 (edited) Hey again y'all, Update: would this work properly? public void onMessage(String message) throws InterruptedException { if (message.contains("Oh dear,")) { dead = true; } } I'm still new to understanding the API easily, so sorry for the beginner question.. Thanks in advance! Edited May 20, 2016 by Rawrstin Quote Link to comment Share on other sites More sharing options...
Solution Posted May 20, 2016 Share Posted May 20, 2016 You use a message listener, look for a game message with that text and then write the code in the onMessage() method. http://osbot.org/api/org/osbot/rs07/listener/MessageListener.htmlhttp://osbot.org/api/org/osbot/rs07/api/ui/Message.MessageType.htmlhttp://osbot.org/api/org/osbot/rs07/api/ui/Message.htmlThose should help out enough.I've always been a fan of people figuring things out for themselves, but if you require more help be sure to reply Quote Link to comment Share on other sites More sharing options...
Qubit Posted May 20, 2016 Share Posted May 20, 2016 (edited) Hey again y'all, Quick question in regards to detecting the chatbox spitting back the game message displayed on death.. Ex: *I DIED* game says "Oh dear, you are dead!" *I CRY* I'm still new to understanding the API easily, so sorry for the beginner question.. Thanks in advance! Oh.. nvm , you'll be wanting to use onMesage.. There is some snippets lying around the forums Edited May 20, 2016 by Qubit Quote Link to comment Share on other sites More sharing options...
Rawrstin Posted May 20, 2016 Author Share Posted May 20, 2016 (edited) Updated OP Like this? // Suicide Mode if (getChatbox().getMessages(null).contains("Oh dear,")) { } Edited May 20, 2016 by Rawrstin Quote Link to comment Share on other sites More sharing options...
Chris Posted May 20, 2016 Share Posted May 20, 2016 implement messagelistener then check for your inventory items if it contains your last saved equipment using getInventory() && using getEquipment() methods Quote Link to comment Share on other sites More sharing options...
Rawrstin Posted May 20, 2016 Author Share Posted May 20, 2016 Hey again y'all, Update: would this work properly? public void onMessage(String message) throws InterruptedException { if (message.contains("Oh dear,")) { dead = true; } } I'm still new to understanding the API easily, so sorry for the beginner question.. Thanks in advance! I have updated the OP Post code.. I think that should work.. testing now! (Could still use help, lol) Quote Link to comment Share on other sites More sharing options...
FrostBug Posted May 20, 2016 Share Posted May 20, 2016 (edited) I have updated the OP Post code.. I think that should work.. testing now! (Could still use help, lol) The onMessage method takes a Message argument, not String Example: public void onMessage(Message msg) throws InterruptedException { if (msg.getType() == MessageType.GAME && msg.getMessage().contains("Oh dear,")) { dead = true; } } Edited May 20, 2016 by FrostBug 1 Quote Link to comment Share on other sites More sharing options...
Rawrstin Posted May 20, 2016 Author Share Posted May 20, 2016 The onMessage method takes a Message argument, not String Example: public void onMessage(Message msg) throws InterruptedException { if (msg.getType() == MessageType.GAME && msg.getMessage().contains("Oh dear,")) { dead = true; } } o.o Thank you! Quote Link to comment Share on other sites More sharing options...