SRL Archive - SRL Bugs

SetChat() bug & fix


RISK

2012-03-19 22:27:22

Previously when attempting to set the assist chat to 'Off', it would not work properly. This would be because it would try to 'XP Earned' thinking it is where the 'Off' option would be. I have corrected this by adjusting the case inside of the procedure.

Here is the updated version:
function SetChat(state: string; chat: Integer): Boolean;
var
x, y, mx, Color: Integer;
begin
result := false;
mx := 90 + (chat * 55);

if (not InRange(chat, CHAT_GAME, CHAT_ASSIST)) then
begin
srl_Warn('SetChat', 'chat(' + IntToStr(chat) + ') does not exist.', warn_AllVersions);
Exit;
end;

case Lowercase(State) of
'on', 'all': Color := 65280;
'off': Color := 255;
'hide': Color := 16776960;
'friends', 'filter': Color := 65535;
else
srl_Warn('SetChat', state + ' does not exist.', warn_AllVersions);
end;

if (not FindColor(x, y, Color, mx - 10, 486, mx + 10, 502)) then
begin
Mouse(mx, 496, 4, 4, mouse_right);
Wait(RandomRange(50, 150));

if (Lowercase(State) = 'off') then
begin
case chat of
CHAT_PUBLIC, CHAT_ASSIST: Mouse(mx, 496 - 33, 8, 3, mouse_left);
CHAT_PRIVATE..CHAT_TRADE: Mouse(mx, 496 - 20, 8, 3, mouse_left);
end;

Wait(RandomRange(50, 150));
Result := FindColor(x, y, Color, mx - 10, 486, mx + 10, 502);
end else
Result := WaitOption(Capitalize(State), 300);
end;
end;


Sorry if this is the wrong prefix, by the way! :)

Sex

2012-03-19 22:34:33

Sent in a pull request for you. In the future, you should do the same :p.

RISK

2012-03-19 22:38:40

Thank you very much! I should probably learn how… :p I'll learn how immediately. Thank you again.