View Single Post
Old 18th December 2002, 01:58   #9
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
thank DH, stuff like that keeps goin...

ok, for the goodbye script. the problem is theres no maki command to close winamp. theres a work around involving setting up a dummy close button button in your xml and having the maki trigger that, but ill go more into that later. heres what i threw together...it works, it just doesnt close after the timer stops, it plays:

code:

//--------------------------------------------
// goodbye.m
//
// shows "goodbye" before closing
//
//-------------------------------------------
#include "../../../lib/std.mi"

Global Container MainContainer;
Global Layout NormalLayout;
Global Button CloseButton;
Global Text Ticker1;
Global Group DrawerGroup1, CloseGroup;
Global Timer closeTimer;

System.onScriptLoaded(){

MainContainer = getContainer("main");
Layout NormalLayout = MainContainer.getLayout("normal");

DrawerGroup1 = System.getContainer("main").getLayout("normal").getObject("tubes");
Ticker1 = DrawerGroup1.getObject("SongTicker");
CloseGroup = NormalLayout.getobject("fancy");
CloseButton = CloseGroup.getObject("close");

closeTimer = new Timer;
closeTimer.setDelay(5000);
}

CloseButton.onLeftClick(){
Ticker1.setText("Goodbye");
closeTimer.start();
}

closeTimer.onTimer() {
system.play();
}



because i dont want this to become a seond maki cheats skin, im going to explain how it works. id also like to say i hadnt used timers or setText before i wrote this...so you can write new stuff!!

code:

closeTimer = new Timer;
closeTimer.setDelay(5000);


there isnt much to explain really. you set up the timer in the onScriptLoad area. first initialize it by setting it equal to 'new Timer', then .setDelay() it for how long you want the timer to go for (its in miliseconds)

code:

CloseButton.onLeftClick(){
Ticker1.setText("Goodbye");
closeTimer.start();
}

closeTimer.onTimer() {
system.play();
}



the CloseButton i used here does NOT have an action defined in the xml. if you set its action to close, youll never get a chance to see the code work. i set my Ticker1 text to "Goodbye" when you click the button, then the timer starts. the 'onTimer' command tells winamp what to do when the timer its attatched to ends, in this case play (until a work around is implemented, which ill work on later i guess). you could also make it more elaborate with multible timers and/or layered tickers to get it to spell out goodbye letter by letter, but ill leave that to you. keep em comming
iPlayTheSpoons is offline   Reply With Quote