PDA

View Full Version : Script only works when Winamp is stopped


avegav2
5th March 2004, 03:40
I was trying to write a slider bar for the main window that would appear only when the mouse is over its area. So I wrote this script (showseeker.maki):


#include "../../../lib/std.mi"

Global Group SeekerGrp;
Global Text SongInfoTxt;
Global Layer SeekbarBG, SeekbarInv;
Global Slider Seeker, SeekerGhost;

System.onScriptLoaded() {

SeekerGrp = System.getScriptGroup();

SongInfoTxt = SeekerGrp.getObject("infoline");
SeekbarBG = SeekerGrp.getObject("seekbar");
SeekbarInv = SeekerGrp.getObject("seekbarinv");
Seeker = SeekerGrp.getObject("seeker");
SeekerGhost = SeekerGrp.getObject("seekerghost");

}

SeekbarInv.onEnterArea() {
Seeker.SetXMLParam("thumb","player.slider");
Seeker.SetXMLParam("downthumb","player.slider");
SeekerGhost.SetXMLParam("thumb","player.slider");
SeekerGhost.SetXMLParam("downthumb","player.slider");
SeekbarBG.show();
}

SeekbarInv.onLeaveArea() {
Seeker.SetXMLParam("thumb","player.slider.invisible");
Seeker.SetXMLParam("downthumb","player.slider.invisible");
SeekerGhost.SetXMLParam("thumb","player.slider.invisible");
SeekerGhost.SetXMLParam("downthumb","player.slider.invisible");
SeekbarBG.hide();
}


The elements are defined like this:


<elements>
<bitmap id="player.seekbar" file="player/player_seekbar.png" />
<bitmap id="player.seekbar.invisible" file="player/player_seekbar_invisible.png" />
<bitmap id="player.slider" file="player/player_slider.png" />
<bitmap id="player.slider.invisible" file="player/player_slider_invisible.png" />
</elements>


The bitmaps "player.seekbar.invisible" and "player.slider.invisible" are totally transparent. The first one define the area where the mouse should activate the script when the mouse is over, the second one defines an invisible slider.


<groupdef id="playerticker" name="Player Ticker" w="318" h="23" >
<layer id="seekbar" image="player.seekbar" x="50" y="14"/>
<layer id="seekbarinv" image="player.seekbar.invisible" x="50" y="14"/>

<slider
id="seeker"
action="SEEK"
x="50" y="14"
w="144" h="7"
thumb="player.slider"
downThumb="player.slider"
orientation="horizontal"
/>

<slider
id="seekerghost"
action="SEEK"
x="50" y="14"
w="144" h="7"
thumb="player.slider"
downThumb="player.slider"
orientation="horizontal"
/>

<script id="showseeker" file="scripts/showseeker.maki" />
</groupdef>


But the script only works when Winamp is stopped. I wonder if I can anidate events in MAKI, something like this:

System.onPlay {
SeekbarInv.onEnterArea {
... etc.

Any help is welcomed.

matt_69
5th March 2004, 05:30
there is a much easier way to do that whole script...ill write one up and post it.

-matt

matt_69
5th March 2004, 05:39
ok...its pretty simple to read thru it all..ull just need to name the group with all ur stuff in it (i am assuming that you have all the stuff in one group, if you don't it will be the best way to do it.) and then change the definition and the rest. hope it helps.

-matt

avegav2
6th March 2004, 19:03
I'd prefer not to use alpha channels, because they don't work with Windows 98 or Windows ME (many people still uses them). But I tried this solution and it didn't work either; it seems that the only events I can trigger in the main container are onPlay(), onStop(), onPause() and onResume(); nor onEnterArea() neither onLeaveArea(). What would happen with my skin?
I wrote a new version of the script, called showseeker2.m, which is supossed to read the position of the cursor every half second, and depending of it, it should show or hide the seeker bar. But the damn script doesn't work either. Maybe my understanding of the Timer object is poor and it contains a serious concept mistake. Would somebody analyze it?
I was thinking of rewriting this showseeker2.m in the form of an infinite loop with a delay, something like this:

System.onPlay() {
do {
ReadCurPosition();
delay(500); //or whatever
} while ( "a" == "a" );
}

but I don't know how to implement a delay. Is there a function like delay(500) or something? Maybe someone has constructed a user function with MAKI.

hammerhead
6th March 2004, 22:09
Alpha will work over other areas of the skin in '98 / ME.

avegav2
7th March 2004, 03:05
You're right, alpha works, but my problem surely is with the timings or the logic of my script. I tested the script that matt_69 sent me using onPlay() and onStop() instead of onEnterArea() and onLeaveArea(), and the seekbar appeared and dissapeared as expected.
Anyone knows how to construct a delay function?