Old 16th December 2002, 00:17   #1
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
How to Write a MAKI Script

How to write a MAKI script:

ive seen alot of new skinners comming into the forums asking about maki. most of the time they are just refered to std.mi. the problem is that unless you know something about programming, it wont get you very far. this will serve as a crash course of sorts through maki programming, and will help you get from a blank page to a fully compiled script...hopefully. so lets begin

im going to use a script i wrote myself. its pretty simple and should be easy enough to follow. here it is in full:
code:

//----------------------------------------------------------------------------------------------------------------
// wingsanim.m
//
// controls animation between layouts
// be warned...i accedentally messed this script up after compiling, so as is it actually
// wont compile as is cuz i dont feel like looking for why it wont
//
// help by FrisbeeMonkey
//
//----------------------------------------------------------------------------------------------------------------

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

Global AnimatedLayer WingAnim;
Global Group AnimGroup, RetractGroup1, RetractGroup2;
Global Button Button1, Button2;
Global Layout NormalLayout, ClosedLayout, AnimationLayout;
Global Container MainContainer;
Global Int a;


System.onScriptLoaded() {

MainContainer = getContainer("main");
Layout NormalLayout = MainContainer.getLayout("normal");
Layout ClosedLayout = MainContainer.getLayout("closed");
Layout AnimationLayout = MainContainer.getLayout("animation");

AnimGroup = AnimationLayout.getObject("anim");
WingAnim = AnimGroup.getObject("wingsanim");
RetractGroup1 = NormalLayout.getObject("retract");
Button1 = RetractGroup1.getObject("ret");
RetractGroup2 = ClosedLayout.getObject("retract2");
Button2 = RetractGroup2.getObject("ret");

WingAnim.setSpeed(65);
a = 0;

}

WingAnim.onStop(){
if(a == 1){
MainContainer.switchToLayout("closed");
}
else if(a == 0){
MainContainer.switchToLayout("normal");
}
}

Button1.onLeftButtonUp(int x, int y) {
a = 1;
WingAnim.setStartFrame(1);
WingAnim.setEndFrame(8);
MainContainer.switchToLayout("animation");
WingAnim.play();
}
Button2.onLeftButtonUp(int x, int y) {
a = 0;
WingAnim.setStartFrame(8);
WingAnim.setEndFrame(1);
MainContainer.switchToLayout("animation");
WingAnim.play();
}



not too complicated, but can be a little intimidating. so lets break it up
code:

//----------------------------------------------------------------------------------------------------------------
// wingsanim.m
//
// controls animation between layouts
// be warned...i accedentally messed this script up after compiling, so as is it actually
// wont compile as is cuz i dont feel like looking for why it wont
//
// help by FrisbeeMonkey
//
//----------------------------------------------------------------------------------------------------------------



this is not required to make your script work, but its nice. just a little intro and credits to your skin. what it does and who made it.
code:

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


never forget this. it tell the script to look for all the commands youre going to tell it later. make sure it looks just like that and is at the top of your page.
code:

Global AnimatedLayer WingAnim;
Global Group AnimGroup, RetractGroup1, RetractGroup2;
Global Button Button1, Button2;
Global Layout NormalLayout, ClosedLayout, AnimationLayout;
Global Container MainContainer;
Global Int a;


in the Globals area we define any variables we use or items we refrence. if you have a button that will, lets say, increase the volume, you should first put it in your xml (im going to asume you know xml for this), and then have something like "Global Button -yourbutton-". what goes in the -yourbutton- spot is up to you, just make sure you remember it for the next part. there are many kinds of Globals, as you can see here. to know which one to use, just look at youre xml. if it looks like this:
code:

x="2" y="2"
w="335" h="403"
id="wingsanim"
image="winganim"
move="0"
autoplay="0"
autoreplay="0"
sysregion="1"
ghost="1"
/>


then you want a Global AnimatedLayer (notice the first part of the xml is the type of Global).
code:

System.onScriptLoaded() {

MainContainer = getContainer("main");
Layout NormalLayout = MainContainer.getLayout("normal");
Layout ClosedLayout = MainContainer.getLayout("closed");
Layout AnimationLayout = MainContainer.getLayout("animation");

AnimGroup = AnimationLayout.getObject("anim");
WingAnim = AnimGroup.getObject("wingsanim");
RetractGroup1 = NormalLayout.getObject("retract");
Button1 = RetractGroup1.getObject("ret");
RetractGroup2 = ClosedLayout.getObject("retract2");
Button2 = RetractGroup2.getObject("ret");

WingAnim.setSpeed(65);
a = 0;

}


