Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 02-24-2006, 03:29 AM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
music script dosent work suddenly

Script worked fine for weeks.
Then one day it didn't.
It dosent work today either after full pc reboot.
what happened to graal to make this not work?
mp3's load in urls/

PHP Code:
//#CLIENTSIDE
function onCreated()
{
this.url="http://my.url.here/folder/";  //actual url unimportant
this.playlist={"song1.mp3","song2.mp3"};
}

function 
onPlayerchats()
  {
   if (
player.chat=="/playlist")
    {
     
player.chat="Playlist has "this.playlist.size() @ " songs in it.";
    }
    
   if (
player.chat=="/playmusic")
    {
      for (
this.i=0this.i<this.playlist.size(); this.i++) 
      {
        
this.song=this.url@this.playlist[this.i];
        
play(this.song);
        
this.songlength=int(musiclen/1000);
        
player.chat="Now playing: "@this.playlist[this.i]@" : "@this.songlength;
        
sleep(this.songlength);
      }
    }
    
   if (
player.chat=="/playrandom")
    {
      for (
this.j=0this.j<this.playlist.size(); this.j++) //for as many songs in list
      
{
      
this.i=int(random(0,this.playlist.size()));  // choose a random song
      
this.song=this.url@this.playlist[this.i];
      
play(this.song);
      
this.songlength=int(musiclen/1000);
      
player.chat="Now playing: "@this.playlist[this.i]@" : "@this.songlength@" seconds";
      
sleep(this.songlength);
      }    
    }

   if (
player.chat=="/stopmusic")
    {
     
stopmidi;
     
player.chat="music stopped";
    }
    
 } 
no sound for random play
no sound for playlist play
display says 0 seconds in the song length.
what changed in gs2 or game client?!?!?!?!?!
Reply With Quote
  #2  
Old 02-24-2006, 06:28 AM
ZeLpH_MyStiK ZeLpH_MyStiK is offline
Scripter
ZeLpH_MyStiK's Avatar
Join Date: May 2003
Location: NYC
Posts: 553
ZeLpH_MyStiK is on a distinguished road
Send a message via MSN to ZeLpH_MyStiK Send a message via Yahoo to ZeLpH_MyStiK
Maybe it's the file host. =O
__________________
Reply With Quote
  #3  
Old 02-24-2006, 06:46 AM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
nope. as stated above files are hosted correctly and the URL string is formed correctly in the script. Paste the url into a webbrowser, i get music. Nothing changed in the file host or npc. Graal had an update then it stopped working.
Reply With Quote
  #4  
Old 02-24-2006, 02:56 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
Try using a timeout to check whether the end of the song has been reached instead of using sleep() with the length of the song.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
Reply With Quote
  #5  
Old 02-26-2006, 02:10 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
It is possible that the music is not directly started and it first needs to contact the web server. With the new update the game is not freezing/waiting anymore until the music stream is started, so musiclen might be zero if you call it directly after starting the stream.
Reply With Quote
  #6  
Old 02-26-2006, 08:10 PM
Prozac Prozac is offline
one of the good guys
Prozac's Avatar
Join Date: Jan 2006
Posts: 245
Prozac is on a distinguished road
Send a message via AIM to Prozac
Thank you Stefan!
Placing a delay between the play command and the check for musiclen fixed it.
Reply With Quote
  #7  
Old 02-27-2006, 03:23 PM
ApothiX ApothiX is offline
Okiesmokie
Join Date: May 2004
Posts: 1,447
ApothiX is on a distinguished road
I still think you should use a timeout to check for that instead of sleep.
__________________


[06:24:19] * Parts: Skyld (i=silent@unaffiliated/skyld) ("Perhaps Okiesmokie did not realise that I like the boys. ")
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 06:05 AM.


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