procedure SetupBalance;
var
filef: Integer;
files: String;
begin
filef:=OpenFile(ScriptPath+'flipgame.scar',False);
ReadFileString(filef,files,filesize(filef));
CloseFile(filef);
files:=ReplaceRegex(files, 'Balance = '+IntToStr(Balance), 'Balance = '+IntToStr(AccountBalance));
filef := RewriteFile(ScriptPath+'flipgame.scar',False);
WriteFileString(filef,files);
CloseFile(filef);
end;
Add a new const and call it 'Balance' then give it the default value of 1000 or whatever you want it to be.
Change 'Accountbalance:=1000;' to ':=Balance'.
Add the above script as a procedure and call it at the end of the script.
Explanation of what it does:-
It starts off by reading the file 'flipgame.scar' (replace both of them with the actual name of the script) then puts it into the 'files' string. Replaceregex then searches through the 'files' string and replaces Balance with Accountbalance. It then writes the file. After it does and the script finishes, it then asks if the user would like to reload the script and if they choose to the accountbalance will be updated to the new value.
Also, a little tip on the script, you have it so that if you choose a higher head flip amount than actual happening flips, it removes $100, but you haven't got it to end the script, so the user misses out on the writeln telling them they have lost $100 and it also runs through the flipping where they lose another $50.