this is the stuff that happens the moment winamp loads your script, and doesnt need to be triggered. 'System.onScriptLoaded() {' tells the program this is the stuff to do as i just described it, and you dont need to change it. ok, this can get a little complicated, so ill be as clear as i can. things like 'MainContainer = getContainer("main");' is where you define all the different parts of youre skin, as they appear in your xml. you need to define anything your skin needs to work (buttons, sliders, layers) as well as the continers, layouts, and groups they are in. in this example, everything is in the main container, so its the only one i have. there are three layout that come into play, so they are defined. they are in the main continer, so you get 'Layout NormalLayout = MainContainer.getLayout("normal"); '. only Layouts require 'Layout' at the begining of the line like that. 'MainContainer.' tells you the layout is in the main container, and its called 'normal' in my xml, so thats how its refenced here. get it?

alright, if youve used Scythe, this will be a little easier. i have two usable layouts, one will the wings opened, the other with them closed, and a third layout which is just the animation. in the three layouts i have ine item i refer to: the buttons in each layout to trigger the animation and the animtion itsself. the reason there are six items defined is that these things all fall into groups, which you have to define as well. if you read this then just stare at the code for a while, you should get it.

last i set the animation speed (just another command you can find in std.mi) and a varible int a = 0. thats pretty much that...just remember the closing bracket!
code:

WingAnim.onStop(){
if(a == 1){
MainContainer.switchToLayout("closed");
}
else if(a == 0){
MainContainer.switchToLayout("normal");
}
}

Button1.onLeftButtonUp(int x, int y) {
a = 1;
WingAnim.setStartFrame(1);
WingAnim.setEndFrame(8);
MainContainer.switchToLayout("animation");
WingAnim.play();
}
Button2.onLeftButtonUp(int x, int y) {
a = 0;
WingAnim.setStartFrame(8);
WingAnim.setEndFrame(1);
MainContainer.switchToLayout("animation");
WingAnim.play();
}



this is the real stuff right here. this is where button clicking and the like does what it does. tis is actually the easiest part once you know what going on. i will assume you have NO IDEA how to program.
code:

WingAnim.onStop(){
if(a == 1){
MainContainer.switchToLayout("closed");
}
else if(a == 0){
MainContainer.switchToLayout("normal");
}
}


this tells winamp that when WingAnim (which was defined earlier) stops, it should perform the action that follows. if a==1, it will switch to the closed layout. if a==0, it will switch to the normal layout. how does it know what a is? thats in the next little bit. 'if' and 'else if' are classic programming commands, and are pretty easy to figure out how to use. make sure you have double equal (==) in an if statement, or != if they should be not equal. some other programming stuff to look out for: make sure you end most lines with a ';' unless the line ends in a { or }. make sure every { has a matching }.
code:

Button1.onLeftButtonUp(int x, int y) {
a = 1;
WingAnim.setStartFrame(1);
WingAnim.setEndFrame(8);
MainContainer.switchToLayout("animation");
WingAnim.play();
}
Button2.onLeftButtonUp(int x, int y) {
a = 0;
WingAnim.setStartFrame(8);
WingAnim.setEndFrame(1);
MainContainer.switchToLayout("animation");
WingAnim.play();
}


this tells winamp that if the user left clicks the button1 i defined earlier (this is the button from normal layout) that it should first set a=1 (this is important so that the onStop() part from above knows which layout to switch to next). it then sets the starting frame of the animation to 1 and the end frame to 8. it is an 8 frame animation. it then switches to the layout that has the animation, and plays it. the only difference between that and the second one is that a will equal 0 (so the animation switching works right) and that is plays the animation backwards.


does all of that make sense? i hope so
there are many many other command you can use in your maki script, which can, for 99% of you, be found at C:\Program Files\Winamp3\Lib\std.mi. its only partly documented, but most of what you need is in there. i just hope mostof you will know how to use those commands now. if you need any clarification, ill be happy to...clarify
iPlayTheSpoons is offline   Reply With Quote
Old 16th December 2002, 00:56   #2
sbsm
Senior Member
 
sbsm's Avatar
 
