Old 31st May 2003, 13:04   #1
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
Finding current mode on player startup

Hey everyone. Been a while since I've posted here. Here's my dilemma. I'm almost finished with my next Winamp 3 skin, but I can't get one thing to work. I need it to find out what mode the player is in on startup, to make the corresponding button active. Here's the code I have so far to try to do this, but it's not working. Can someone please help me to get this to work?
code:
System.onScriptLoaded()
{
main = getContainer("main");
panel = getContainer("panel").getLayout("normal");
mode1 = main.getLayout("mode1");
mode2 = main.getLayout("mode2");
mode3 = main.getLayout("mode3");
mini = main.getLayout("mini");
stick = main.getLayout("stick");
toggleMode1 = panel.findObject("panel.mode1.toggle");
toggleMode2 = panel.findObject("panel.mode2.toggle");
toggleMode3 = panel.findObject("panel.mode3.toggle");
toggleMini = panel.findObject("panel.mini.toggle");
toggleStick = panel.findObject("panel.stick.toggle");

if (mode1.isVisible()) {
toggleMode1.setActivated(true);
}
if (mode2.isVisible()) {
toggleMode2.setActivated(true);
}
if (mode3.isVisible()) {
toggleMode3.setActivated(true);
}
if (mini.isVisible()) {
toggleMini.setActivated(true);
}
if (stick.isVisible()) {
toggleStick.setActivated(true);
}
}

Joshuatree is offline   Reply With Quote
Old 31st May 2003, 14:21   #2
hammerhead
The Shark
(Forum King)
 
hammerhead's Avatar
 
Join Date: Jul 2002
Posts: 2,537
Send a message via AIM to hammerhead
Try this:
code:
System.onScriptLoaded()
{
main = system.getContainer("main");
panel = system.getContainer("panel").getLayout("normal");
mode1 = main.getLayout("mode1");
mode2 = main.getLayout("mode2");
mode3 = main.getLayout("mode3");
mini = main.getLayout("mini");
stick = main.getLayout("stick");
toggleMode1 = panel.getObject("panel.mode1.toggle");
toggleMode2 = panel.getObject("panel.mode2.toggle");
toggleMode3 = panel.getObject("panel.mode3.toggle");
toggleMini = panel.getObject("panel.mini.toggle");
toggleStick = panel.getObject("panel.stick.toggle");

if (mode1.isVisible() == 1) {
toggleMode1.setActivated(1);
} else if (mode2.isVisible() == 1) {
toggleMode2.setActivated(1);
} else if (mode3.isVisible() == 1) {
toggleMode3.setActivated(1);
} else if (mini.isVisible() == 1) {
toggleMini.setActivated(1);
} else if (stick.isVisible() == 1) {
toggleStick.setActivated(1);
}
}



It should work but I have not tried compiling.
hammerhead is offline   Reply With Quote
Old 31st May 2003, 18:58   #3
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
It looks like it should work, and it compiled fine. But it's just not doing anything.
Joshuatree is offline   Reply With Quote
Old 31st May 2003, 21:10   #4
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,388
The problem is that during the System.onScriptLoaded() method, none of the layouts are visible which is why you get nothing. Try using the System.onShowLayout(Layout _layout) method.
rpeterclark is offline   Reply With Quote
Old 3rd June 2003, 13:51   #5
-=RoNtZ=-
Major Dude
 
-=RoNtZ=-'s Avatar
 
Join Date: Feb 2002
Location: Universe > Milkyway > Sol > Earth > Europe > Germany > Bavaria > Near Nuremberg
Posts: 1,346
Send a message via ICQ to -=RoNtZ=- Send a message via AIM to -=RoNtZ=- Send a message via Yahoo to -=RoNtZ=-
hey josh!
what about a screenie of our next skin?

Frozen skins: Gravestone Betaskins: Mushroom ::-:: The Claw
In development: TechnodropFinished: Draculas Helmet (<-- still waiting for some color themes!) ::-:: Hal's eye
-=RoNtZ=- is offline   Reply With Quote
Old 4th June 2003, 19:50   #6
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
Well, there was a thread up about it a long time ago when I first started but I did't keep up with it very well. I'll start a new thread for the final release of the skin after it's finished...(soon I hope) But until then...I guess I'll keep you all in suspence.

[edit]
Don't expect anything very new and cool. The graphics were made a year ago.
[/edit]
Joshuatree is offline   Reply With Quote
Old 4th June 2003, 19:52   #7
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,388
Did you get your scripting problem solved?
rpeterclark is offline   Reply With Quote
Old 4th June 2003, 20:11   #8
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
Working on it as we speak

