Bloodycub Posted August 24, 2016 Share Posted August 24, 2016 This is code http://pastebin.com/mRq0sijBProblem is that it spamms if it sees Hi AND HAVE NO IDEA how to fix it!? Quote Link to comment Share on other sites More sharing options...
Team Cape Posted August 24, 2016 Share Posted August 24, 2016 This is code http://pastebin.com/mRq0sijB Problem is that it spamms if it sees Hi AND HAVE NO IDEA how to fix it!? maybe try giving it a timer and check if it's the last thing said in the chatbox messages instead of just contained by the chatbox messages? it's just going to loop repeatedly if you leave it as it is because the condition is continuously met - it's going to continue saying 'hellow' until there's no 'hi' in the chatbox Quote Link to comment Share on other sites More sharing options...
Bloodycub Posted August 24, 2016 Author Share Posted August 24, 2016 maybe try giving it a timer and check if it's the last thing said in the chatbox messages instead of just contained by the chatbox messages? it's just going to loop repeatedly if you leave it as it is because the condition is continuously met - it's going to continue saying 'hellow' until there's no 'hi' in the chatbox if i understand coreccly onMessage should have that timer implemented? Quote Link to comment Share on other sites More sharing options...
Tom Posted August 24, 2016 Share Posted August 24, 2016 (edited) Just check what the latest message was, you don't need the chatbox api. m.getMessage() i think it would be, or something similar. What you are doing is checking the entire chatbox every time someone sends a message, which of course it contains the same thing that was said before. Also, String#contains is case sensetive, so this would only work if it was a capital H, you should change it to m.getMessage().toLowerCase().contains("hi") Edited August 24, 2016 by Tom Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted August 24, 2016 Share Posted August 24, 2016 The onMessage method gets triggered when a new message gets added to the chatbox. There is no point in looping over the chatbox and all that... Example for logs chopped: public void onMessage(Message message) { if (message.getMessage().contains("You get some")) logCount++; } Enjoy! Quote Link to comment Share on other sites More sharing options...
Tom Posted August 24, 2016 Share Posted August 24, 2016 The onMessage method gets triggered when a new message gets added to the chatbox. There is no point in looping over the chatbox and all that... Example for logs chopped: public void onMessage(Message message) { if (message.getMessage().contains("You get some")) logCount++; } Enjoy! tryin steal my thunder br0? Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted August 24, 2016 Share Posted August 24, 2016 tryin steal my thunder br0? Oh? I didn't even try ... 3 Quote Link to comment Share on other sites More sharing options...
Bloodycub Posted August 24, 2016 Author Share Posted August 24, 2016 Just check what the latest message was, you don't need the chatbox api. m.getMessage() i think it would be, or something similar. What you are doing is checking the entire chatbox every time someone sends a message, which of course it contains the same thing that was said before. Also, String#contains is case sensetive, so this would only work if it was a capital H, you should change it to m.getMessage().toLowerCase().contains("hi") But runescape Automaticly canges hi to Hi The onMessage method gets triggered when a new message gets added to the chatbox. There is no point in looping over the chatbox and all that... Example for logs chopped: public void onMessage(Message message) { if (message.getMessage().contains("You get some")) logCount++; } Enjoy! Will test later when have time but thanks for in front 1 Quote Link to comment Share on other sites More sharing options...
Tom Posted August 24, 2016 Share Posted August 24, 2016 But runescape Automaticly canges hi to Hi Will test later when have time but thanks for in front Not if its mid sentence, you are checking 'contains' after all. If you wanted to check the start of the sentence, use startsWith i believe. The solution i provided will work none the less, it converts the message received to lower case afterwards so runescape wont fuck around with it Quote Link to comment Share on other sites More sharing options...