Old 10th January 2003, 17:11   #1
Digitalhigh
Guest
 
Posts: n/a
a teensy weensy lil' snag

Okee, so I wrote my first script last night after several attempts and even more beer. It works 99% of the way I want it to, but there's a slight problem. If the EQ is on and you turn it off, the picture instantly disappears. But this only happens the first time. After that, the fades work fine. What in the name of bob am I missing?

// never forget to include std.mi
#include "../../../lib/std.mi"

//declares global variables for use in script
global button eqbtn, ctbtn;
global group eqgrp, ctgrp, drawergrp, drawerinfo;
global int drawerstatus, eqstatus, eqgrpstatus, ctgrpstatus, StartX, StartY, EndX, EndY, eqcounter;
global layer Drawer, eqlines;
global timer eqtimer, eqtimer2;

System.onScriptLoaded() {

//gets the group that has the objects we want


drawergrp = getScriptGroup();;

//now that we have the group, get the layers in the group
Drawer = drawergrp.findObject("Drawer");
DrawerInfo = drawergrp.findObject("DrawerInfo");
eqgrp = drawergrp.findObject("EQgroup");
ctgrp = drawergrp.findObject("ctgroup");
eqbtn = drawergrp.findObject("eqbtn");
ctbtn = drawergrp.findObject("ctbtn");
eqlines = eqgrp.findObject("eqlines");


eqtimer = new Timer;
eqtimer.setDelay(20);

eqtimer2 = new Timer;
eqtimer2.setDelay(20);


//initialize our drawer flag to closed
DrawerStatus = 0;
eqstatus = System.getEq();
ctgrpstatus = 0;

//checks eq state for the lines and labels
if (eqstatus != 0) {

eqtimer.start();
}
else {
eqtimer2.start();
}




}//end onScriptLoaded()

//starts the appropriate timer if the eq state changes

System.onEqChanged(int newstatus) {
if (eqstatus != newstatus) {
eqstatus = newstatus;
}

if (eqstatus == 0) {
eqtimer2.start();
}
if (eqstatus == 1) {
eqtimer.start();
}

}


//fade timers

eqtimer.onTimer() {

eqlines.setAlpha(eqcounter);

if (eqCounter>=255) {
eqtimer.stop();
eqlines.setAlpha(255);
}

eqCounter+=25;

}

eqtimer2.onTimer() {

eqlines.setAlpha(eqcounter);

if (eqCounter<=0) {
eqtimer2.stop();
eqlines.setAlpha(0);
}

eqCounter-=25;

}
  Reply With Quote
Old 10th January 2003, 17:25   #2
Gonzotek
Gunslinger
 
Gonzotek's Avatar
 
Join Date: May 2000
Location: Terminus
Posts: 4,693
I think it's because eqcounter isn't initialized with a value the first time you enter either timer. When you getEQ() in onscriptloaded, use it's result to assign an initial value to eqcounter (0 for eqstatus==0 or 255 for eqstatus==1 ).

-=Gonzotek=-

I was away for a while.
But I'm feeling much better now.
Gonzotek is offline   Reply With Quote
Old 10th January 2003, 17:47   #3
Digitalhigh
Guest
 
Posts: n/a
Okay, that fixed it. Next snag: Clicking the EQ button several times in rapid succession causes the layer to flicker. I'm sure it's because the timers are dueling, and tried inserting another if () statement in each timer to check the eqstatus and stop it if eqstatus changes, but the flicker remains. Any other ideas?
  Reply With Quote
Old 10th January 2003, 17:54   #4
Gonzotek
Gunslinger
 
Gonzotek's Avatar
 
Join Date: May 2000
Location: Terminus
Posts: 4,693
Check whether the other timer is running before proceeding.

code:
eqtimer2.onTimer() {
if(!eqtimer1.isRunning()){
eqlines.setAlpha(eqcounter);

if (eqCounter<=0) {
eqtimer2.stop();
eqlines.setAlpha(0);
}

eqCounter-=25;
}
else {....}
}


I was away for a while.
But I'm feeling much better now.
Gonzotek is offline   Reply With Quote
Old 10th January 2003, 18:32   #5
Digitalhigh
Guest
 
Posts: n/a
That fixes the flicker, but clicking too fast still breaks it.
  Reply With Quote
Old 10th January 2003, 19:12   #6
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
if you really wanted to stop...you COULD XMLparam something like ghost="1" while its fading into your EQ button, so it couldnt be clicked. so its like(not using uoir code, this is an example)

EQToggle.onLeftClick(){
EQToggle.setXmlParam("ghost", "1");
eqtimer.start();}