Join Date: Sep 2002
Posts: 160
this helps a lot b/c my main problem so far has been maki.
thanks for making this thread!
sbsm is offline   Reply With Quote
Old 16th December 2002, 06:42   #3
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
the reason for this thread was really to help you make your own stuff, to do stuff that wasnt easily done with a premade script (like frisbee monkey's...which are excelent). one thing that is wonderful in its customizability is the drop down list. in this ill show how to creat your very own. if youve ever used Mercury or my skin, you know how neat and functional these can be.

again ill start with one of my scripts from Scythe...and again it will help if youre familiar. i trimmed it down to isolate what we want to work with and here it is:

code:

//----------------------------------------------------------------------------------------------------------------
// thinger.m
//
// controls super cool thinger functions
//
// help from rpeterclark's dropdown example
//
//----------------------------------------------------------------------------------------------------------------

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

Global Group ToggleGroup;
Global Button Toggle;
Global Layout ThingerLayout;
Global Container ThingerContainer;
Global PopupMenu ControlPopup;

System.onScriptLoaded() {

ThingerContainer = getContainer("thinger");
Layout ThingerLayout = ThingerContainer.getLayout("normal");

ToggleGroup = ThingerLayout.getObject("togglebutton");
Toggle = ToggleGroup.getObject("toggle");

ControlPopup = new PopupMenu;
ControlPopup.addCommand("Play", 1,0,0);
ControlPopup.addCommand("Stop", 2,0,0);
ControlPopup.addCommand("Pause", 3,0,0);
ControlPopup.addCommand("Next", 4,0,0);
ControlPopup.addCommand("Previous", 5,0,0);
ControlPopup.addCommand("Open Files", 6,0,0);

}




Toggle.onRightButtonDown(int a, int b) {
Int intSelection = ControlPopup.popAtMouse();
if (intSelection > 0) {
if (intSelection==1) {
system.play();
}
else if (intSelection==2) {
system.stop();
}
else if (intSelection==3) {
system.pause();
}
else if (intSelection==4) {
system.next();
}
else if (intSelection==5) {
system.previous();
}
else if (intSelection==6) {
system.eject();
}
}
Complete;
}


ill assume youve read the last thing and know what the basics are. if so, this should be a breeze.

code:

ControlPopup = new PopupMenu;
ControlPopup.addCommand("Play", 1,0,0);
ControlPopup.addCommand("Stop", 2,0,0);
ControlPopup.addCommand("Pause", 3,0,0);
ControlPopup.addCommand("Next", 4,0,0);
ControlPopup.addCommand("Previous", 5,0,0);
ControlPopup.addCommand("Open Files", 6,0,0);


this here is where we tell winamp what we want our popup to look like. 'ControlPopup' is what I named the menu, you can make it whatever you like, just make sure it matches your Global definition! to add an option to our menu we use the 'addCommand()' function, and heres what the option inside the () mean: the first is what appears in the menu...easy enough. the second is which number on the list it will be, as well and the interger value its assigned. dont worry too much about what that means, just be ready to refer back to it--generally do it in the orderly way shown here, its easiest. the last two numbers are how it should appear when active/inactive(kinda like how theres a little mark next to the skin your using in the default menu). this can be a bit tricky to get to work right, but fortunately for us it doesnt matter in this case. by setting both to '0', there wont be any marks. this is more important for toggle stuff, which i might explain in more depth later.

code:

Toggle.onRightButtonDown(int a, int b) {
Int intSelection = ControlPopup.popAtMouse();
if (intSelection > 0) {
if (intSelection==1) {
system.play();
}
else if (intSelection==2) {
system.stop();
}
else if (intSelection==3) {
system.pause();
}
else if (intSelection==4) {
system.next();
}
else if (intSelection==5) {
system.previous();
}
else if (intSelection==6) {
system.eject();
}
}
Complete;
}


the heart of the code right here. according to this, when someone right clicks on the Toggle button it will cause the pop up to come down. this is pretty much a copy paste job, changing the names that need to be changed in the first part, and adding/subtracting else if statements as needed. for the if/else if statements, heres what they mean: the 'intSelection==x' part refers back to the int assignments i mentioned earlier. "Play" was assigned value 1, so if they select "Play" (or, you could say, 1), then it triggers the system.play() function (look in std.mi for funtions like that). the rest is pretty self explanitory. hope that does it for you.
iPlayTheSpoons is offline   Reply With Quote
Old 16th December 2002, 09:40   #4
xenosomething
Major Dude
 
xenosomething's Avatar
 
Join Date: Sep 2002
Location: ?
Posts: 1,473
thanks, i didnt know how to use menus
xenosomething is offline   Reply With Quote
Old 16th December 2002, 12:42   #5
hammerhead
The Shark
(Forum King)
 
hammerhead's Avatar
 
Join Date: Jul 2002
Posts: 2,537
Send a message via AIM to hammerhead
Now I've got something else to implement into Zechtichoplayer!
Thx!
hammerhead is offline   Reply With Quote
Old 17th December 2002, 23:27   #6
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
glad this was all well recieved...any requests?
iPlayTheSpoons is offline   Reply With Quote
Old 17th December 2002, 23:36   #7
KornBizkitNyAz
Member
 
KornBizkitNyAz's Avatar
 
Join Date: Nov 2002
Location: BKLYN WHAT WHAT!
Posts: 65
Send a message via AIM to KornBizkitNyAz
GO FOR IT

hey y dont u check out that one guys idea n make a script that says good bye when u turn it off. just a thought. by he way i love this post n u really can have my children
KornBizkitNyAz is offline   Reply With Quote
Old 18th December 2002, 00:39   #8
Digitalhigh
Guest
 
Posts: n/a
Just wanted to say excellent work here. Nice contribution.

  Reply With Quote
Old 18th December 2002, 00:58   #9
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
thank DH, stuff like that keeps goin...

ok, for the goodbye script. the problem is theres no maki command to close winamp. theres a work around involving setting up a dummy close button button in your xml and having the maki trigger that, but ill go more into that later. heres what i threw together...it works, it just doesnt close after the timer stops, it plays:

code:

//--------------------------------------------
// goodbye.m
//
// shows "goodbye" before closing
//
//-------------------------------------------
#include "../../../lib/std.mi"

Global Container MainContainer;
Global Layout NormalLayout;
Global Button CloseButton;
Global Text Ticker1;
Global Group DrawerGroup1, CloseGroup;
Global Timer closeTimer;

System.onScriptLoaded(){

MainContainer = getContainer("main");
Layout NormalLayout = MainContainer.getLayout("normal");

DrawerGroup1 = System.getContainer("main").getLayout("normal").getObject("tubes");
Ticker1 = DrawerGroup1.getObject("SongTicker");
CloseGroup = NormalLayout.getobject("fancy");
CloseButton = CloseGroup.getObject("close");

closeTimer = new Timer;
closeTimer.setDelay(5000);
}

CloseButton.onLeftClick(){
Ticker1.setText("Goodbye");
closeTimer.start();
}

closeTimer.onTimer() {
system.play();
}



because i dont want this to become a seond maki cheats skin, im going to explain how it works. id also like to say i hadnt used timers or setText before i wrote this...so you can write new stuff!!

code:

closeTimer = new Timer;
closeTimer.setDelay(5000);


there isnt much to explain really. you set up the timer in the onScriptLoad area. first initialize it by setting it equal to 'new Timer', then .setDelay() it for how long you want the timer to go for (its in miliseconds)

code:

CloseButton.onLeftClick(){
Ticker1.setText("Goodbye");
closeTimer.start();
}

closeTimer.onTimer() {
system.play();
}



the CloseButton i used here does NOT have an action defined in the xml. if you set its action to close, youll never get a chance to see the code work. i set my Ticker1 text to "Goodbye" when you click the button, then the timer starts. the 'onTimer' command tells winamp what to do when the timer its attatched to ends, in this case play (until a work around is implemented, which ill work on later i guess). you could also make it more elaborate with multible timers and/or layered tickers to get it to spell out goodbye letter by letter, but ill leave that to you. keep em comming
iPlayTheSpoons is offline   Reply With Quote
Old 30th December 2002, 13:39   #10
qlimo
Senior Member
 
qlimo's Avatar
 
Join Date: Oct 2002
Location: Slovakia
Posts: 114
Send a message via ICQ to qlimo
To the moderators:

Plz, make this sticky! It's a great thread and I'm sure it's worth it !
qlimo is offline   Reply With Quote
Old 31st December 2002, 04:25   #11
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
damn right!
iPlayTheSpoons is offline   Reply With Quote
Old 2nd January 2003, 12:26   #12
qlimo
Senior Member
 
qlimo's Avatar
 
Join Date: Oct 2002
Location: Slovakia
Posts: 114
Send a message via ICQ to qlimo
yep,btw,congrats for featuring your Scythe skin , great work!
qlimo is offline   Reply With Quote
Old 2nd January 2003, 12:32   #13
Russ
Mostly Harmless
(Alumni)
 
Join Date: Jan 2001
Location: UK
Posts: 2,319
Does this forum really need another sticky? I spose if people find it useful - someone should set up a site with all this maki stuff on.

*stuck* (feel free to unstick if you think there's too much stickiness around )

For long you live and high you fly, but only if you ride the tide, and balanced on the biggest wave you race towards an early grave.
|Musicbrainz|Audioscrobbler|last.fm|
Russ is offline   Reply With Quote
Old 2nd January 2003, 18:30   #14
KornBizkitNyAz
Member
 
KornBizkitNyAz's Avatar
 
Join Date: Nov 2002
Location: BKLYN WHAT WHAT!
Posts: 65
Send a message via AIM to KornBizkitNyAz
hey i for one say congrats iplaywithspoons! it helped the hell out of me but one thing i could never latch on to is drawer scripts. wanna do some good for a person? help me out.
KornBizkitNyAz is offline   Reply With Quote
Old 2nd January 2003, 20:33   #15
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
drawers drawers drawers

heyyyy, stickied...thats pretty cool. now, as requested:

these are one of the most used things that requires maki, but need to be customizable enough where a premade script just doesnt work the same. theyre also exceedingly easy to write. in this here ill show you how to setp up some basic drawers, and some other cool stuff you can do too.

lets start with a script i just wrote last night, but does something not most drawers dont:

code:

//----------------------------------------------------------------------
// eq.m
//
// controls drawer sliding and anything else i add later....
//
//----------------------------------------------------------------------

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

Global Container MainContainer;
Global Layout NormalLayout;
Global Group Equalizer;
Global Button Toggle, presets;
Global Togglebutton power, auto;
Global Layer buttonback;
Global Int B;

System.onScriptLoaded() {
MainContainer = getContainer("main");
Layout NormalLayout = System.getContainer("main").getLayout("normal");

Equalizer = NormalLayout.getObject("equalizer");
Toggle = Equalizer.getobject("toggle");
presets = Equalizer.getobject("presets");
power = Equalizer.getobject("power");
auto = Equalizer.getobject("auto");
buttonback = Equalizer.getobject("buttons.back");

B = 0;

}

Toggle.onLeftClick() {
if (B == 0) {
B = 1;
Equalizer.setTargetX(265);
Equalizer.setTargetY(13);
Equalizer.setTargetSpeed(0.5);
Equalizer.gotoTarget();
}
else if (B == 1) {
B = 0;
presets.setTargetY(111);
presets.setTargetSpeed(0.5);
presets.gotoTarget();
power.setTargetY(111);
power.setTargetSpeed(0.5);
power.gotoTarget();
auto.setTargetY(111);
auto.setTargetSpeed(0.5);
auto.gotoTarget();
buttonback.setTargetY(90);
buttonback.setTargetSpeed(0.5);
buttonback.gotoTarget();
}
}

Equalizer.onTargetReached() {
if (B == 1) {
presets.setTargetY(136);
presets.setTargetSpeed(0.5);
presets.gotoTarget();
power.setTargetY(136);
power.setTargetSpeed(0.5);
power.gotoTarget();
auto.setTargetY(136);
auto.setTargetSpeed(0.5);
auto.gotoTarget();
buttonback.setTargetY(115);
buttonback.setTargetSpeed(0.5);
buttonback.gotoTarget();
}
}

buttonback.onTargetReached() {
if (B == 0) {
Equalizer.setTargetX(112);
Equalizer.setTargetY(13);
Equalizer.setTargetSpeed(0.5);
Equalizer.gotoTarget();
}
}



ok, you should all know what the first part of that mess means by now. ive decalred the global int B so i know if the drawer is in or out. i set B = 0; at first, so i know 0 means its closed. you can have your toggle button inside or outside of the drawer group...in this case its inside

code:

Toggle.onLeftClick() {
if (B == 0) {
B = 1;
Equalizer.setTargetX(265);
Equalizer.setTargetY(13);
Equalizer.setTargetSpeed(0.5);
Equalizer.gotoTarget();
}



thats the heart of a drawer right there. its pretty self explanitory. when the user clicks the toggle button (which i declared and defined earlier), heres what happens: if B == 0 then the drawer is closed. i set B = 1 so the drawer is now considered open. Equalizer.setTargetY(13); means that the Equalizer group's new Y position will be ay 13 (in pixels) and Equalizer.setTargetX(265); means its new X position will be at 265. Equalizer.setTargetSpeed(0.5); is how fast the drawer will get there, 0 being that fastest, and slower the higher the number. we finish it off with Equalizer.gotoTarget();, telling the drawer to move to the set position at the set speed. that will always follow the most recently set numbers, so its good to keep the clustered. also , if your only moving your Y position, you dont need to setTargetX().


code:

Equalizer.onTargetReached() {
if (B == 1) {
presets.setTargetY(136);
presets.setTargetSpeed(0.5);
presets.gotoTarget();
power.setTargetY(136);
power.setTargetSpeed(0.5);
power.gotoTarget();
auto.setTargetY(136);
auto.setTargetSpeed(0.5);
auto.gotoTarget();
buttonback.setTargetY(115);
buttonback.setTargetSpeed(0.5);
buttonback.gotoTarget();
}
}



now, this is not nescessary to a drawer at all, but it shows a command that can be fun to use. the onTargetReached() command bascically says 'when the group is done moving...do this.". in this case, i have it so when the drawer is finished opening, i have a whole bunch of different things sliding down, without the user having to click or do anything...and it knows to do that only when the drawer is done opeining (and not done closing, because it only happens when B == 1)

that pretty much all for making a drawer script. here are some other commands you can use assoctiated with drawers:

setTargetW(x) // this can have your objects width change to what you set (in pixels)

setTargetH(x) // this can have your objects height change to what you set (in pixels)

setTargetA(x) // this can have your objects alpha change to what you set. alpha is transperency, so you can have a drawer fade in or out as it moves. a value between 0 - 255.
iPlayTheSpoons is offline   Reply With Quote
Old 2nd January 2003, 21:05   #16
KornBizkitNyAz
Member
 
KornBizkitNyAz's Avatar
 
Join Date: Nov 2002
Location: BKLYN WHAT WHAT!
Posts: 65
Send a message via AIM to KornBizkitNyAz
great thanks!
KornBizkitNyAz is offline   Reply With Quote
Old 3rd January 2003, 07:45   #17
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
Quote:
Originally posted by Russ
Does this forum really need another sticky? I spose if people find it useful - someone should set up a site with all this maki stuff on.

*stuck* (feel free to unstick if you think there's too much stickiness around )

www.skinarmory.com , i could post all the maki stuff there. Just pm if you want to..
Naamloos is offline   Reply With Quote
Old 3rd January 2003, 22:33   #18
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
sounds good....but you site seems to be borke a lot
iPlayTheSpoons is offline   Reply With Quote
Old 6th January 2003, 07:01   #19
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
how to compile a maki script

well, i just saw mc^^^^ refer someone to this thread on info on how to compile a script...so i figured id add a short thing for that. now, there are a number of ways to compile a script, but this is how i do it, and it works well for me:

1) first, go into your scripts folder (for this we'll say its C:\Program Files\Winamp3\Skins\MYSKIN\scripts\) and make a new .txt file called 'compile'.

2) put this as the only text in the document:

"C:\Program Files\Winamp3\mc.exe" "C:\Program Files\Winamp3\Skins\MYSKIN\scripts\MYSCRIPT.m"

change MYSKIN and MYSCRIPT to what you want it to be

3) change 'compile.txt' to 'compile.bat' (just a simple renaming of the file).

4) double click compile.bat and a DOS promt will open and quickly flash some text (the dissadvantage to this method is that if you get an error you wont get to see which one). as long as your scipt was written correctly, MYSCRIPT.maki will apear in your scripts folder. if it doesnt, go back to your.m and look for whats wrong

happy compiling
iPlayTheSpoons is offline   Reply With Quote
Old 9th January 2003, 01:18   #20
RephaiM
Senior Member
 
RephaiM's Avatar
 
Join Date: Jan 2003
Location: Bloomsburg, PA
Posts: 100
Send a message via ICQ to RephaiM Send a message via AIM to RephaiM
I never was good with C++... Tell me what doesn't look right here...

code:

//------------------------------------------------------------------------
// ldwr.m
//
// controls left drawer sliding
//
//------------------------------------------------------------------------

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

Global Container MainContainer;
Global Layout NormalLayout;
Global Group Drawer;
Global Button buttonback;
Global Int B;

System.onScriptLoaded() {
MainContainer = getContainer("main");
Layout NormalLayout = System.getContainer("main").getLayout("normal");

Drawer = NormalLayout.getObject("ldrawer");
buttonback = Drawer.getobject("ldwr.back");

B = 0;

}

buttonback.onLeftClick() {
if (B == 0) {
B = 1;
Drawer.setTargetX(0);
Drawer.setTargetSpeed(0.33);
Drawer.gotoTarget();
}
}

Drawer.onTargetReached() {
if (B == 1) {
buttonback.setTargetX(0);
buttonback.setTargetSpeed(0.33);
buttonback.gotoTarget();
}
}



It compiles as it is but I get an error (black and red box at the top of the screen) when I reload the skin with it.
RephaiM is offline   Reply With Quote
Old 9th January 2003, 04:48   #21
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
that means

MainContainer = getContainer("main");
Layout NormalLayout = System.getContainer("main").getLayout("normal");

Drawer = NormalLayout.getObject("ldrawer");
buttonback = Drawer.getobject("ldwr.back");

isnt matching up with your XML
iPlayTheSpoons is offline   Reply With Quote
Old 9th January 2003, 09:54   #22
RephaiM
Senior Member
 
RephaiM's Avatar
 
Join Date: Jan 2003
Location: Bloomsburg, PA
Posts: 100
Send a message via ICQ to RephaiM Send a message via AIM to RephaiM
I found a working example of a drawer and figured it out. Now I'm trying to get the balance and volume info in the songticker. Woo.
RephaiM is offline   Reply With Quote
Old 10th January 2003, 09:50   #23
RephaiM
Senior Member
 
RephaiM's Avatar
 
Join Date: Jan 2003
Location: Bloomsburg, PA
Posts: 100
Send a message via ICQ to RephaiM Send a message via AIM to RephaiM
Okay, I scrapped the balance and decided to have the volume not use the songticker but a bitmapfont -- or do you think making it animated would work better?
RephaiM is offline   Reply With Quote
Old 10th January 2003, 10:07   #24
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
please dont clutter this thread with questions and comments off topic (no one reads this to answer them anyway). try searching the forums for answers, and if you cant find them, start a new thread
iPlayTheSpoons is offline   Reply With Quote
Old 16th January 2003, 11:48   #25
J_Bloggs
Major Dude
 
J_Bloggs's Avatar
 
Join Date: Jan 2002
Posts: 1,778
Oh great wise one, could you teach us the ways of the advanced vis, a way to press xml buttons with maki, and if it's possible how to make our own events, such as onWinampInactive and onWinampActive?

(I'm asking this and I don't even understand the basics yet.)

¯¯¯¯Joe Bloggs____
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
J_Bloggs is offline   Reply With Quote
Old 16th January 2003, 16:26   #26
hammerhead
The Shark
(Forum King)
 
hammerhead's Avatar
 
Join Date: Jul 2002
Posts: 2,537
Send a message via AIM to hammerhead
JBloggs- maki only runs only while winamp is active, so thats the answer to your q.
I am right now making a script (fine not now, I've made a start tho) to toggle advanced visualizers.. its not really hard, when I've finished it I'll post it up here.
-hh
hammerhead is offline   Reply With Quote
Old 16th January 2003, 21:37   #27
J_Bloggs
Major Dude
 
J_Bloggs's Avatar
 
Join Date: Jan 2002
Posts: 1,778
I don't want to toggle them, (well I do but probably not how your going to do it), I want to know about them so I can make one for the left vu meter and another one for the right vu meter that works right, instead of adding them together.

So, when I click away from winamp MAKI stops working? damn, I want winamp to minimize when I click away from it.

¯¯¯¯Joe Bloggs____
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
J_Bloggs is offline   Reply With Quote
Old 16th January 2003, 22:41   #28
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
the quick answers:...ummm, its not true that maki stops working if you select another window. for example, drawers that operate with the onEnterArea command still work. to see if winamp is in focus, you use System.isAppActive(); and it returns a boolean 1 focused, 0 unfocused. combining this with a timer should allow you to do whatever it is you want to do. heres a mockup up of one way to do that

code:


System.onScriptLoaded(){

MainContainer = getContainer("main");
Layout NormalLayout = MainContainer.getLayout("normal");

ButtonsGroup = NormalLayout.getObject("Buttons");
MinimizeButton = NormalLayout.getobject("minimize");

minTimer = new Timer;
minTimer.setDelay(100);
minTimer.start();
}


minTimer.onTimer() {
if(System.isAppActive() == 0)
minimizebutton.LeftCLick();
}



something like that should do you fine

ill do a full on tut on how to do custom vis if hammer heads isnt what youre looking for.

Last edited by iPlayTheSpoons; 17th January 2003 at 00:46.
iPlayTheSpoons is offline   Reply With Quote
Old 17th January 2003, 04:59   #29
J_Bloggs
Major Dude
 
J_Bloggs's Avatar
 
Join Date: Jan 2002
Posts: 1,778
Would the container have to be open? I'm assuming no but I'll ask anyway.

Thank you very very much iPlayTheSpoons.

I still think active and inactive should be events.

¯¯¯¯Joe Bloggs____
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
J_Bloggs is offline   Reply With Quote
Old 17th January 2003, 05:13   #30
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
it doesnt need to be open, no
iPlayTheSpoons is offline   Reply With Quote
Old 17th January 2003, 10:36   #31
J_Bloggs
Major Dude
 
J_Bloggs's Avatar
 
Join Date: Jan 2002
Posts: 1,778
I've made it, now in true 'How to Write a MAKI Script' style, I'm going to try to explain it.

code:
#include


Include the all important std.mi, I've inclosed it in '<' and '>' because that includes it from the compliers path rather than the scripts, that way you only have to remember that one line and not figure out how many folders up you should go.


code:

Global Layout NormalLayout;
Global Button MinimizeB;
Global Timer minTimer;



these define every object you use, don't forget the ';' after each line.


code:


System.onScriptLoaded(){

Layout NormalLayout = getContainer("main").getLayout("normal");

MinimizeB = NormalLayout.getObject("minimize");

minTimer = new Timer;
minTimer.setDelay(100);
minTimer.start();
}



code:
System.onScriptLoaded(){

defines that the events and fuctions between the following '{' and '}' will happen when the script is loaded.

code:
Layout NormalLayout = getContainer("main").getLayout("normal");


this gets the layout normal in the container main, I could have used:
code:

MainContainer = getContainer("main")
Layout NormalLayout = MainContainer.getLayout("normal");


But the other way is shorter and sweeter, and gets rid of a Global line.

code:
MinimizeB = NormalLayout.getObject("minimize");


since maki doesn't have a minimize function, this gets a minimize button from a container to use instead. a dummy minimize button looks like this:

code:





No need for images or x&y, since the button won't be shown in the container anyway.


code:

minTimer = new Timer;
minTimer.setDelay(100);
minTimer.start();
}



this is the last peice of the System.onScriptLoaded() event. It sets up a timer, the timer that will be used to check wether winamp is active. It sets the delay to 100 milliseconds and starts the timer. This means it will run every 100 miliseconds.


code:

minTimer.onTimer() {
if(System.isAppActive() == 0)
MinimizeB.LeftClick();
}



This is the code that the timer triggers, it is outside the System.onScriptLoaded(), because it is a event of it's own, and it has it's own '{' and '}'.

It acts exactly as it reads, if the system active status equals 0 (false, not active) then run the following line of code. The then statment is implyed by the line not having a ';' at the end of it.
the line of code 'MinimizeB.LeftClick();' says find the MinimizeB object, and click the left mouse on it.





So there you have it, a long winded explanation of something you probaly already understood.


Oh and by the way, it's an add-on, and it has no openable containers.
Attached Files
File Type: zip minimize on inactive.zip (2.1 KB, 1240 views)

¯¯¯¯Joe Bloggs____
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
J_Bloggs is offline   Reply With Quote
Old 17th January 2003, 16:12   #32
hammerhead
The Shark
(Forum King)
 
hammerhead's Avatar
 
Join Date: Jul 2002
Posts: 2,537
Send a message via AIM to hammerhead
Quote:
ummm, its not true that maki stops working if you select another window
Well duh. I was talking about when winamp is off. Sorry, I probably misread the q.
hammerhead is offline   Reply With Quote
Old 17th January 2003, 22:49   #33
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
silly hammer head

hey, very cool JB. However, you might wanna think about adding some extra stuff to eliminate the CPU usage that timers can add.

im working on a custom vis tut, but im gunna be busy, so i might be a few days
iPlayTheSpoons is offline   Reply With Quote
Old 17th January 2003, 22:58   #34
Gonzotek
Gunslinger
 
Gonzotek's Avatar
 
Join Date: May 2000
Location: Terminus
Posts: 4,693
I don't think there's anything he could add to eliminate the use of a timer in this instance. There is no event for the app being made active/inactive, only a function to check the state. The timing could be longer, which would cause it to check less often and therefore may introduce a slightly longer delay than 100ms, but consider that anything under a 1000 is only a second anyway, so an acceptable number might be 500.

-=Gonzotek=-

I was away for a while.
But I'm feeling much better now.
Gonzotek is offline   Reply With Quote
Old 17th January 2003, 23:20   #35
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
wellllll, i dont know about that

you could have it stop the timer when it minimizes, then do on onEnterArea for a layer like the main BG or something else prominent start it up again. not the best solution, but its a possibility.
iPlayTheSpoons is offline   Reply With Quote
Old 18th January 2003, 09:38   #36
J_Bloggs
Major Dude
 
J_Bloggs's Avatar
 
Join Date: Jan 2002
Posts: 1,778
Yeah, but I'd like to keep it an add on, and not everyone uses the id="main" for their main window.

But, I am mainly doing this to learn maki, so I might give it idea a try.

I tryed a longer amount of time, the delay was kinda annoying.

I should also delete it when the script unloads.

¯¯¯¯Joe Bloggs____
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
J_Bloggs is offline   Reply With Quote
Old 9th February 2003, 09:35   #37
whatsitsname
Senior Member
 
whatsitsname's Avatar
 
Join Date: Nov 2002
Location: astralia
Posts: 386
in goodbye.m try changing
CloseButton.onLeftClick{
to
CloseButton.onLeftButtonDown
so that way it happens a bit before Winamp3 closes
whatsitsname is offline   Reply With Quote
Old 9th February 2003, 22:06   #38
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
i think you miss read the script...CloseButton doesnt actually close winamp, which i clarified up there...it starts a timer, so it changes the text to "GoodBye" for 5 second before tiggering another action. since there no maki command for close, youd have to have a hidden close button so that on timer, it gets clicked (which i didnt put into that script)

Last edited by iPlayTheSpoons; 9th February 2003 at 23:22.
iPlayTheSpoons is offline   Reply With Quote
Old 9th February 2003, 22:58   #39
eh?one
Senior Member
 
eh?one's Avatar
 
Join Date: Feb 2003
Location: canada, eh?
Posts: 296
in your batch file used for compiling you can add a pause line right after the command. that will cause the window to wait for a key press b4 it closes.
ie:
"C:\Program Files\Winamp3\mc.exe" "C:\Program Files\Winamp3\Skins\MYSKIN\scripts\MYSCRIPT.m"
PAUSE
eh?one is offline   Reply With Quote
Old 9th February 2003, 23:24   #40
iPlayTheSpoons
Major Dude
 
iPlayTheSpoons's Avatar
 
Join Date: Aug 2001
Location: SJSU
Posts: 1,030
Send a message via AIM to iPlayTheSpoons
that was mentioned in another thread after i put that up, but forgot to add it in here...woops, and thanks
iPlayTheSpoons is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Skinning and Design > Skinning Tips and Tricks

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 On

Forum Jump