Coh3n
2012-03-13 02:33:02
SRL's Random Tool
____________________________
[BANANA]
[/BANANA]
____________________________
[BANANA]
[/BANANA]What is SRL's Random Tool?
[INDENT]It's a pretty neat tool. It notifies (optionally plays a sound) the user when SRL has detected a random event, and gives them the option to have SRL solve the random, or solve it manually.
SRL's Random Tool source code can be found here, or in SRL/SRL/core/antirandoms/randomtool.simba.
[/INDENT]
How to add SRL's Random Tool to a script:[INDENT]Very, very simple. Just call SetupRandomTool(timeOutWait, FKeyFinish: integer; soundPath: string); sometime after SetupSRL() and DeclarePlayers().
- timeOutWait: How long to wait (in milliseconds) before closing the Random Tool form and having SRL solve the random.
- FKeyFinish: The F key that is pressed when the user has finished manually solving the random.
- soundPath: The path to the sound file to be played when a random event is detected.
setupRandomTool(10000, 5, 'C:/Simba/randomSound.wav');
[/INDENT]Additional options:[INDENT]Since not all users will want to take advantage of this feature, I recommend giving them the option. Using a simple constant or variable boolean statement will work nicely.
Example (just copy/paste into Simba if you want to test):
program test_RandomTool;
{$i srl\srl.simba}
procedure declarePlayers;
begin
howManyPlayers := 1;
numberOfPlayers(howManyPlayers);
currentPlayer := 0;
with players[0] do
begin
name := 'Coh3n';
pass := 'myPassword1234';
active := true;
end;
end;
begin
clearDebug();
activateClient();
setupSRL();
declarePlayers();
setupRandomTool(25000, 5, '');
RT_Execute();
end.
[/INDENT]Conclusion:
[INDENT]If you have any questions, suggestions, or comments, please post here.
Cheers,
Coh3n
[/INDENT]