eqtimer.ontimer(){
do fading shit blah blah;
EQToggle.setXmlParam("ghost", "0");

a suggestion
iPlayTheSpoons is offline   Reply With Quote
Old 10th January 2003, 19:40   #7
Gonzotek
Gunslinger
 
Gonzotek's Avatar
 
Join Date: May 2000
Location: Terminus
Posts: 4,693
Good idea!

-=Gonzotek=-

I was away for a while.
But I'm feeling much better now.
Gonzotek is offline   Reply With Quote
Old 10th January 2003, 20:36   #8
Digitalhigh
Guest
 
Posts: n/a
What gonzo said.

Cheers to the spoons.
  Reply With Quote
Old 10th January 2003, 20:56   #9
Digitalhigh
Guest
 
Posts: n/a
Made this:


System.onEqChanged(int newstatus) {
eqbtn.setXmlParam("ghost", "1");
if (eqstatus != newstatus) {
eqstatus = newstatus;
}

if (eqstatus == 0) {
eqtimer2.start();
}
if (eqstatus == 1) {
eqtimer.start();
}

}


//fade timers

eqtimer.onTimer() {

if(!eqtimer2.isRunning()){

eqlines.setAlpha(eqcounter);

if (eqCounter>=255) {

eqtimer.stop();
eqbtn.setXmlParam("ghost", "0");
eqlines.setAlpha(255);

}
eqCounter+=25;

}
}

eqtimer2.onTimer() {

if(!eqtimer.isrunning()){
eqlines.setAlpha(eqcounter);

if (eqCounter<=0) {

eqtimer2.stop();
eqbtn.setXmlParam("ghost", "1");
eqlines.setAlpha(0);

}
eqCounter-=25;
}
}

Now the button is always on ghost mode. I added a eqbtn.setxmlparam... at onscriptloaded too, thinking the problem was there.
  Reply With Quote
Old 10th January 2003, 21:02   #10
Gonzotek
Gunslinger
 
Gonzotek's Avatar
 
Join Date: May 2000
Location: Terminus
Posts: 4,693
Shouldn't both timers set ghost=0 when done? Because in either case you want the button available again after the timer is done?

-=Gonzotek=-

I was away for a while.
But I'm feeling much better now.
Gonzotek is offline   Reply With Quote
Old 10th January 2003, 21:05   #11
Digitalhigh
Guest
 
Posts: n/a
Egads, yes. I probably saw that at the same time you did. F'ing clipboard, gets me every time. It works now, but you can still screw the fade up if you click fast enough.
  Reply With Quote
Old 10th January 2003, 21:06   #12
Gonzotek
Gunslinger
 
Gonzotek's Avatar
 
Join Date: May 2000
Location: Terminus
Posts: 4,693

I was away for a while.
But I'm feeling much better now.
Gonzotek is offline   Reply With Quote
Old 10th January 2003, 21:18   #13
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
if someone clicks to fast, make winamp yell at them and/or give the a wedgie...i dont know the maki command for that
iPlayTheSpoons is offline   Reply With Quote
Old 11th January 2003, 03:07   #14
Digitalhigh
Guest
 
Posts: n/a
eqbutton.onclicktoofast(int clickspeed){
username.givewedgied("clickspeed");

How's that? It need a do until timer, and I'm not sure if clickspeed is defined right. I'm rather drunk.
  Reply With Quote
Old 13th January 2003, 19:16   #15
Digitalhigh
Guest
 
Posts: n/a
Mr Shit, meet Mr. Fan

Aight, this is where I'm at. I'm in the phase of removing the corny, simplistic drawer script I've been using for testing purposes, and now trying to make the drawer slide in and out to switch between the colorthemes group and the equalizer group. I've gotten the drawer to move on either buttonclick, it knows to disable the other button and hide the other layer if you switch from CT to EQ or vice versa, my problem is getting the drawer to close and re-open with the new layer visible. Here's what I've got.

eqgrpbtn.onactivate (int activated) {

eqgrpstatus = activated;
if (eqgrpstatus) {
if (ctgrpstatus !=0) {
drawerstatus = 1;
closedrawer();
ctgrp.hide();
eqgrp.show();
ctgrpstatus = 0;
eqgrpstatus = 1;
ctgrpbtn.setactivatednocallback(0);
drawerstatus = 0;
opendrawer();



} else {

ctgrp.hide();
eqgrp.show();
opendrawer();
eqgrpstatus = 1;

}

} else {

closedrawer();
eqgrp.hide();
eqgrpstatus = 0;
}
}

ctgrpbtn.onactivate (int activated) {

ctgrpstatus = activated;
if (ctgrpstatus) {
if (eqgrpstatus != 0) {
drawerstatus = 1;
closedrawer();
eqgrp.hide();
ctgrp.show();
eqgrpstatus = 0;
ctgrpstatus = 1;
eqgrpbtn.setactivatednocallback(0);
drawerstatus = 0;
opendrawer();


} else {

eqgrp.hide();
ctgrp.show();
opendrawer();
ctgrpstatus = 1;

}

} else {

closedrawer();
ctgrp.hide();
ctgrpstatus = 0;
}
}


Opendrawer() {

DrawerGrp.setTargetX(98); //set the x coordinate you want the drawer to slide to
DrawerGrp.setTargetY(3); //set the y coordinate you want the drawer to slide to
DrawerGrp.setTargetSpeed(0.75); //sets the speed the drawer will slide at(higher is slower)
DrawerGrp.gotoTarget(); //now that we have our target values and speed, start moving!
drawerstatus = 1;

}

Closedrawer() {

DrawerGrp.setTargetX(204); //set the x coordinate you want the drawer to slide back to
DrawerGrp.setTargetY(3); //set the y coordinate you want the drawer to slide back to
DrawerGrp.setTargetSpeed(0.75); //sets the speed the drawer will slide at(higher is slower)
DrawerGrp.gotoTarget(); //now that we have our target values and speed, start moving!
drawerstatus = 0; //Change the flag to Closed


}

One of the questions I had was the .setactivatednocallback versus the .setactivated method. The one I'm using is what I'd want to call if I wanted to change it, but not trigger the other button again, right? Other than that, my only concern is getting the damn drawer to work as desired. Somebody, anybody, help!
  Reply With Quote
Old 25th January 2003, 07:02   #16
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
Hey DigitalHigh,
I did something very similar in Soundwave. Check out the shade mode for that skin, it does just this(but with 4 groups instead of 2). The file that controls all of that is shadedrawer.m. Take a look at it, see if you can figure out what you need. If not, feel free to ask for clarification on any of it and I'll try to help you out. Luckily yours will probably not need a lot of that code since mine was configurable to open up or down.
~FrisbeeMonkey
frisbeemonkey is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump