May 20, 20169 yr 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, 20169 yr by Rawrstin
May 20, 20169 yr 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
May 20, 20169 yr 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, 20169 yr by Qubit
May 20, 20169 yr Author Updated OP Like this? // Suicide Mode if (getChatbox().getMessages(null).contains("Oh dear,")) { } Edited May 20, 20169 yr by Rawrstin
May 20, 20169 yr implement messagelistener then check for your inventory items if it contains your last saved equipment using getInventory() && using getEquipment() methods
May 20, 20169 yr Author 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)
May 20, 20169 yr 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, 20169 yr by FrostBug
May 20, 20169 yr Author 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!
Create an account or sign in to comment