Jump to content

self running script


kingb00zer

Recommended Posts

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

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

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...