weequ
2012-02-13 13:02:10
I made this because someone made a thread about this issue in the public section.
Features
-The product should compile.
-Random name
-Declareplayers with random amount of players
-Random procedures
-Random mainloop
program ScriptCreator;
var
program0, program1, program2,
program3, program4, program5, program6, program7, program8: TStringArray;
programs: Array of Array of TStringArray;
namestring: String;
I, r1: Integer;
IntegerVariableNames: TStringArray;
StringVariableNames: TStringArray;
BooleanVariableNames: TStringArray;
currentline: String;
procedure WriteDeclarePlayers(HowManyPlayers: Integer);
begin
if Random(3) = 0 then
begin
WriteLn('{*******************************************************************************');
WriteLn('procedure DeclarePlayers;');
WriteLn('By: SRL');
WriteLn('Description: SRL''s Player Setup');
WriteLn('*******************************************************************************}');
end;
WriteLn('procedure DeclarePlayers;');
WriteLn('begin');
WriteLn(' NumberOfPlayers('+IntToStr(HowManyPlayers)+');');
WriteLn(' CurrentPlayer := 0;');
for I := 0 to HowManyPlayers-1 do
begin
if Random(2) = 0 then WriteLn('');
WriteLn(' with Players['+IntToStr(I)+'] do');
WriteLn(' begin');
WriteLn(' Name := '''';');
WriteLn(' Pass := '''';');
WriteLn(' Active := True;');
WriteLn(' Pin := '''';');
WriteLn(' end;');
end;
if Random(2) = 0 then WriteLn('');
WriteLn('end;');
end;
function GenerateProcedure(UsedProcedures: TStringArray): String;
var
ProcedureNames, lollero: TStringArray;
a, b: Integer;
sisennys: String;
kelvollinen: Boolean;
begin
ProcedureNames := ['WalkToBank', 'WalkBack', 'TakeBreak', 'Login2', 'AntiBan', 'HandleRandoms', 'PrintProggy', 'Bank', 'DoBanking', 'CheckCoins',
'AntiBanTalk', 'AntiBanWalking', 'AntiBan2', 'CheckNews', 'Rotate', 'Speak', 'EquipWep', 'ModAround', 'ConfigureSettings',
'TasteVengeance', 'CastDaSpec', 'CastSpec', 'HitTheGround', 'WalkToMiddle', 'WalkToCenter', 'TakeCare', 'StartRunning', 'Escape',
'TogglePray', 'SolveRands', 'WatchOut', 'Trololo', 'DoAntibans', 'WalkBank2', 'CheckInv', 'Turles', 'BatmanMoves', 'Eat', 'CheckForBounds',
'SayNP', 'HitTheButtons', 'PencilStategy', 'Sneeze', 'SetWalkings', 'SetupScript', 'ScriptManagement', 'ScriptSetup', 'BoredOfTypingProcedures'];
repeat
Result := ProcedureNames[Random(Length(ProcedureNames))];
Kelvollinen := True;
for b := 0 to Length(UsedProcedures)-1 do
if Result = UsedProcedures[b] then
begin
kelvollinen := False;
Break;
end;
until(kelvollinen);
WriteLn('procedure '+Result+';');
WriteLn('begin');
sisennys := ' ';
for a := 0 to Random(40) do
begin
lollero := ['MMouse('+IntToStr(Random(500))+', '+IntToStr(Random(500))+', '+IntToStr(Random(30))+', '+IntToStr(Random(30))+');', 'Wait('+IntToStr(Random(5000))+');',
'Wait('+IntToStr(Random(5000))+'+Random('+IntToStr(Random(5000))+'));',
'Mouse('+IntToStr(Random(500))+', '+IntToStr(Random(500))+', '+IntToStr(Random(30))+', '+IntToStr(Random(30))+', MOUSE_LEFT);',
'FindNormalRandoms;', 'WriteLn('+IntToStr(Random(50000))+');', 'WaitOption(''take'', '+IntToStr(1000+1000*Random(6))+');', 'rs_GetCompassAngleRadians;', 'rs_GetCompassAngleDegrees;',
'if CurrentPlayer = '+IntToStr(Random(4))+' then NextPlayer(False);', 'if not LoggedIn then LoginPlayer;', 'FixChat;', 'if GetColor('+IntToStr(Random(500))+', '+IntTostr(Random(500))+') = '+IntToStr(Random(170000))+' then Exit;', 'Exit;', 'FindMod;', 'BankScreen;', 'PinScreen;'];
WriteLn(sisennys+lollero[Random(Length(Lollero))]);
if Random(5) = 0 then
begin
WriteLn(sisennys+'repeat');
sisennys := sisennys+' ';
end;
if (Length(Sisennys) > 2) and (Random(5) = 0) then
begin
SetLength(Sisennys, Length(Sisennys)-2);
WriteLn(sisennys+'until(false);');
end;
end;
while Length(Sisennys) > 2 do
begin
SetLength(Sisennys, Length(Sisennys)-2);
WriteLn(sisennys+'Until(false);');
end;
WriteLn('end;');
end;
procedure WriteMainLoop;
var
lollero: TStringArray;
a, b, rnumber: Integer;
sisennys, tempstring: String;
begin
rnumber := 8+Random(Random(15));
for b := 0 to rnumber do
begin
tempstring := GenerateProcedure(lollero);
SetLength(Lollero, Length(Lollero)+1);
lollero[b] := tempstring;
for I := 0 to Random(3) do WriteLn('');//add 1-3 empty lines
end;
WriteLn('');
WriteLn('begin');
WriteLn(' SetupSRL;');
WriteLn(' DeclarePlayers;');
sisennys := ' ';
for a := 0 to Random(40) do
begin
WriteLn(sisennys+lollero[Random(Length(Lollero))]+';');
if Random(5) = 0 then
begin
WriteLn(sisennys+'repeat');
sisennys := sisennys+' ';
end;
if (Length(Sisennys) > 2) and (Random(5) = 0) then
begin
SetLength(Sisennys, Length(Sisennys)-2);
WriteLn(sisennys+'until(false);');
end;
end;
while Length(Sisennys) > 2 do
begin
SetLength(Sisennys, Length(Sisennys)-2);
WriteLn(sisennys+'Until(false);');
end;
WriteLn('end.');
end;
begin
ClearDebug;
program0 := ['ultimate', 'premium', ''];
program1 := ['air', 'fire', 'earth', 'nature', 'gold', 'silver', 'cowhide', 'dhide', 'amulet', 'ring', 'bracelet'];
program2 := ['crafter', 'maker'];
program3 := ['pro', '', 'lite'];
program4 := ['bronze', 'iron', 'silver', 'gold', 'steel', 'mithril', 'addy', 'rune', 'guild'];
program5 := ['miner', 'smither', 'smelter', 'superheater'];
program6 := ['Goblin', 'GreenDragon', 'Chicken', 'Aviansie', 'Ancou', 'GDK', 'FDK', 'BlackDragon'];
program7 := ['fighter', 'killer', 'slayer', 'ranger'];
program8 := ['SoulWars', 'PestControl', 'SW', 'PCEr', 'ToadPicker', 'SorcGarden', 'SorceressGarden'];
SetLength(programs, 4);
programs[0] := [program0, program1, program2, program3];
programs[1] := [program0, program4, program5, program3];
programs[2] := [program0, program6, program7, program3];
programs[3] := [program0, program8, program3];
r1 := Random(Length(programs));
for I := 0 to Length(programs[r1])-1 do
begin
namestring := namestring+Capitalize(programs[r1][I][random(Length(programs[r1][I]))]);
end;
writeln('program '+ namestring+';');
case Random(30) of //add some comments to the beginning
0: WriteLn('//KEEP PRIVATE!');
1: WriteLn('//Please keep this in private ;)');
2: WriteLn('//PREMIUM SCRIPT - KEEP PRIVATE');
3: WriteLn('//Finally updated and working perfectly');
4: WriteLn('//Please keep this private');
5: WriteLn('//This is a premium script. Keep it PRIVATE!');
6: WriteLn('//Dont leak this script to any noobs!');
7: WriteLn('//This script is NOT free! Keep it to yourself please! (No Leaking)');
end;
for I := 1 to Random(3) do WriteLn('');//add 0-2 empty lines
if Random(2) = 0 then
begin
WriteLn('{$i srl/srl/misc/Smart.simba}');
WriteLn('{$i SRL/SRL.simba}');
end else
begin
WriteLn('{.include srl/srl/misc/Smart.simba}');
WriteLn('{.include SRL/SRL.simba}');
end;
for I := 1 to Random(3) do WriteLn('');//add 0-2 empty lines
IntegerVariableNames := ['I', 'LoadsDone', 'Deaths', 'Slept', 'Gained'];
StringVariableNames := ['Location', 'Debug'];
BooleanVariableNames := ['Active' ,'Breaking', 'Stupid'];
if Random(10) > 0 then //add global vars?
begin
WriteLn('var');
for I := 0 to High(IntegerVariableNames) do //Integers
if Random(2) = 0 then currentline := currentline+IntegerVariableNames[I]+', ';
if Length(currentline) > 0 then
begin
SetLength(CurrentLine, Length(CurrentLine)-2);
currentline := currentline+': Integer;';
WriteLn(' '+CurrentLine);
end;
currentline := '';
for I := 0 to High(StringVariableNames) do //Strings
if Random(2) = 0 then currentline := currentline+StringVariableNames[I]+', ';
if Length(currentline) > 0 then
begin
SetLength(CurrentLine, Length(CurrentLine)-2);
currentline := currentline+': String;';
WriteLn(' '+CurrentLine);
end;
currentline := '';
for I := 0 to High(BooleanVariableNames) do //Booleans
if Random(2) = 0 then currentline := currentline+BooleanVariableNames[I]+', ';
if Length(currentline) > 0 then
begin
SetLength(CurrentLine, Length(CurrentLine)-2);
currentline := currentline+': Boolean;';
WriteLn(' '+CurrentLine);
end;
currentline := '';
end;
for I := 1 to Random(3) do WriteLn('');//add 0-2 empty lines
WriteDeclarePlayers(1+Random(5));//Declareplayers with 1-5 players
for I := 1 to Random(3) do WriteLn('');//add 0-2 empty lines
writemainLoop;
end.