SRL Archive - SRL Bugs

Damien random


marpis

2011-03-19 15:34:42

It solves the puzzle beautifully, but after getting teleported away it thinks it failed. I believe the InRandom loop fails somehow.

I think this should fix it:

{*******************************************************************************
function SolveDemon: Boolean;
by: Sumilion
Description: Main solving procedure.
*******************************************************************************}

function SolveDemon: Boolean;
var
Task: string;
JogIndex, StarIndex, SitIndex, PushIndex, t: Integer;
begin
Result := false;
TakeScreen('Found Demon');
ClickContinue(True, True);
SetAngle(true);
MarkTime(t);
MakeCompass('N');
repeat;
Task := demon_GetTask;
Writeln(Task);

if (not(GetSigns(JogIndex, StarIndex, SitIndex, PushIndex))) then
begin
WriteLn('Could not identify demon signs.');
LogOut;
Exit;
end;

case Task of
'Jog': Result := PerformTask(JogIndex);
'Star': Result := PerformTask(StarIndex);
'Sit': Result := PerformTask(SitIndex);
'Push': Result := PerformTask(PushIndex);
end;

if (not (Result)) then
Exit;

Wait(100 + Random(200));

if FindNPCChatText('Wrong exercise', Nothing) then
Writeln('Wrong exercise.');

until FindNPCChatText('actually', Nothing) or (TimeFromMark(t) > 10 * 60 * 1000);

if (TimeFromMark(t) > 10 * 60 * 1000) then
begin
Writeln('We''ve been in the demon random for 10 minutes. It failed.');
LogOut;
Exit;
end;

Wait(10000);
while (ClickContinue(True, True)) do
Wait(500 + Random(500));
Writeln('Waiting 10 seconds now');
Wait(10000);
Result := (not(Demon_InRandom));
if (Result) then
Writeln('Demon random solved!');

end;

Floor66

2011-03-19 15:36:24

I don't actually think it's failed on me so far :/

WT-Fakawi

2011-03-19 17:56:45

This:
Wait(10000);
while (ClickContinue(True, True)) do
Wait(500 + Random(500));
Writeln('Waiting 10 seconds now');
Wait(10000);
Result := (not(Demon_InRandom));
if (Result) then
Writeln('Demon random solved!');

Wouldnt it be better to wait until not Demon_InRandom of TimeFromMark instead of wait(10000) once out of the demon?

Ow, and it has failed me on several occasions, in the same way marpis concludes.

TomTuff

2011-03-19 18:09:10

From: WT-Fakawi
This:
Wait(10000);
while (ClickContinue(True, True)) do
Wait(500 + Random(500));
Writeln('Waiting 10 seconds now');
Wait(10000);
Result := (not(Demon_InRandom));
if (Result) then
Writeln('Demon random solved!');

Wouldnt it be better to wait until not Demon_InRandom of TimeFromMark instead of wait(10000) once out of the demon?

Ow, and it has failed me on several occasions, in the same way marpis concludes.




function Demon_Successful: Boolean;
var
T: Integer;
begin
while ClickContinue(True, True) do
Wait(800 + Random(400));
T := GetSystemTime + 15000;
while (GetSystemTime < T) and not(Result) do
begin
Result := not(Demon_InRandom);
if Result then
Break;
Wait(200 + Random(100));
end;
if Result then
Writeln('Demon random solved!');
end;

NCDS

2011-03-19 18:29:29

From: TomTuff

function Demon_Successful: Boolean;
var
T: Integer;
begin
while ClickContinue(True, True) do
Wait(800 + Random(400));
T := GetSystemTime + 15000;
while (GetSystemTime < T) and not(Result) do
begin
Result := not(Demon_InRandom);
if Result then
Break;
Wait(200 + Random(100));
end;
if Result then
Writeln('Demon random solved!');
end;


Not trying to butt in here, but…

function Demon_Successful: Boolean;
var
T: Integer;
begin
while ClickContinue(True, True) do
Wait(800 + Random(400));
T := GetSystemTime + 15000;
while (not (Result)) and (GetSystemTime < T) do
begin
Wait(200 + Random(100));
Result := not(Demon_InRandom);
end;
if Result then
Writeln('Demon random solved!');
end;

Doesn't make much difference but makes more sense logically, IMO anyways.

TomTuff

2011-03-19 18:38:13

From: NCDS
Not trying to butt in here, but…

function Demon_Successful: Boolean;
var
T: Integer;
begin
while ClickContinue(True, True) do
Wait(800 + Random(400));
T := GetSystemTime + 15000;
while (not (Result)) and (GetSystemTime < T) do
begin
Wait(200 + Random(100));
Result := not(Demon_InRandom);
end;
if Result then
Writeln('Demon random solved!');
end;

Doesn't make much difference but makes more sense logically, IMO anyways.


It does save 2 lines but it makes more sense to perform the "Result := …" before waiting some more, yes? It's minute, though, let's not argue over it :p

footballjds

2011-03-21 13:41:48

From: TomTuff
It does save 2 lines but it makes more sense to perform the "Result := …" before waiting some more, yes? It's minute, though, let's not argue over it :p


the if result then break is useless in a while not(result) loop…. :duh:
worry about waiting 200..300 ms is pretty overrated