Old 11th March 2002, 22:26   #1
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
AutoRepeatButton Library

Ok,

Now you can add autorepeating buttons to your skins/scripts as easy as pie, with this library.

It's dead simple to use, all you have to do is this:
code:
#include "../../../lib/std.mi"
#include "../../../lib/AutoRepeatButton.m"

Global AutoRepeatButton MyButton;

System.OnScriptLoaded() {
AutoRepeat_Load();
MyButton = getContainer("MyContainer").getLayout("MyLayout").getObject("MyButton");
}

System.OnScriptUnloading() {
AutoRepeat_Unload();
}

MyButton.OnLeftClick() {
if(AutoRepeat_ClickType != 0) {
/* insert code which will be run when the button
autorepeats or is clicked */
}
}

You can use it with as many buttons as you like, just add them as you'd expect. Can't say fairer than that can I?
Download Here

Included also in this is an example script, shows it being used in a nokia-like volume up/down toggle.

Enjoy!
Will

[edit: updated download location]

DO NOT PM ME WITH TECH SUPPORT QUESTIONS

Last edited by will; 3rd October 2002 at 18:58.
will is offline   Reply With Quote
Old 12th March 2002, 05:52   #2
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
Sexay, is all I have to say, but I could figure it out myself I think
Naamloos is offline   Reply With Quote
Old 12th March 2002, 08:51   #3
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
Mirrored here (in NSIS Exe format)
http://www.angelfire.com/pa5/hollowearth/autolib.exe

thanks Hollowearth

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 12th March 2002, 10:11   #4
Nini
skin domptrice
(Major Dudette)
 
Nini's Avatar
 
Join Date: May 2001
Location: Tatooine
Posts: 2,270
Send a message via ICQ to Nini Send a message via AIM to Nini
remote linking doesn't work...
Nini is offline   Reply With Quote
Old 12th March 2002, 10:13   #5
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
try this one: http://www21.brinkster.com/willfishe...tButtonLib.zip
u might have to right click and save target as

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 12th March 2002, 14:41   #6
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
put a "?" at the end of the angelfire link and then it will work. could you perhaps edit that post will?

The moon is made of cheese.
Oh for some tasty moon cheese.
www.redtetrahedron.org
Hollow is offline   Reply With Quote
Old 12th March 2002, 14:44   #7
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
Quote:
Originally posted by HollowEarth
put a "?" at the end of the angelfire link and then it will work. could you perhaps edit that post will?
no, its past the 180mins limit.
try this
[edit]that doesn't work. use the brinkster link in the original post[/edit]

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 12th March 2002, 18:28   #8
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
Naamloos- Figuring it out on your own isnt really the point. The functions will be done almoat identically on every skin that has them so there is no reason that the code should be recreated every time its needed. It also maked scripting easier for people who many not be very good at it. There is no reason that a library of code extentions for maki shouldnt be avalible through nsdn someday. this is the sort of thing that should be in there. This is the reason (at least in my mind) that lucas's volume example is done as a skin specific file and the volume file The whole reason that i even suggested this was because i had rewritten the code for volume up/down and +-5 seconds and then realized that i shouldnt really need to since i had been done before. (will had more effient code, in Nokia, so hence why this code is his and not mine)

The moon is made of cheese.
Oh for some tasty moon cheese.
www.redtetrahedron.org
Hollow is offline   Reply With Quote
Old 12th March 2002, 18:38   #9
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
Yeah I know, when I first looked at the topic I though, a library woah! , but then i felt disappointed

But yes, this is good for beginning scripters
Naamloos is offline   Reply With Quote
Old 12th March 2002, 19:06   #10
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
Quote:
Originally posted by Naamloos
Yeah I know, when I first looked at the topic I though, a library woah! , but then i felt disappointed

