home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2005 November
/
CDVD1105.ISO
/
Util
/
Winamp
/
Skins
/
Anime_Shogo.wal
/
scripts
/
sonique2_timer.m
< prev
next >
Wrap
Text File
|
2003-02-19
|
2KB
|
76 lines
// *****************************
// ** Sonique2-styled timer **
// *****************************
// coded by spleen (spleen@net.hr)
// with assistance from ThePlague and Gonzotek
// modified by FrisbeeMonkey for greater flexibility
// (rather than shanghai the SongTicker, now requires
// a new Text Object)
#include </lib/std.mi>
Function String specialTimer(int CurPos);
Global Timer tmrWait;
Global Text txtTimer;
Global Boolean MinusIsOn;
System.onScriptLoaded() {
Group mainnormal = getContainer("Main").getLayout("Normal");
txtTimer = mainnormal.findObject("s2timer");
tmrWait = new Timer;
tmrWait.setDelay(20);
MinusIsOn = getPrivateInt("Settings","Minus",0);
if (System.getStatus()==1) tmrWait.start();
}
System.onScriptUnloading() {
tmrWait.stop();
delete tmrWait;
}
System.onPlay() {
tmrWait.start();
}
System.onStop() {
tmrWait.stop();
txtTimer.setText("");
}
tmrWait.onTimer() {
if (MinusIsOn) txtTimer.setText(specialTimer(getPlayItemLength()-getPosition()));
else txtTimer.setText(specialTimer(getPosition()));
}
txtTimer.onLeftButtonDown(int x, int y) {
if (MinusIsOn) MinusIsOn=0;
else MinusIsOn=1;
setPrivateInt("Settings","Minus",MinusIsOn);
}
String specialTimer(int CurPos) {
String SpecTmr = integerToLongTime(CurPos) + ".";
String Temp = integerToString(CurPos);
int TempLen = strlen(Temp);
if (strlen(SpecTmr)==8) SpecTmr = "0" + SpecTmr;
if (TempLen>=3) {
Temp = strmid(Temp,TempLen-3,2);
SpecTmr = SpecTmr + Temp;
} else
if (TempLen==2) {
Temp = strmid(Temp,0,1);
SpecTmr = SpecTmr + "0" + Temp;
} else
SpecTmr = SpecTmr + "00";
if (MinusIsOn) SpecTmr = "-" + SpecTmr;
else SpecTmr = " " + SpecTmr;
return SpecTmr;
}