View Single Post
Old 24th September 2017, 23:33   #13
Quinto Black CT Developer
Join Date: Sep 2016
Posts: 580
A thought regarding the IF query.

We assume, there is a boolean variable called answer. The processor "knows" that a boolean variable can only have one valid value: 1 or 0. So we declare this variable in the Global part of the script and assign a value to it. For example 0. Means "no answer".

In the further part of the script we want to execute a function according to a specific value of our variable called answer. So we ask:

if (answer) do this
else do that

As we remember we set the value to 0 so the else part will be executed.

Let's go back to your IF comment. If you type:

if (getStatus()==STATUS_PAUSED) AnimationPlayPause.gotoFrame(0);
else DoAniStuff(AnimationPlayPause, 15, 0, 50, 0);

I really doubt it is clear what else means. What does it mean? Which value is it? PAUSE? Why? PLAY? Why? I would recommend to be more precise here and "tell" Winamp exactly what you mean. For example:

if (getStatus()==STATUS_PAUSED) AnimationPlayPause.gotoFrame(0);
else if (getStatus==STATUS_STOPPED) DoAniStuff(AnimationPlayPause, 15, 0, 50, 0);

(I found a STATUS query within a function in a script of mine which looks like this:

So the function is supposed to run some commands if a song is played or paused. If neither PLAYING nor PAUSED is valid commands within the "else"-part are executed.)

So these would be my spontaneous ideas:

1) keep the STATUS of the playback within the System.onScriptLoaded() updated so you always get the correct animation.
2) try to use the System.onPlay, .onPause, .onStop commands only. (unless there is a limitation regarding the animations and you really have to use both - some tests are desperately needed here - will come soon )
3) "tell" exactly what is meant in the else line while doing the STATUS query. This might help.
Attached Thumbnails
Click image for larger version

Name:	script.png
Views:	6184
Size:	7.5 KB
ID:	53556  
PeterK. is offline