Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   Code Gallery (https://forums.graalonline.com/forums/forumdisplay.php?f=179)
-   -   Jukebox (https://forums.graalonline.com/forums/showthread.php?t=73425)

cbk1994 04-11-2007 02:36 AM

Jukebox
 
This is the Jukebox I made, many have requested the script, so I decided to release it to the public. Very simple, very easy to modify. If you use it, please if anyone asks give them the script. If you modify it (besides adding music), you can just give them the link to this, rather than the modified version.

Could probably be modded to play internet radio stations.

PHP Code:

//#CLIENTSIDE
function onCreated()
{
  
showJukebox();
}
function 
onKeyPressedcodekey )
{
  if ( 
key == "r" )
  {
    
setTimer0.05 );
    
Jukebox_Window.visible Jukebox_Window.visible 1;
    
GraalControl.makeFirstRespondertrue );
  }
}
function 
onWeaponFired()
{
  
say2"Press 'r' to toggle jukebox!" );
}
function 
showJukebox()
{
  
playing this.playing;
  
Jukebox_Window.destroy();
  new 
GuiWindowCtrl"Jukebox_Window" )
  {
    
profile "GuiBlueWindowProfile";
    
width 280;
    
height 120;
    
screenwidth width;
    
screenheight height;
    
canClose canMinimize true;
    
canMaximize canResize false;
    
visible false;
    
text "Jukebox for" SPC servername;
    
useownprofile true;
    
profile.transparency .9;
    new 
GuiMLTextCtrl"Jukebox_Text" )
    {
      
profile "GuiBlueTextProfile";
      
10;
      
30;
      
width 270;
      
height 20;
      
useownprofile true;
      
profile.align "center";
      
text "<center>Now playing:" SPC playing;
    }
    new 
GuiPopUpMenuCtrl"Jukebox_List" )
    {
      
profile "GuiBluePopUpMenuProfile";
      
width 260;
      
height 20;
      
10;
      
50;
      
textprofile "GuiBlueTextListProfile";
      
scrollprofile "GuiBlueScrollProfile";
      
clearRows();
      
temp.music = {
      { 
"SONG_NAME""SONG_URL" },
      { 
"SONG2_NAME""SONG2_URL" } ;
      for ( 
temp.0temp.temp.music.size(); temp.++ )
      {
        
withaddRow0temp.music[temp.i][0] ) )
        {
          
this.var = temp.music[temp.i][1];
        }
      }
      
setSelectedRow);
      
sort();
    }
    new 
GuiButtonCtrl"Jukebox_Stop" )
    {
      
profile "GuiBlueButtonProfile";
      
width 75;
      
height 30;
      
Jukebox_Window.width - ( width );
      
Jukebox_Window.height 40;
      
text "Stop Music";
    }
  }
  
stopmidi();
  
this.playing "[None]";
  
Jukebox_Text "Now playing: [None]";
}
function 
onTimeOut()
{
  
this.time += .05;;
  
setTimer0.05 );
}
function 
Jukebox_Stop.onAction()
{
  
stopmidi();
  
this.playing "[None]";
  
Jukebox_Text "Now playing: [None]";
}
function 
Jukebox_List.onSelect()
{
  if ( 
this.time )
  {
  
this.playing params[1];
  
Jukebox_Text.text "Now playing:" SPC params[1];
  
playJukebox_List.rows[params[2]].var );
  }
}
function 
onPlaytitlesong )
{
  
this.playing title;
  
Jukebox_Text.text "Now playing:" SPC title;
  
playsong );


Please leave feedback, my first released script.

Rapidwolve 04-11-2007 02:38 AM

Screenies please?

cbk1994 04-11-2007 03:04 AM

3 Attachment(s)
Sure.

Novo 04-11-2007 06:43 AM

PHP Code:

    Jukebox_Window.visible Jukebox_Window.visible 1

Should be one of the following:

PHP Code:

Jukebox_Window.visible = !Jukebox_Window.visible
Jukebox_Window.visible Jukebox_Window.visible
Jukebox_Window.visible = (Jukebox_Window.visible 1)%2;
Jukebox_Window.visible = (Jukebox_Window.visible == true false true ); 

The timer has no purpose: It seems like it is an overkill.

PHP Code:

if ( this.time 

could be
PHP Code:

if ( this.playing != "[None]" 


cbk1994 04-12-2007 12:51 AM

Thanks for saying 'Nice code' or 'thanks!'. There's nothing wrong with the visible, the timer use to do something else which I removed for public release.

pez307 08-24-2009 03:59 PM

Nice, but i get errors.



Script compiler output for Player/Jukebox:
error: unexpected token: ; at line 59: { "SONG2_NAME", "SONG2_URL" } ;
Weapon/GUI-script Player/Jukebox added/updated by pez307
Script: Function Jukebox_Window.destroy not found at line 22 in script of Player/Jukebox
Script: Function addcontrol not found at line 36 in script of Player/Jukebox
Script: Function setSelectedRow not found at line 67 in script of Player/Jukebox
Script: Function sort not found at line 68 in script of Player/Jukebox
Script: Function addcontrol not found at line 47 in script of Player/Jukebox
Script: Function addcontrol not found at line 70 in script of Player/Jukebox
Script: Function addcontrol not found at line 23 in script of Player/Jukebox
Script: Function stopmidi not found at line 80 in script of Player/Jukebox

Help please? :P

Chompy 08-24-2009 04:09 PM

Quote:

Originally Posted by pez307 (Post 1518151)
Nice, but i get errors.



Script compiler output for Player/Jukebox:
error: unexpected token: ; at line 59: { "SONG2_NAME", "SONG2_URL" } ;
Weapon/GUI-script Player/Jukebox added/updated by pez307
Script: Function Jukebox_Window.destroy not found at line 22 in script of Player/Jukebox
Script: Function addcontrol not found at line 36 in script of Player/Jukebox
Script: Function setSelectedRow not found at line 67 in script of Player/Jukebox
Script: Function sort not found at line 68 in script of Player/Jukebox
Script: Function addcontrol not found at line 47 in script of Player/Jukebox
Script: Function addcontrol not found at line 70 in script of Player/Jukebox
Script: Function addcontrol not found at line 23 in script of Player/Jukebox
Script: Function stopmidi not found at line 80 in script of Player/Jukebox

Help please? :P


The temp.music array is missing an ending bracet (:
Put a '}' instead of the space between } and ; at line 59

salesman 08-24-2009 06:15 PM

do you have //#CLIENTSIDE at the top?

pez307 08-25-2009 01:09 PM

Nice jukebox Chris ;)

Mark Sir Link 08-25-2009 03:29 PM

Quote:

Originally Posted by cbk1994 (Post 1299242)
thanks for saying 'nice code' or 'thanks!'. There's nothing wrong with the visible, the timer use to do something else which i removed for public release.

lol


All times are GMT +2. The time now is 07:10 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.