View Full Version : possible built in timer without a loop or stopping the script until the time?

01-11-2012, 09:43 PM
I am wondering if this is possible to do. Lets say i have a certain time ('time()' in php) and at a specific time after (say 5 minutes) I want an action to happen. This is something I am looking to adding to a chat bot script that I am currently working on but I never did before. How could i get the bot to do a certain action repeatedly with separate conditions at the set time. Say a user joins the chat. After being in the chat for 5 minutes, the bot sends the MEMBER command through the chat and members them. Now say 3 users join the chat at 1 minute intervals. Each user would be made member 5 minutes after THEY joined, not the last person. I'm already able to add the ID of the user into an associative array with the ID as the key and the time as the value but the only problem i have is getting the bot to member them at the set time. I don't want the bot to get disabled at all in the process (the users should still be able to use its commands).

Summing that all up, I need a looping script to do certain actions at certain times without the script pausing at all. It's for a chat bot so when the time is hit for the certain user, the action is done.