xXziroXx
06-27-2008, 02:21 AM
A script that controls what song is played, and when.
//#CLIENTSIDE
function onCreated()
{
this.songList = new TStaticVar();
/*
this.songList.SONGNAME = { ARG1,
{ ARG2 }
};
ARG1 = determines if the song should stop playing when
the players level name isn't in ARG2.
ARG2 = an array with the levels the song should be played
on, or what the level name should begin with.
~~~ EXAMPLE ~~~
this.songList.("My Song Name") = { false,
{ "mylevelname.nw", "mylevelname2.nw", "my_gmap_" }
};
*/
}
function onPlayerEnters()
{
temp.songList = this.songList.getDynamicVarNames();
for (temp.song: temp.songList) {
temp.data = this.songList.(@temp.song);
temp.song = temp.song @ ".mp3";
temp.file = getmusicfilename();
// Is temp.data[1] the players current level?
if (player.level.name in temp.data[1]) {
if (fileExists(temp.song)) playlooped(temp.song);
}
// Ah well... is the player on a gmap, or does temp.data[1]
// contain what the players level start with?
else if (isonmap || onSpecialLevel(temp.data[1])) {
for (temp.level: temp.data[1]) {
if (player.level.name.starts(temp.level)) {
if (fileExists(temp.song)) playlooped(temp.song);
break;
}
}
}
// Should the song play in this level?
if (isMusicPlaying() && temp.file.ends(temp.song)) {
if (temp.data[0] == true && !(player.level.name in temp.data[1]) && !onSpecialLevel()) stopMusic();
}
}
}
function onSpecialLevel(levels)
{
for (temp.level: levels) {
if (temp.level.name.ends(".nw")
|| temp.level.name.ends(".graal")) continue;
if (player.level.name.starts(temp.level)) return temp.level;
}
}
http://forums.graalonline.com/forums/images/buttons/reputation.gif As always, please, use the forums reputation system to show if you like the script or not. http://forums.graalonline.com/forums/images/buttons/reputation.gif
//#CLIENTSIDE
function onCreated()
{
this.songList = new TStaticVar();
/*
this.songList.SONGNAME = { ARG1,
{ ARG2 }
};
ARG1 = determines if the song should stop playing when
the players level name isn't in ARG2.
ARG2 = an array with the levels the song should be played
on, or what the level name should begin with.
~~~ EXAMPLE ~~~
this.songList.("My Song Name") = { false,
{ "mylevelname.nw", "mylevelname2.nw", "my_gmap_" }
};
*/
}
function onPlayerEnters()
{
temp.songList = this.songList.getDynamicVarNames();
for (temp.song: temp.songList) {
temp.data = this.songList.(@temp.song);
temp.song = temp.song @ ".mp3";
temp.file = getmusicfilename();
// Is temp.data[1] the players current level?
if (player.level.name in temp.data[1]) {
if (fileExists(temp.song)) playlooped(temp.song);
}
// Ah well... is the player on a gmap, or does temp.data[1]
// contain what the players level start with?
else if (isonmap || onSpecialLevel(temp.data[1])) {
for (temp.level: temp.data[1]) {
if (player.level.name.starts(temp.level)) {
if (fileExists(temp.song)) playlooped(temp.song);
break;
}
}
}
// Should the song play in this level?
if (isMusicPlaying() && temp.file.ends(temp.song)) {
if (temp.data[0] == true && !(player.level.name in temp.data[1]) && !onSpecialLevel()) stopMusic();
}
}
}
function onSpecialLevel(levels)
{
for (temp.level: levels) {
if (temp.level.name.ends(".nw")
|| temp.level.name.ends(".graal")) continue;
if (player.level.name.starts(temp.level)) return temp.level;
}
}
http://forums.graalonline.com/forums/images/buttons/reputation.gif As always, please, use the forums reputation system to show if you like the script or not. http://forums.graalonline.com/forums/images/buttons/reputation.gif