SRL's Random Tool
____________________________
What is SRL's Random Tool?
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.
How to add SRL's Random Tool to a script: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.
For example,
Simba Code:
setupRandomTool(10000, 5, 'C:/Simba/randomSound.wav');
Additional options: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):
Simba Code:
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.
Conclusion:
If you have any questions, suggestions, or comments, please post here.
Cheers,
Coh3n