Go Back   Winamp Forums > Skinning and Design > Modern Skins

Reply
Thread Tools Search this Thread Display Modes
Old 20th August 2003, 16:29   #1
Alfalover
Junior Member
 
Join Date: Aug 2003
Posts: 6
please anyone knows how to declare and use array's in Maki ?

mi work is stoped, i am scripting, and i don't know how to declare and use arrays, i tried ANSI c/c++ form but don't work.

a lot of thanks.
Alfalover is offline   Reply With Quote
Old 20th August 2003, 16:32   #2
hammerhead
The Shark
(Forum King)
 
hammerhead's Avatar
 
Join Date: Jul 2002
Posts: 2,537
Send a message via AIM to hammerhead
I don't think you can.
You can however use strings, like:

PHP Code:
#include "lib/std.mi"

Global String myCoolString;
Global 
Text myText;

system.onScriptLoaded(){
myText system.getScriptGroup().getObject("text");
myCoolString "See, you can use strings!";
myText.setText(myCoolString);

hammerhead is offline   Reply With Quote
Old 20th August 2003, 16:38   #3
Alfalover
Junior Member
 
Join Date: Aug 2003
Posts: 6
yes this for use a text control in skin.. but supose you want to do a list(array) of int o list(array) of strings.

in ansi c yo can do :

int numbers[20];


and after in middle of the code

numbers[3] = 3;

maki don't have support for array's ? or witch is the correct sintax for do this ?
Alfalover is offline   Reply With Quote
Old 20th August 2003, 22:09   #4
Bizzeh
Forum Pirate
Beta Team
 
Bizzeh's Avatar
 
Join Date: Oct 2001
Posts: 2,032
maki is all virtual... string in float and all the other stuff are auto-variable length values... you just declair

Global Int myInt;
Global String myString;

and that sort of stuff.. i dont think maki suports arrays as it stands.. but i think its one of the things soon to be done
Bizzeh is offline   Reply With Quote
Old 21st August 2003, 03:31   #5
Alfalover
Junior Member
 
Join Date: Aug 2003
Posts: 6
I did a curious type of array, with xml and maki, i store data in text:

<text id="acurious.array.0" default="this is item 0" ... />

and call his id's like : id="acurious.array.0" ... id="acurious.array.25"

after you can access default property using getxmlparam or setxmlparam like:

Global text atextvar;
Global int index;
Global string_to_save;

atextvar = getscriptgroup().getitem("acurious.array."+integertostring(index));

atextvar.setxmlparam("default",string_to_save);

big problem , curious solve
Alfalover is offline   Reply With Quote
Old 22nd August 2003, 13:53   #6
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,387
The closest thing to an array in MAKI is the list class:
http://www.winamp.com/nsdn/winamp3x/...lass_List.html

What's nice about it is that it can hold any type of variable or object.
rpeterclark is offline   Reply With Quote
Old 22nd August 2003, 17:44   #7
hammerhead
The Shark
(Forum King)
 
hammerhead's Avatar
 
Join Date: Jul 2002
Posts: 2,537
Send a message via AIM to hammerhead
Quote:
Originally posted by rpeterclark
The closest thing to an array in MAKI is the list class:
http://www.winamp.com/nsdn/winamp3x/...lass_List.html

What's nice about it is that it can hold any type of variable or object.
Thanks for the link I had heard of lists but didn't have any info on them.
I don't understand why you need an array though, Maki isn't a dynamic web-language, it's just the scripting language of a media player.
hammerhead is offline   Reply With Quote
Old 22nd August 2003, 18:42   #8
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,387
Ah, I just remembered something else that might be useful in this case, the System.getToken(string str, string separator, int tokennum) method:
http://www.winamp.com/nsdn/winamp3x/...System.html#69

With it, you can have a string with some type of value delimeters in in, then use that method to get at a certain one. There's no enumeration though unless you know, or figure out, how many values the string holds and for loop through it.

By using more than one type of delimeter, you can simulate multi-dimensional arrays. Of course, this only works with string values.

HH, it's nice that they kind of give us that functionality in case we ever need it!
rpeterclark 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