I had this already in the code:
code:
main.onSwitchToLayout(Layout newlayout) {
if (newlayout == mode1) {
toggleMode1.setActivated(true);
toggleMode2.setActivated(false);
toggleMode3.setActivated(false);
toggleMini.setActivated(false);
toggleStick.setActivated(false);
}


Should I add this also?
code:
main.onShowLayout(Layout mode1) {
toggleMode1.setActivated(true);
toggleMode2.setActivated(false);
toggleMode3.setActivated(false);
toggleMini.setActivated(false);
toggleStick.setActivated(false);
}

Joshuatree is offline   Reply With Quote
Old 4th June 2003, 20:31   #9
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
ok, it didn't work...infact, it even stopped what was working...i am so confused....here is my script as it is right now. Everything is working exept that the bottons aren't in the active state when the skin loads.
code:
#include "../../../../lib/std.mi"

Global Container main;
Global Layout mode1, mode2, mode3, mini, stick, panel;
Global Button toggleMode1, toggleMode2, toggleMode3, toggleMini, toggleStick;

System.onScriptLoaded()
{
main = system.getContainer("main");
panel = system.getContainer("panel").getLayout("normal");
mode1 = main.getLayout("mode1");
mode2 = main.getLayout("mode2");
mode3 = main.getLayout("mode3");
mini = main.getLayout("mini");
stick = main.getLayout("stick");
toggleMode1 = panel.getObject("panel.mode1.toggle");
toggleMode2 = panel.getObject("panel.mode2.toggle");
toggleMode3 = panel.getObject("panel.mode3.toggle");
toggleMini = panel.getObject("panel.mini.toggle");
toggleStick = panel.getObject("panel.stick.toggle");
}

toggleMode1.OnLeftClick() {
main.switchToLayout("mode1");
}

toggleMode2.OnLeftClick() {
main.switchToLayout("mode2");
}

toggleMode3.OnLeftClick() {
main.switchToLayout("mode3");
}

toggleMini.OnLeftClick() {
main.switchToLayout("mini");
}

toggleStick.OnLeftClick() {
main.switchToLayout("stick");
}

main.onSwitchToLayout(Layout newlayout) {
if (newlayout == mode1) {
toggleMode1.setActivated(true);
toggleMode2.setActivated(false);
toggleMode3.setActivated(false);
toggleMini.setActivated(false);
toggleStick.setActivated(false);
}
if (newlayout == mode2) {
toggleMode1.setActivated(false);
toggleMode2.setActivated(true);
toggleMode3.setActivated(false);
toggleMini.setActivated(false);
toggleStick.setActivated(false);
}
if (newlayout == mode3) {
toggleMode1.setActivated(false);
toggleMode2.setActivated(false);
toggleMode3.setActivated(true);
toggleMini.setActivated(false);
toggleStick.setActivated(false);
}
if (newlayout == mini) {
toggleMode1.setActivated(false);
toggleMode2.setActivated(false);
toggleMode3.setActivated(false);
toggleMini.setActivated(true);
toggleStick.setActivated(false);
}
if (newlayout == stick) {
toggleMode1.setActivated(false);
toggleMode2.setActivated(false);
toggleMode3.setActivated(false);
toggleMini.setActivated(false);
toggleStick.setActivated(true);
}
}

Joshuatree is offline   Reply With Quote
Old 4th June 2003, 20:44   #10
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,388
You're getting closer!

Try changing
code:

main.onSwitchToLayout(Layout newlayout)



to

code:

System.onSwitchToLayout(Layout newlayout)

rpeterclark is offline   Reply With Quote
Old 4th June 2003, 21:20   #11
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
It won't compile...it says "onSwitchToLayout : not an member function nor an event of class 'System'"
Joshuatree is offline   Reply With Quote
Old 4th June 2003, 21:27   #12
rpeterclark
Major Dude
(Reviewer)
 
rpeterclark's Avatar
 
Join Date: Aug 2002
Location: South Florida
Posts: 1,388
You're right, I'm sorry. It should have read:

code:

System.onShowLayout(Layout newlayout)

rpeterclark is offline   Reply With Quote
Old 5th June 2003, 18:06   #13
Joshuatree
Major Dude
 
Joshuatree's Avatar
 
Join Date: Dec 2001
Location: Buffalo NY
Posts: 635
Send a message via AIM to Joshuatree
It worked. I just changed Sytem.onSwitchToLayout to System.onShowLayout and now it works. Thank you so much. I'll make a new thread for this skin when I find time. (probably tomarrow)

Thanks Again
- JoshuaTree
Joshuatree is offline   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