ZephyrsFury
2008-04-21 10:35:13
Well just looking at the new FindDead here… it now uses GetBlackChatMessage which could pose a problem. I don't know if the new one works or not because I haven't died while using a script in a while but in theory there could be one problem.
GetBlackChatMessage only returns the last line of the chat box. So if someone were to talk in Lummy after the character dies but before FindDead was called it wouldn't detect the 'Oh dear you are dead' message and would therefore return false. So wouldn't it be better to check the last actual black chat message not just the last line in the chatbox?
Its not much of a big deal but…
Just a quick edit I made:
GetBlackChatMessage only returns the last line of the chat box. So if someone were to talk in Lummy after the character dies but before FindDead was called it wouldn't detect the 'Oh dear you are dead' message and would therefore return false. So wouldn't it be better to check the last actual black chat message not just the last line in the chatbox?
Its not much of a big deal but…
Just a quick edit I made:
function FindDead: Boolean;
var
TC: TPoint;
Text: string;
begin
Result := False;
for i := 8 downto 1 do
begin
TC := TextCoords(i);
if (FindColor(x, y, 16711680, TC.x, TC.y, TC.x + 50, TC.y + 14)) //If the line has blue chat text
or (not(FindColor(x, y, 0, TC.x, TC.y, TC.x + 50, TC.y + 14))) then //or doesn't have any black text
Continue; //then continue
Text := Trim(GetTextAtEx(TC.X - 2, TC.Y - 2, 0, SmallChars, False, False, 0,
1, 0, 80, False, tr_AllChars));
Result := (Pos('dead', Text) <> 0) and (Pos('dear', Text) <> 0);
Break; //Break makes sure it only checks the last black message line
end; //so it doesn't return true if you've just died recently but were reincarnated
if (Result) then
begin
Deaths := Deaths + 1;
Result := True;
SaveToChatLog;
if Reincarnate then Exit
else
begin
if ScreenShots then
TakeScreen('Found Dead');
{ repeat
Wait(1000 + Random(1000));
until (not (LoggedIn)); }
LogOut;
Players[CurrentPlayer].Rand := 'Oh Dear You Are in Lumby';
Players[CurrentPlayer].Active := False;
end;
end;
end;