But yes, this is good for beginning scripters
I was thinking whether to call it ia library, but Luc called all his stuff in /lib librarys (and lib stands for library after all). But as i wrote in my (wholly self indulgent) .plan earlier today
Quote:
You see, if i may relate code with art, an artist is offended by bad art. I as a coder am offended by poor coding. Therefore, it is in my interest to make stuff like this to make the community as a whole put out better stuff that has been more easily coded. Because, lets be honest, the coding is something in 99% of skins of a very low priority (not withstanding blobamp), and the artists just want it to work.
This lib is for everyone, to speed up the coding. If someone else has written this before i started doing nokia, i would have used it. because there is absolutly no point in reinventing the wheel.

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 12th March 2002, 19:39   #11
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
What do I have these days, I can't even read posts good

I just reread your code, and I saw that line
code:

#include "../../../lib/AutoRepeatButton.m"



I did not saw that line and I thought that the code here is that lib.
Sorry man, I just downloaded it and its


It is a lib


I'm off to gain some energy and drink some coffee if that helps
Naamloos is offline   Reply With Quote
Old 12th March 2002, 19:42   #12
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
Quote:
Originally posted by Naamloos
I'm off to gain some energy and drink some coffee if that helps
yay for caffene!!

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 13th March 2002, 05:45   #13
Naamloos
Forum King
 
Naamloos's Avatar
 
