Simba Code:
program SRLPlayerFormTest;
{$DEFINE SMART}
{$i srl-6/srl.simba}
{$i srl-6/lib/misc/srlplayerform.simba}
// initiates the SRL player form (you aren't restricted to the procedure name; it can be whatever you want)
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'SRL Player Form ~ Test'; // the title of the SPF, usually the name of your script
scriptHelpThread := ''; // a link to a help thread, if set to '' will link to my setup guide
editBoxLabels := ['Minutes to run', 'Minutes before breaking', 'Logs to burn']; // edit boxes are created for each array element
editBoxDefaults := ['80', '5', '1000']; // optional default values for each edit box; array length must equal editBoxLabel length
checkBoxLabels := ['Find Spirit?']; // same as editBoxLabels but for check boxes
checkBoxDefaults := ['False'];
end;
end;
// again, not restricted to the procedure name, although it's recommended
procedure declarePlayers();
var
i: integer;
begin
players.setup(playerForm.players); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first
// set player attributes based on the settings from the form
for i := 0 to high(players) do
with players[i] do
begin
// convert the integers
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
// booleans
booleans[0] := strToBool(playerForm.players[i].settings[3]);
end;
end;
procedure debugSPFSettings();
var
i: integer;
begin
writeln('');
for i := 0 to high(players) do
begin
writeln('Minutes to run: ', players[i].integers[0]);
writeln('Logs to chop: ', players[i].integers[1]);
writeln('Minutes before breaking: ', players[i].integers[2]);
writeln('Hatchet Equipped: ', players[i].booleans[0]);
writeln('');
end;
end;
begin
clearDebug();
initPlayerForm(); // initiate your settings
runPlayerForm(); // run the form
// use this so the script doesn't continue if the user exits out of the form
if (not playerForm.isScriptReady) then
exit;
declarePlayers();
debugSPFSettings(); // this can be removed if you're satisfied with the result
//setupSRL();
end.