kingb00zer Posted March 15, 2011 Share Posted March 15, 2011 Hi guys I have been studdying a bit of php over the last year and at the moment am trying to create a little game. now I have no problem writing a script that creates an action and updates a database which is mostly what a game like this is made up of. But for a game like this to work I need to create a script that every so often adds a number to the everyones account to give them "turns" to spend in the game, as well as other automated actions that happen in the game. I just dont know where to start. If somebody could give me a little nudge in the right direction here that would be great. if you would like me to elaborate more please ask. thank you. Link to comment Share on other sites More sharing options...
birbal Posted March 15, 2011 Share Posted March 15, 2011 i am not sure it is that what you need for or not...but there is cron jobs which can be run to do some job in background in certain time. Link to comment Share on other sites More sharing options...
ShadowMage Posted March 15, 2011 Share Posted March 15, 2011 Do you want these events to run only while users are logged in/playing or should they run no matter what?If only while logged in, you can use JavaScript and the setInterval function to send AJAX requests to the server.If they should run no matter what, you have to use cron jobs (or whatever it is your server uses for scheduling tasks) to run a PHP script at a set time/interval. Link to comment Share on other sites More sharing options...
kingb00zer Posted March 16, 2011 Author Share Posted March 16, 2011 I need them to run 24 hrs a day for the duration of the round, which will last for 1 month. so for example every hour and at 10 past, 20 past, 30 past, 40 past and 50 past the hour i want a script to run producing 5 added turns to everyones account. These cron jobs sound like what I need. Link to comment Share on other sites More sharing options...
kingb00zer Posted March 20, 2011 Author Share Posted March 20, 2011 Hey just a quick question about cron jobs. Do I need to have an online server to use them or can I use a program with xamp for the testing stages before it is ready for online hosting? Link to comment Share on other sites More sharing options...
Synook Posted March 20, 2011 Share Posted March 20, 2011 cron is just the Linux task scheduling program - nothing to do with the web. Windows has the Task Scheduler instead if you are using that platform. Link to comment Share on other sites More sharing options...
kingb00zer Posted March 20, 2011 Author Share Posted March 20, 2011 thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.