Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Trigger events without Crontab

    Hi, I am trying to create a turn-based Web-based MMO. The hosting I currently have does not allow for the use of a Crontab, and so my question is:
    Is there any way to trigger events hourly, daily, monthly etc. without a Crontab?

    More specifically, is there any way to trigger the next turn after a period of time without the use of a crontab?

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    You could just create a page to do it and have a <meta> tag refresh the page after a certain amount of seconds, though it will mean you must have your computer on constantly.

    Another way you could do it is to store time() in a database for each user and calculate the points as they come on, e.g.:

    PHP Code:
    <?php
    $time 
    ''// get time for database
    $now time();
    $spp 60// seconds per point

    $points = ($now $time) / $spp;
    ?>
    Last edited by Mwnciau; 01-23-2007 at 04:05 PM.

  • #3
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well what I need it to do, is trigger a script to update all users at once, and add turns, finish tasks, begin tasks, etc.

    Also, I will need a longer term one, say two weeks to clear things and reset a map and certain locations.

  • #4
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could do it like vBulletin, have a cron.php script which checks if an event has passed (record the time last executed, etc.) and execute when someone loads a page and it's past or at time.. If something needs to be executed, execute it. Perhaps use exec() to background a php process or similar which runs another script.
    "$question = ( to() ) ? be() : ~be();"

  • #5
    New to the CF scene
    Join Date
    Jan 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The problem with that is I need this to happen on its own after a certain amount of time.

  • #6
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    I think without Crontab your only hope is to use tricks like the one vBulletin mentions.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •