Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 21st September 2001, 21:15   #1
jakov.sosic
Senior Member
 
jakov.sosic's Avatar
 
Join Date: Aug 2001
Location: Split, Croatia
Posts: 244
Send a message via ICQ to jakov.sosic
Angry Urrghhh - that scripting problems again

I'm trying to put a wu shader visualization in my skin by using

SystemObject.getLeftVuMeter(); etc....

now this is a problem:

I don't know how to run my function constantly, because
when I press Play button it runs only once, but I would want it
to run constantly.
Is there any way to code it? Maybe running it every 10 miliseconds?
This is a code:


System.onPlay(){
wushader();
}

wu_shader(){
int L, R;
L = System.getLeftVuMeter();
L = L/255 * 128;
R = System.getRightVuMeter();
R = R/255 * 128;
WuImageL.resize(215,86,L,4);
WuImageR.resize(215,100,R,4);
}
jakov.sosic is offline   Reply With Quote
Old 22nd September 2001, 02:40   #2
lunarboy1
Forum King
 
lunarboy1's Avatar
 
Join Date: Dec 2000
Location: Somewhere, USA
Posts: 2,233
use a timer with a very small delay and do:

code:

Global Timer vutimer;

System.onScriptLoading()
{
vutimer = new Timer;
vutimer.setDelay( 5 ); /* 5 is Milliseconds. Can be lowered */
if ( System.getPlayItemString() != "" )
{
vutimer.start();
}
}

System.onScriptUnloading()
{
delete vutimer;
}

System.onPlay()
{
vutimer.start();
}

vutimer.onTimer()
{
wu_shader();
vutimer.start();
}

wu_shader()
{
int L, R;
L = System.getLeftVuMeter();
L = L/255 * 128;
R = System.getRightVuMeter();
R = R/255 * 128;
WuImageL.resize(215,86,L,4);
WuImageR.resize(215,100,R,4);
}



I'm sure my code is a little clumsy but i think it gets the job done.
lunarboy1 is offline   Reply With Quote
Old 22nd September 2001, 02:47   #3
lunarboy1
Forum King
 
lunarboy1's Avatar
 
Join Date: Dec 2000
Location: Somewhere, USA
Posts: 2,233
the getPlayItemString member function is used to see if anything is currently playing. The play sring is nothing when nothing is playing so if the string isn't nothing, then the timer should start because a song is already playing when the script was loaded.
lunarboy1 is offline   Reply With Quote
Old 23rd September 2001, 14:03   #4
jakov.sosic
Senior Member
 
jakov.sosic's Avatar
 
Join Date: Aug 2001
Location: Split, Croatia
Posts: 244
Send a message via ICQ to jakov.sosic
Thanks dude! I understand scripting, you don't have to explain it



By the way, your script has some mistakes, but I managed to fix them.
Now it works perfectly.
And also I'm using a bit higher delay, 120 milliseconds,
but in time between another function resizes layer slowly from one point to another if you understand what am I saying.
This way it looks smoother

Thanks for your help
jakov.sosic is offline   Reply With Quote
Old 23rd September 2001, 19:06   #5
lunarboy1
Forum King
 
lunarboy1's Avatar
 
Join Date: Dec 2000
Location: Somewhere, USA
Posts: 2,233
yea .. i hacked out that script in like 5 min so it probably sucked big time, but i'm glad you got the general gist of it.

Hope the skin works out great.
lunarboy1 is offline   Reply With Quote
Old 24th September 2001, 15:13   #6
jakov.sosic
Senior Member
 
jakov.sosic's Avatar
 
Join Date: Aug 2001
Location: Split, Croatia
Posts: 244
Send a message via ICQ to jakov.sosic
I don't know about skin working out great

Also, one more question for everyone who knows scripting more than I do:


Function abcd();

abcd{
Timer slow;
slow = new Timer;
slow.setDelay(10);

slow.onTimer(){
argument 1;
argument 2;
argument 3;
// etc......
}


}



Why the italic text isnt possible???
When I try to compile it, it says syntax error and points at "{".
Then I set this:


slow.onTimer();

