paste this code in a new file called marbleselectordlg.gui:
this goes in marble/client/ui
Code://
//MarbleSelectorDlg.gui by Jeff Hutchinson
//This is open sourced, so use it for whatever you want. Yes, you can modify
//it, and you do not have to credit me in your mod for this, I just want you
//to enjoy this!
//
//One note to make: I do remember the for loop from mbopal/mbemerald, so sorry
//bout that, I have a photographic memory, so I knew about the specific path
//
//--- OBJECT WRITE BEGIN ---
new GuiControl(MarbleSelectorDlg) {
profile = GuiDefaultProfile;
horizSizing = center;
vertSizing = center;
position = -1 44;
extent = 641 392;
minExtent = 8 8;
visible = 1;
helpTag = 0;
new GuiBitmapCtrl() {
profile = GuiDefaultProfile;
horizSizing = center;
vertSizing = center;
position = 15 10;
extent = 400 280;
minExtent = 8 8;
visible = 1;
helpTag = 0;
bitmap = common/ui/dialog;
wrap = 0;
new GuiScrollCtrl() {
profile = GuiScrollProfile;
horizSizing = right;
vertSizing = bottom;
position = 93 36;
extent = 209 129;
minExtent = 8 8;
visible = 1;
helpTag = 0;
willFirstRespond = 1;
hScrollBar = dynamic;
vScrollBar = alwaysOn;
constantThumbHeight = 0;
childMargin = 0 0;
defaultLineHeight = 15;
new GuiTextListCtrl(MarbleList) {
profile = GuiTextArrayProfile;
horizSizing = right;
vertSizing = bottom;
position = 2 2;
extent = 416 8;
minExtent = 8 8;
visible = 1;
helpTag = 0;
enumerate = 0;
resizeCell = 1;
columns = 0;
fitParentWidth = 1;
clipColumnText = 0;
noDuplicates = false;
};
};
new GuiBitmapButtonCtrl() {
profile = GuiButtonProfile;
horizSizing = right;
vertSizing = bottom;
position = 157 188;
extent = 77 58;
minExtent = 8 8;
visible = 1;
command = chooseMarble();;
helpTag = 0;
text = Choose;
groupNum = -1;
buttonType = PushButton;
repeatPeriod = 1000;
repeatDecay = 1;
bitmap = common/ui/ok;
};
};
};
//--- OBJECT WRITE END ---
function MarbleSelectorDlg::onWake(%this) {
//clear the list and then build it
MarbleList.clear();
%this.BuildList();
}
function MarbleSelectorDlg::BuildList(%this) {
MarbleList.clear();
%msfiles = 0;
//grab those files
for(%file = findFirstFile(marble/data/shapes/balls/*.dts); %file !$= ; %file = findNextFile(marble/data/shapes/balls*.dts)) {
%msfiles ++;
$MSF[%msfiles] = filebase(%file);
MarbleList.addRow(%msfiles, $MSF[%msfiles]);
}
}
function ChooseMarble() {
%id = MarbleList.getSelectedId();
%marble = MarbleList.getRowTextbyId(%id);
//check to see if a selection was made...
if(%marble !$= ) {
$pref::marbleshape = %marble;
echo(Marble Chosen: @ %marble @ .dts);
Canvas.popDialog(MarbleSelectorDlg);
} else
MessageBoxOk(Warning!, You did not select a marble! Please select a Marble!);
}
go to marble/client/init.cs
add the following line where the others are being exec'd
Code:exec(./ui/marbleselectordlg.gui);
now, go to marble/server/scripts/game.cs, and add this:
find function onMissionLoaded (near the top)
and add:
Code:%shape = $pref::marbleshape;
//checking for null....
if(%shape $= )
%shape = ball-superball;
defaultmarble.shapeFile = marble/data/shapes/balls/ @ %shape @ .dts;
Now, run your game to compile it, and enjoy!
NOTE: to add marbles, place the .dts in marble/data/shapes/balls
I am a programmer. Most here know me for being one of the major contributors to Marble Blast Platinum and PlatinumQuest.