Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 8th October 2002, 11:31   #1
rintaro82
Junior Member
 
rintaro82's Avatar
 
Join Date: Jul 2001
Posts: 25
maki "psuedo-slider" help

hi all. can someone out there tell me why this script doesn't work? it's supposed to cause a layer ("push") to slide across a 70 pixel area in time to the song which is playing.

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

global layer mybutton;
global group mybuttongroup;
global timer mytimer;

system.onscriptloaded()
{
mybuttongroup = getscriptgroup();
mybutton = mybuttongroup.findobject("Push");
mytimer = new timer;
mytimer.setdelay(1000);
}

system.onplay()
{
mytimer.start();
}

mytimer.ontimer()
{
if (system.getplayitemlength() > 0)
{
float played = system.getposition();
played = played / system.getplayitemlength();
int setX = 70 * played;
mybutton.resize(setX,20,20,20);
mybutton.fx_update();
}
}


i realize there is nothing in there to bring the layer back to the beginning, but i'm just trying to get the guts work at this point. i also realize that i really don't know what i'm doing here, so it might be something stupid.

in case it's important, "push" is defined in my player.xml simply as a 20 X 20 layer at x="100" and y="20".

thanks in advance!
rintaro82 is offline   Reply With Quote
Old 8th October 2002, 13:03   #2
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,568
the best way to set the co-ords of a layer is to use guiobject.setxmlparam("x",integertostring(setX));
or whatever

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 8th October 2002, 15:15   #3
Hollow
Major Dude
 
Hollow's Avatar
 
Join Date: Oct 2001
Location: Baker Lab, Ithaca NY
Posts: 1,128
Send a message via AIM to Hollow
First off, you don't need the Fx_Update() line. Resize is not a layer fx function. So you can remove that.

I suspect that it doesn't work because you are doing floating point division and storing the value to an int. try doing something like this.
code:

double setX = 70 * played;
MyButton.resize(Integer(setX),20,20,20);


or
code:

int setX = Integer(70 * played);
MyButton.resize(setX,20,20,20);



the point of all this being, that i don't think maki will convert the type for you. Consider it like typecasting in c++. int setx = (int)(70*played), its just that maki uses a function call (system.integer(double d)) to do the same thing.

But like will fisher said, SetXmlParam might be a better choice, It really depends on you and how you want to do this and what you want to do with it latter. To me they both have good and bad points.

The moon is made of cheese.
Oh for some tasty moon cheese.
www.redtetrahedron.org
Hollow is offline   Reply With Quote
Old 9th October 2002, 10:18   #4
rintaro82
Junior Member
 
rintaro82's Avatar
 
Join Date: Jul 2001
Posts: 25
thanks to both of you for the input. i'll have to try both methods to see which one works best.
rintaro82 is offline   Reply With Quote
Reply
Go Back   Winamp 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