Author Topic: BBG using PHP + MySql Help? ;D  (Read 5202 times)

Offline Lp9Sc

  • Level 5
  • *
  • Posts: 15
  • Reputation: +1/-0
    • View Profile
Re: BBG using PHP + MySql Help? ;D
« Reply #25 on: November 15, 2007, 01:23:27 PM »
I was gone for a while because there was too many important things in life x.x
I started a course at college and in the second year (next year) we will be doing programming :]

I have made a BBG from scratch now, everything works but not in certain time intervals ;[

I don't understand how to do a cron job
So.. How do I? I checked a tutorial on here somewhere about cron jobs and it said you can find it in control panel, but I looked on my windows xp control panel and I am unable to find it on there =\
Do I need to download it/pay for it? x.x
Do cron jobs require my computer to be dedicated to it (keep my computer on to keep time)
If so I am unable to do cron job, I am unable to keep my computer on unattended (stupid relatives)

I've been thinking of other ways

I could create a session called timer to run on every member page to calculate how much time is left for a function to take place
The function will be adding additional resources etc to the current ones and update mysql and adding some more turns
(about 100 turns every 2 hours)
attacking, mining, exploring etc takes up certain amount of turns
attacking with 10,000 units = 1 turn 10,001 - 20,000 = 2 turns etc
but I do not know if this is possible with only php to run a session timer which stays the same when the user exits the page and enters again...?

I'm puzzled ;[

Edit
Ah nevermind :]
Windows has 'scheduled tasks' instead of cron jobs

But I wont be using it anyway because I'm not too sure at what time of day I'd actually have my computer on to update the cron every 24 hours so I'll just manually  do it roughly around 8pm :]
« Last Edit: November 15, 2007, 02:03:12 PM by Lp9Sc »

Offline beam

  • Level 15
  • *
  • Posts: 132
  • Reputation: +2/-0
  • Dance Commander
    • View Profile
Re: BBG using PHP + MySql Help? ;D
« Reply #26 on: November 15, 2007, 03:16:59 PM »
Before I had a host with cron access, I did had a field in my player table called last_active, and it would be updated every time a player loaded a page with MySQL's time() function. Then, whenever a player would login, I would calculate how many resets I owed the player by taking the difference between the last_active field and PHP's time() function, and then divide that by the number of seconds in a day. The quotient would be how many resets the player missed, and I would do things accordingly.

The only thing that method doesn't help with is doing global things, like reviving all the players and stuff like that.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal