August 24, 20169 yr This is code http://pastebin.com/mRq0sijBProblem is that it spamms if it sees Hi AND HAVE NO IDEA how to fix it!?
August 24, 20169 yr 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
August 24, 20169 yr Author 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?
August 24, 20169 yr 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, 20169 yr by Tom
August 24, 20169 yr 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!
August 24, 20169 yr 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?
August 24, 20169 yr Author 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
August 24, 20169 yr 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
Create an account or sign in to comment