- script TestScript::QuickTest 4_F_03,{
mes "What you want?";
next;
switch(select("Use Charge", "See Charge", "Exit")) {
case 1:
if (.n_now > 0){
.n_now--;
if (.n_now < .n_max) {
setnpctimer 0;
initnpctimer;
npctalk "Starting recharges.";
}
getitem 512, 1;
.cont = .delay;
mes "Current C.: "+.n_now+"/"+.n_max;
mes "Next Charge in "+((.cont)/1000)+"s.";
}
else{
mes "No Charges.";
}
close;
case 2:
mes "Delay per C.: "+.delay/1000+"s";
mes "Current C.: "+.n_now+"/"+.n_max;
mes "Next Charge in "+((.cont)/1000)+"s.";
close;
}
close;
OnTimer4000:
.n_now++;
.cont = .delay;
npctalk "Current C.: "+.n_now+"/"+.n_max;
stopnpctimer;
setnpctimer 0;
if (.n_now >= .n_max)
end;
initnpctimer;
npctalk "Next Charge in "+((.cont)/1000)+"s.";
end;
OnInit:
.n_max = 5; //max charges
.n_now = 5; //actual charge
.delay = 4*1000;//time to recover 1 charge
.cont = 0; //actual time left to recharge
end;
}
prontera,164,170,4 duplicate(QuickTest) Test Quick#prt 4_F_03
Tested.