// Version 0.01
// Counts Curath blessings Rixx upgrade has happened. You can change it what you want.
// Following texts call functions in client. Those are "consume_amount" and "consume_reset".
SCRIPT_NAME="consumes";
SCRIPT_DESC = "consumesCounterTrig";
SCRIPT_OFF = false;
counter=0;
long startTime = 0;
int MILLISECONDS_IN_A_SECOND = 1000;
int SECONDS_IN_A_MINUTE = 60;
int MINUTES_IN_AN_HOUR = 60;
public String millisToTime(millis) {
// Total seconds from milliseconds
long totalSeconds = millis / MILLISECONDS_IN_A_SECOND;
// Calculate hours
long hours = totalSeconds / (MINUTES_IN_AN_HOUR * SECONDS_IN_A_MINUTE);
// Calculate remaining minutes
long minutes = (totalSeconds % (MINUTES_IN_AN_HOUR * SECONDS_IN_A_MINUTE)) / SECONDS_IN_A_MINUTE;
// Calculate remaining seconds
long seconds = totalSeconds % SECONDS_IN_A_MINUTE;
return hours+" hours, " + minutes + " minutes and " + seconds + " secs.";
}
void bootup(){
startTime = System.currentTimeMillis();
clientGUI.doCommand("/alias consume_amount=$consumes.showAmount");
clientGUI.doCommand("/alias consume_reset=$consumes.reset");
triggerManager.newTrigger("consumesCounterTrig",
"^Your rixx-tec consumes the life-force of",
"$"+SCRIPT_NAME+".add");
}
void add() {
long nowTime = System.currentTimeMillis();
long diffTime = nowTime-startTime;
counter=counter+1;
clientGUI.printText("general", "Consumes has happed "+counter+" times in "+millisToTime(diffTime)+" \n", "64b2c6");
}
void reset(){
counter=0;
startTime = System.currentTimeMillis();
clientGUI.printText("general", "Consumes has been reseted. "+counter+" times \n", "64b2c6");
}
void showAmount(){
long nowTime = System.currentTimeMillis();
long diffTime = nowTime-startTime;
clientGUI.printText("general", "Consumes has been done since reset "+counter+" times in "+millisToTime(diffTime)+" \n", "64b2c6");
}