Pi_Mastuh Posted August 29, 2006 Share Posted August 29, 2006 I'm making a virtual pet site of sorts. I have the hunger of the pets stored as an integer 1 - 5. I need to make it increase by 1 every 24 hours or so. Then I need to make a list box that drops down with the number of pets the user has, with each one as an option. Then when you click on the pet, it gets rid of the food item associated with the list box and decreases the pet's hunger by 1. I have no idea how to do that though, does anyone know how I could do this? I don't know where to start...Thanks! :D Quote Link to comment Share on other sites More sharing options...
AndyB Posted August 29, 2006 Share Posted August 29, 2006 That's about several hundred questions, so I'll give you a starter on the 'every 24 hours' part. Check you web host server control panel to see if/how a cron task can be run. Cron tasks can be automatically scheduled to run at any recurring time you want. If you are unfortunate enough to be running on a Windoze server, you'll need to look at the scheduler (whatever they call it) for the same functionality. Quote Link to comment Share on other sites More sharing options...
DarkendSoul Posted August 29, 2006 Share Posted August 29, 2006 An alternative methode of doing this would just having it check at the beginning of a show hunger request. Have something like...$var = current time (in seconds) - time last fed (in seconds);$lost_hunger = floor($var/(60*60*24));if ($lost_hunger > $hunger_left) $pet = dead!;then subtract that from the current hunger Quote Link to comment Share on other sites More sharing options...
Pi_Mastuh Posted August 29, 2006 Author Share Posted August 29, 2006 How would i make the list box part? Quote Link to comment Share on other sites More sharing options...
Pi_Mastuh Posted August 29, 2006 Author Share Posted August 29, 2006 I think I've got the rest figured out,just need to figure out the listbox. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.