Join Date: Mar 2001
Location: irc.tehflap.org/*******
Posts: 3,085
Quote:
Originally posted by willfisher
yay for caffene!!
I don't drink it too much, cause the nasty aftertaste (I don't like that one, nor my gf ) only when it's late and I can't concentrate
Naamloos is offline   Reply With Quote
Old 3rd October 2002, 18:56   #14
will
Nullsoft Newbie (Moderator)
 
will's Avatar
 
Join Date: Mar 2001
Location: Sheffield, England
Posts: 5,569
Updated: now has:
Function AutoRepeat_SetSpeedUpFactor(float mschange);
Function Float AutoRepeat_GetSpeedUpFactor();

These make it so that as you hold down the autorepeat button, the autorepeast speeds up as you hold it down for longer.

This currenly is linear only, however i might make a more natural non-linear mode.

It is by default 0, i.e. no change, but i recommend 0.05 for a volume button.

Download:
Attached Files
File Type: zip autorepeatbutton.zip (18.0 KB, 1317 views)

DO NOT PM ME WITH TECH SUPPORT QUESTIONS
will is offline   Reply With Quote
Old 13th November 2002, 21:42   #15
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
Hi will, thanks for the script (found this thread in your sig), the only thing is the Zip is corrupt - could you re-attach it pls, or is it just me that gets the error?

Also I'd love a script that works for the 5secs ff & rewind, but changes to next/prev on a single click, is there one around like that?
ziege is offline   Reply With Quote
Old 13th November 2002, 23:25   #16
Digitalhigh
Guest
 
Posts: n/a
How would one use this in conjunction with a seek button? Similar to back forward on one click, but if you hold it down, it seeks back/forth in the current song. Like some CD players...
  Reply With Quote
Old 14th November 2002, 00:33   #17
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 you need to get a copy of the library, this will likely have to wait since the zip is corupt.

however once you have it both of you can do what you want with ease. (since what you both want to do is the same thing, merely worded differently)

You have the click type to work with. So:
code:

Global AutoRepeatButton Fwd5Secs;
Global Boolean LBSingleClick = 0;

Fwd5Secs.onLeftClick()
{
if(AutoRepeat_ClickType != 0) //filter erronious clicks
{
if(AutoRepeat_ClickType == 1) //The first click
{
LBSingleClick = 1;
}
else if(AutoRepeat_ClickType == 2) //All the subsequent clicks
{
LBSingleClick = 0;
//Do all subsequent click stuff here
}
}
}

Fwd5Secs.onLeftButtonUp(int x,inty)
{
if(LBSingleClick == 1)
System.next();
LBSingleClick == 0;
}



No I'm not going to post more complete code, you should learn some too.

I can tell you this since I have a copy of the older version. I'm not going to post it, though, since its Will's.

The moon is made of cheese.
Oh for some tasty moon cheese.
www.redtetrahedron.org
Hollow is offline   Reply With Quote
Old 14th November 2002, 01:41   #18
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
OK thanks, I'll give it a try when I can get the zip.

About learning code... Somebody asked this a few days ago - is there anything we can read to learn? I've got e-books on Visual C++ and I've gone through a couple of chapters before my head explodes when it gets too difficult, MAKI looks very similar to me - would it help if I learnt C or C++ first? Or do you know any docs for learning how to code MAKI for beginners? I hate having to ask for scripts so I usualy just lurk and grab what I can, but I'd be willing to learn if the resources are out there. At the moment for me, and I'm sure for lots of other artists, MAKI scripts just look like a bunch of letters & digits. The XML is okay since I know HTML pretty good, it's very similar, but I think it'll be a *long* time before I can write my own MAKI scripts.
ziege is offline   Reply With Quote
Old 14th November 2002, 04:17   #19
Digitalhigh
Guest
 
Posts: n/a
Read std.mi. It's the (main) definition file for classes and methods in MAKI. If you've looked at C++ guides and stuff, then you'll have a rough idea of how it works. I figured out a rough bit of MAKI from knowing Visual Basic, it's not too tough. Just know that there are two different "things" in programming, classes and methods. A class is a fancy name for some object, where an object is a button, slider, layer, timer, group, layout, etc. Anything that has the tag ID="" can prettymuch be an object. A method is the other half of the works. A method is an action or behaviour of an object. The typical syntax for declaring this is "object.method". Confusing? Say you've got a layer called "Syslayer1" that you want to hide when it's clicked by the mousebutton. The code to make it hide would be

Syslayer.onleftbutton()[
Syslayer.hide()
]

This is a bad example, but if you look in std.mi for the .onleftbutton() and .hide() commands, you'll see how they're used. Hopefully, you get a little better idea from this rambling.
  Reply With Quote
Old 14th November 2002, 15:21   #20
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
Hmm, std.mi looks liek a good reference for ppl that can already code, but I meant something written in english for non-programmers. I read through what you said tho, and some of what I read about C++ has come back... so the example you gave is kinda like:

TheThingToControl.TheInputCommand(Arguments) //if that happens then execute the bit in brackets below
{ TheThingToControl.MakeItDoThis(Arguments) }

And I guess you need to declare variables that you want to use first, hmmm well I guess after I've looked at 600 scripts I'll start to pick it up better. Thanks btw
ziege is offline   Reply With Quote
Old 14th November 2002, 18:20   #21
Digitalhigh
Guest
 
Posts: n/a
By jove, I think he's got it. I don't think you'll need to look at all of 600 scripts, just check out the ones in Frisbee's MAKI skin. That's one great place to learn the basics. Also, remember, when trying to declare your objects, using the

mygroup = getscriptgroup()

command is a lot easier than defining it as

mygroup = system.getcontainer("main").getlayout("normal").findobject("mygroup")

If you look at a few scripts, you'll see the difference. And yes, the std.mi file looks intimidating, but try looking up some of the methods (.MakeItDoThis(Arguements) that you see in scripts. It gives the explanations for them, as well as variations you can use. Don't give up, it's easier than it looks.
  Reply With Quote
Old 14th November 2002, 19:10   #22
ziege
Senior Member
 
ziege's Avatar
 
Join Date: Oct 2002
Location: UK
Posts: 363
I think I was reading more into the process than there actually is, it's not quite as difficult as I thought. Hehe I've already nicked all the scripts from the MAKI skin My own skin has 24 scripts so far, so I've got plenty to look through & learn from, but I'd love to add something that no-one else has done yet HUGE thanks for the help DH!
ziege is offline   Reply With Quote
Old 15th November 2002, 00:55   #23
Digitalhigh
Guest
 
Posts: n/a
The next big trick is to condense all 24 scripts into a few. When you know the scripts enough to put them together, you're safely on your way to scripting. Good luck.
  Reply With Quote
Reply
Go Back   Winamp & Shoutcast 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