Supercharger Posted October 20, 2014 Share Posted October 20, 2014 public void onMessage(Message m) { @SuppressWarnings("unused") NPC FishingSpot = npcs.closest(FISHING_SPOT); if (m.getType() == MessageType.GAME) { String c = m.getMessage().toLowerCase(); try { if (c.contains("you catch a salmon.") || (c.contains("you catch a trout."))) { fishCaught++; } else if (c.contains("i can't reach that!") || (c.contains("I can't reach that!"))) { state = "Can't Reach Object - Report to Supercharger..."; failed++; FishingSpot = null; } } catch (Exception e) { e.printStackTrace(); } } } So my OnMessage is working all correctly theres just one problem, If there is already that case in the chatbox even if the script hasn't started fishing yet it will still say that x amount have been caught. I know it's not a major issue but having false proggies is not something I want. Any suggests? cheers. Link to comment Share on other sites More sharing options...
FrostBug Posted October 23, 2014 Share Posted October 23, 2014 try using getTime() on the message object, and subtract from current time (System.currentTimeMillis()), if its been more than like.. 1000 ms, then ignore it? Link to comment Share on other sites More sharing options...