Training daily?

General Chat, Comments
Post Reply
User avatar
cbsarge
Posts: 195
Joined: Mon Sep 14, 2015 3:20 pm

Training daily?

Post by cbsarge »

On the create training screen is there a way to make it so the training items can be done once each day?
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: Training daily?

Post by KyleMassacre »

By default NO. But can it be done? YES.

This actually gives me an idea for a module, something like a dynamic user variable creator. If I recall, the the conditions and the gains in the trainings are passed through NwEval() which is basically eval() and if you don't know, it allows you to run arbitrary PHP code. But if you did know, then maybe I can describe my idea and you can try to create it yourself.

What you would need to do is create a module that can create user variables and store them on the fly in the database. Something like lastTrainTime_. Now with that created you can create your own function for a requirement like getLastTrainTime(@param1); @param1 can be something like the train id which would come out to: getLastTrainTime(1); which would then be like getUserVariable(lastTrainTime_1); that user variable would store the last time they trained and you use that to check if it they have past the amount of time. You can then create a function to set their train time using the opposite pattern and the get method so when they do train it sets the value that you want and you can set it in the table to be something like time()+86400 or however you wish to update it
Post Reply

Return to “General”