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 12-11-2011, 05:29 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Music not playing

It's really weird, because this just wont work...

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.saljiut = { 
    
"roak_bd03.nw"
  
};
  
  
temp.swampofrumug = { 
    
"roak_bb08.nw""roak_bb09.nw"
  
};
  
  
temp.southwestforest = {
    
"roak_ap06.nw""roak_ap07.nw"
  
};
  
temp.onlinestart "armageddon-onlinestart.nw";
}
function 
onPlayerEnters() {
    if (
player.level.name in temp.saljiut) {  
      
playlooped("roak-abyss.mid");
    }
    else if (
player.level.name in temp.lystra) {  
      
playlooped("roak-towntheme2.mid");  
    }
    else if (
player.level.name == temp.onlinestart){
      
playlooped("armageddon-onlinestart.mid");
    }
    else if (
player.level.name in temp.southwestforest){
      
playlooped("roak1.mid");
    }
    else if (
player.level.name in temp.swampofrumug){
      
playlooped("roak1.mid");
    }  

I've always done music this way. This also used to work before but now it just doesn't play anything.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


Reply With Quote
  #2  
Old 12-11-2011, 05:42 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
Temp. variables last temporarily until the function process ends, you'd need to store those arrays as this. variables as the temp. vars would only exist within the onCreated function.

It would also be somewhat cleaner to just create one multi-dimensional array to loop through and check the condition as opposed to having multiple if conditions.
A check to prevent the playloop function occurring if the file is already playing when you enter a level is also good to avoid a very slight client pause this can cause.
Reply With Quote
  #3  
Old 12-11-2011, 05:53 PM
sssssssssss sssssssssss is offline
Cyril Rain
sssssssssss's Avatar
Join Date: May 2003
Location: Texas, USA
Posts: 1,134
sssssssssss will become famous soon enough
Can't believe i didnt catch the temp.vars. Appreciate the advise as well, going to implement it soon.
__________________
Cyril Rain
Creator and leader of SLX
Admin of Elysium
Elysium's Facebook Page: http://facebook.com/GraalOnlineElysium
Graal Forum Thread: http://forums.graalonline.com...
Graalians Thread: http://www.graalians.com...


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 04:45 AM.


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