Banker 175 Posted October 12, 2016 Okay so im working on a script that involves a spammer (as you can already tell from the code below), I'm trying to have it where i can stop/start the spamming at any point. When i try have the wait (return wait;) between messages the final part of the for loop code is reporting as unused, when i remove the return statement it is 'used' again and the warning disappears. Code: for(x = 0; x<messages.size(); x++) { getKeyboard().type(messages.get(x)); //return wait; } Note: messages is an ArrayList<String> && the variable 'x' is created at the top of the code. public int x = 0; This is so i can perform checks on the positioning of the bot, outside of the loops. Thanks.
Pandemic 2852 Posted October 12, 2016 What's the point of the loop if you just return out of it the first time it's called?
Banker 175 Author Posted October 12, 2016 What's the point of the loop if you just return out of it the first time it's called? shit, that would be the issue then, would sleep(wait); be more appropriate in having time between each message. Was pretty tired when i wrote it so mustve used return my mistake and not realised
Stormscythe 263 Posted October 13, 2016 shit, that would be the issue then, would sleep(wait); be more appropriate in having time between each message. Was pretty tired when i wrote it so mustve used return my mistake and not realised Yes, a return breaks the loop and returns the value of the wait variable. If you want the loop to wait a certain amount of seconds before executing again, you should use the sleep function
Recommended Posts
Archived
This topic is now archived and is closed to further replies.