PDA

View Full Version : scripting help


lakitu42
11th June 2002, 21:34
I'm trying to compile a maki script based on the example in the skinning/scripting tips & tricks thread, but it won't compile. Can you tell me how to declare a variable for an animatedlayer and a slider? file attached. Thx

will
11th June 2002, 21:58
the globals need to be on the outside.#include "..\..\lib\std.mi"

Global Slider my_slider;
Global AnimatedLayer slider_layer;

system.onScriptLoaded() {

my_slider = system.getContainer("Main").getLayout("normal").getObject("volume");
slider_layer = system.getContainer("Main).getLayout("normal").getObject("volume.pic");

}

system.onVolumeChanged(int newvol) {

int frame = ( newvol * ( slider_layer.getLength() - 1 ) ) / 255;
slider_layer.goToFrame(frame);
} would be better

lakitu42
11th June 2002, 22:08
Hooray! It compiled. Thanx 4 the help.

PS. Like your icon or avatar (or whatever they call them around here).

will
11th June 2002, 22:11
hehe no probs.

my avatar is of dexter of dexters lab. the bestest cartoon ever.

-=RoNtZ=-
12th June 2002, 09:31
yeah...and u neither can watch dexters lab in germany nor u can watch cow&chicken ... :( :cry: :mad: I WANT'EM BACK!!! anyways... @willfisher: do u think u could write some tutorials about winamp3 animated-layer-scripting? i just can't get on with it... :(

lakitu42
12th June 2002, 21:01
In maki, do ints round themselves automatically or do you just get an error?

omarello
12th June 2002, 21:42
i think they do. maki follows C++ and i think C++ does round them off

spleen
12th June 2002, 23:29
Originally posted by lakitu42
In maki, do ints round themselves automatically or do you just get an error?
Yes, they do.

So code like this...
int a=5/2;
... would assign number 2 to variable a. Simple... :)

DJGrenola
13th June 2002, 23:32
Yeah, they all round down. Don't forget that you can find the remainder of an integer division, as in C, Java etc., using the '%' operator.

DJG