Home Community Mys-Script Creative Off-Topic |
|
|
Thread Tools | Display Modes |
#21
|
|||
|
|||
Can items be used to increase health or mood?
|
#22
|
||||
|
||||
It's definitely possible, but I've never attempted it so I don't know the code.
__________________
|
#23
|
||||
|
||||
Still need help with scheduled tasks to make the bars go down, since I'm still lost on what to do.
__________________
|
#24
|
||||
|
||||
If your host allows cronjobs, you can just have a page with the tasks you want to perform and set it up through the cpanel ("I want this function from this file to run every day").
All the automatic tasks I've set up are basically like this: PHP Code:
To do it like HoF is saying, you can create a class file for each task you want. For example ResetClicksTask, LowerMoodTask, ... (which can extend a class Task, if you want inheritance) Each task class has a function like executeTask() that does what you want. In this case it would be like PHP Code:
PHP Code:
So when anyone visits the index, the function calls all the tasks that need to run.
__________________
asp.net stole my soul. |
#25
|
||||
|
||||
Thank you! I'll have to try it out right now. I'm using mysidiahost, so it allows cronjobs.
__________________
|
#26
|
||||
|
||||
Okay, so this is what I have in cron.php within the root folder:
PHP Code:
Quote:
__________________
Last edited by Dinocanid; 01-22-2017 at 01:53 PM. |
#27
|
||||
|
||||
I added a section for having the needs to go down every day.
__________________
|
#28
|
||||
|
||||
As a better alternative to my method above, would it be possible to have something like mySQL events? They're said to be able to be an alternative to cronjobs and I have seen options for this in phpMyAdmin, but I've never touched them. I'll try it and see how it works out.
EDIT: Nevermind, you would need super privileges in mySQL to make schedules (basically add permission), which I can't find a way to do.
__________________
Last edited by Dinocanid; 04-19-2017 at 03:59 PM. |
#29
|
||||
|
||||
Just a heads up, if you haven't already done it for another mod et cetera, you'll need to define $adopt in public function manage. Copying it from the function above it seems to be enough.
|
#30
|
||||
|
||||
I can't seem to get the provided method for changing the health to work. It's all set in class_ownedadoptables, although I'm trying to do this outside the manage page.
EDIT: Never mind. I dug through my files and it turned out to be a typo in what I was using to track health. Last edited by KatFennec; 05-03-2017 at 12:34 AM. |
|
|
What's New? |
What's Hot? |
What's Popular? |