So I have question. When I set that argument, is it working as a delay of 10 miliseconds (pauses script before continuing) or does nothing, and is it possible to call an extern Function from within other Function by using onTimer (or simply put some arguments in onTimer block).
Thanx
jakov.sosic is offline   Reply With Quote
Old 24th September 2001, 15:53   #7
s0be
Major Dude
 
s0be's Avatar
 
Join Date: Jun 2001
Location: melbourne Posts: First
Posts: 1,313
Send a message via ICQ to s0be Send a message via AIM to s0be Send a message via Yahoo to s0be
Function abcd();

abcd() {
Timer slow;
slow = new Timer;
slow.setDelay(10);
[I]
slow.onTimer(){
argument 1;
argument 2;
argument 3;
// etc......
}

Insert Red Text

/*
S0Be
*/

And On that day, the Lords of the land said unto their Master Architect, "The temple you have made to the gods of Wasabi and Maki has brought us no great prosperity" and they sent out him into the lands.

As he traveled to a far off land, he found he wasn't traveling alone, but that he had gained companions, and when they found their new land, they started work on a new temple, one that would be OPEN to all who wanted to worship.

from The Book of Wasabi C 12 Vs 09 (pg 2003)
s0be is offline   Reply With Quote
Old 24th September 2001, 16:01   #8
jakov.sosic
Senior Member
 
jakov.sosic's Avatar
 
Join Date: Aug 2001
Location: Split, Croatia
Posts: 244
Send a message via ICQ to jakov.sosic
brackets were mistake in question, not in real script

I'm still searching for answer on my previous post

jakov.sosic is offline   Reply With Quote
Old 24th September 2001, 16:26   #9
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
have you tried without arguments?
Naamloos is offline   Reply With Quote
Old 24th September 2001, 16:53   #10
Francis
French Admin
 
Join Date: Nov 2000
Posts: 329
Quote:
Originally posted by jakov.sosic
I don't know about skin working out great

Also, one more question for everyone who knows scripting more than I do:


Function abcd();

abcd{
Timer slow;
slow = new Timer;
slow.setDelay(10);

slow.onTimer(){
argument 1;
argument 2;
argument 3;
// etc......
}


}



Why the italic text isnt possible???
When I try to compile it, it says syntax error and points at "{".
Then I set this:


slow.onTimer();

So I have question. When I set that argument, is it working as a delay of 10 miliseconds (pauses script before continuing) or does nothing, and is it possible to call an extern Function from within other Function by using onTimer (or simply put some arguments in onTimer block).
Thanx
You can't put a function in a function, here is the right way to do it :

Global Timer slow; // <- make "slow" a global variable accessable by all functions/events

Function abcd();

abcd() {
slow = new Timer;
slow.setDelay(10);
} // <- close function abcd

slow.onTimer(){
argument 1;
argument 2;
argument 3;
// etc......
}

Francis.

Bluemars - Music For The Space Traveller
Francis is offline   Reply With Quote
Old 24th September 2001, 17:09   #11
s0be
Major Dude
 
s0be's Avatar
 
Join Date: Jun 2001
Location: melbourne Posts: First
Posts: 1,313
Send a message via ICQ to s0be Send a message via AIM to s0be Send a message via Yahoo to s0be
heh, I didn't even notice the discrepency in the braces... it's a monday...

/*
S0Be
*/

And On that day, the Lords of the land said unto their Master Architect, "The temple you have made to the gods of Wasabi and Maki has brought us no great prosperity" and they sent out him into the lands.

As he traveled to a far off land, he found he wasn't traveling alone, but that he had gained companions, and when they found their new land, they started work on a new temple, one that would be OPEN to all who wanted to worship.

from The Book of Wasabi C 12 Vs 09 (pg 2003)
s0be is offline   Reply With Quote
Old 25th September 2001, 03:27   #12
lunarboy1
Forum King
 
lunarboy1's Avatar
 
Join Date: Dec 2000
Location: Somewhere, USA
Posts: 2,233
yea.. Francis is right. 'slow' is only used in the braces and nowhere else. Atleast thats how the compiler interperets it
lunarboy1 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