Fluzz's
//-----------------------------------------------------------------------------
// Script_PlayerStereo
// Author: Fluzz
// Id: 14705
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Profiles
new AudioDescription(bgMusicLoop)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(bgMusic)
{
filename = "Add-Ons/Music/Peaceful.ogg";
description = "bgMusicLoop";
preload = true;
};
//-----------------------------------------------------------------------------
// GUI Functions
GlobalActionMap.bindCmd(keyboard, "f6", "", "toggleBGMusicGui();");
function toggleBGMusicGUI()
{
if(BGMusicGui.isAwake())
canvas.popDialog(BGMusicGui);
else
canvas.pushDialog(BGMusicGui);
}
function BGMusicGUI::onWake(%this)
{
BGMusicList.clear();
for(%file = findFirstFile("Add-Ons/Music/*.ogg"); %file !$= ""; %file = findNextFile("Add-Ons/Music/*.ogg"))
{
%numRow++;
%fileName = strReplace(%file, "Add-Ons/Music/", "");
%fileName = strReplace(%fileName, ".ogg", "");
BGMusicList.addRow(%numRow, %fileName);
BGMusicList.sort($numRow, true);
}
}
function BGGuiNewMusic()
{
%id = BGMusicList.getSelectedID();
if(%id < 1)
{
MessageBoxOK("Error", "You must select a music file from the list!");
}
%fileName = BGMusicList.getRowTextById(%id);
alxStop($curBGMusic);
bgMusic.fileName = "Add-Ons/Music/" @ %fileName @ ".ogg";
$curBGMusic = alxPlay(bgMusic);
}
function stopBGMusic()
{
alxStop($curBGMusic);
}
//-----------------------------------------------------------------------------
// GUI
//--- OBJECT WRITE BEGIN ---
new GuiControl(BGMusicGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 2";
visible = "1";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "240 180";
extent = "320 240";
minExtent = "8 2";
visible = "1";
text = "Fluzz's Player Stereo";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "canvas.popDialog(BGMusicGUI);";
new GuiBitmapButtonCtrl(PlayMusic) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "20 196";
extent = "140 30";
minExtent = "8 2";
visible = "1";
command = "BGGuiNewMusic();";
text = "Start";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
};
new GuiBitmapButtonCtrl(stopMusic) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "160 196";
extent = "140 30";
minExtent = "8 2";
visible = "1";
command = "stopBGMusic();";
text = "Stop";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
};
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "center";
vertSizing = "bottom";
position = "20 40";
extent = "280 145";
minExtent = "8 2";
visible = "1";
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
childMargin = "0 0";
rowHeight = "40";
columnWidth = "30";
new GuiTextListCtrl(BGMusicList) {
profile = "GuiTextListProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "1 1";
extent = "263 2";
minExtent = "8 2";
visible = "1";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
};
};
};
//--- OBJECT WRITE END ---
SolarFlare's
//-----------------------------------------------------------------------------
// Script_BGMusic
// Copyright (c) SolarFlare Productions, Inc.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Profiles
new AudioDescription(bgMusicLoop)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(bgMusic)
{
filename = "Add-Ons/Music/Peaceful.ogg";
description = "bgMusicLoop";
preload = true;
};
//-----------------------------------------------------------------------------
// GUI Functions
GlobalActionMap.bindCmd(keyboard, "f6", "", "toggleBGMusicGui();");
function toggleBGMusicGUI()
{
if(BGMusicGui.isAwake())
canvas.popDialog(BGMusicGui);
else
canvas.pushDialog(BGMusicGui);
}
function BGMusicGUI::onWake(%this)
{
BGMusicList.clear();
for(%file = findFirstFile("Add-Ons/Music/*.ogg"); %file !$= ""; %file = findNextFile("Add-Ons/Music/*.ogg"))
{
%numRow++;
%fileName = strReplace(%file, "Add-Ons/Music/", "");
%fileName = strReplace(%fileName, ".ogg", "");
BGMusicList.addRow(%numRow, %fileName);
BGMusicList.sort($numRow, true);
}
}
function BGGuiNewMusic()
{
%id = BGMusicList.getSelectedID();
if(%id < 1)
{
MessageBoxOK("Error", "You must select a music file from the list!");
}
%fileName = BGMusicList.getRowTextById(%id);
alxStop($curBGMusic);
bgMusic.fileName = "Add-Ons/Music/" @ %fileName @ ".ogg";
$curBGMusic = alxPlay(bgMusic);
}
function stopBGMusic()
{
alxStop($curBGMusic);
}
//-----------------------------------------------------------------------------
// GUI
//--- OBJECT WRITE BEGIN ---
new GuiControl(BGMusicGUI) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "800 600";
minExtent = "8 2";
visible = "1";
new GuiWindowCtrl() {
profile = "GuiWindowProfile";
horizSizing = "center";
vertSizing = "center";
position = "240 180";
extent = "320 240";
minExtent = "8 2";
visible = "1";
text = "Background Music Selector";
maxLength = "255";
resizeWidth = "0";
resizeHeight = "0";
canMove = "1";
canClose = "1";
canMinimize = "0";
canMaximize = "0";
minSize = "50 50";
closeCommand = "canvas.popDialog(BGMusicGUI);";
new GuiBitmapButtonCtrl(PlayMusic) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "20 196";
extent = "140 30";
minExtent = "8 2";
visible = "1";
command = "BGGuiNewMusic();";
text = "Play Music";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
};
new GuiBitmapButtonCtrl(stopMusic) {
profile = "BlockButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "160 196";
extent = "140 30";
minExtent = "8 2";
visible = "1";
command = "stopBGMusic();";
text = "Stop Music";
groupNum = "-1";
buttonType = "PushButton";
bitmap = "base/client/ui/button1";
};
new GuiScrollCtrl() {
profile = "GuiScrollProfile";
horizSizing = "center";
vertSizing = "bottom";
position = "20 40";
extent = "280 145";
minExtent = "8 2";
visible = "1";
willFirstRespond = "1";
hScrollBar = "dynamic";
vScrollBar = "alwaysOn";
constantThumbHeight = "0";
childMargin = "0 0";
rowHeight = "40";
columnWidth = "30";
new GuiTextListCtrl(BGMusicList) {
profile = "GuiTextListProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "1 1";
extent = "263 2";
minExtent = "8 2";
visible = "1";
enumerate = "0";
resizeCell = "1";
columns = "0";
fitParentWidth = "1";
clipColumnText = "0";
};
};
};
};
//--- OBJECT WRITE END ---