Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-11-2007, 02:36 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #2  
Old 04-11-2007, 02:38 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Screenies please?
Reply With Quote
  #3  
Old 04-11-2007, 03:04 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Sure.
Attached Thumbnails
Click image for larger version

Name:	Picture 2.png
Views:	326
Size:	29.9 KB
ID:	40528   Click image for larger version

Name:	Picture 3.png
Views:	370
Size:	188.0 KB
ID:	40529   Click image for larger version

Name:	Picture 4.png
Views:	303
Size:	33.3 KB
ID:	40530  
__________________
Reply With Quote
  #4  
Old 04-11-2007, 06:43 AM
Novo Novo is offline
[TServerDeveloper]
Join Date: Jun 2006
Posts: 448
Novo will become famous soon enough
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]" 
Reply With Quote
  #5  
Old 04-12-2007, 12:51 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
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.
__________________
Reply With Quote
  #6  
Old 08-24-2009, 03:59 PM
pez307 pez307 is offline
ImThatGuy
pez307's Avatar
Join Date: Apr 2007
Posts: 58
pez307 is an unknown quantity at this point
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
__________________
Cm*
Reply With Quote
  #7  
Old 08-24-2009, 04:09 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by pez307 View Post
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
__________________
Reply With Quote
  #8  
Old 08-24-2009, 06:15 PM
salesman salesman is offline
Finger lickin' good.
salesman's Avatar
Join Date: Nov 2008
Location: Colorado
Posts: 1,865
salesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud ofsalesman has much to be proud of
do you have //#CLIENTSIDE at the top?
Reply With Quote
  #9  
Old 08-25-2009, 01:09 PM
pez307 pez307 is offline
ImThatGuy
pez307's Avatar
Join Date: Apr 2007
Posts: 58
pez307 is an unknown quantity at this point
Nice jukebox Chris
__________________
Cm*
Reply With Quote
  #10  
Old 08-25-2009, 03:29 PM
Mark Sir Link Mark Sir Link is offline
Kevin Azite
Mark Sir Link's Avatar
Join Date: Sep 2005
Posts: 1,489
Mark Sir Link is just really niceMark Sir Link is just really nice
Send a message via AIM to Mark Sir Link
Quote:
Originally Posted by cbk1994 View Post
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
Reply With Quote
Reply


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


All times are GMT +2. The time now is 11:08 PM.


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