Coh3n
2010-02-18 02:24:16
Well, the current one doesn't work when you want to turn a chat type off because the 'ff' text can't be found (I posted about that bug a while ago, but I don't think anything could have been done). I tried messing around with font bitmap, but had no luck, so I fixed SetChat. I also added constants as you'll see, and made the function return a boolean.
Old
New
Comments?
Old
{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup?, WT-Fakawi, Starblaster100 & N1ke!
Description: Sets Chat to desired state
Chat: Game Public Private Clan Trade Assist
0 1 2 3 4 5
*******************************************************************************}
procedure SetChat(state: string; chat: Integer);
var
x, y, mx, Color: Integer;
begin
case chat of
0: mx := 90;
1: mx := 145;
2: mx := 200;
3: mx := 260;
4: mx := 320;
5: mx := 373;
else
begin
srl_Warn('SetChat', 'chat(' + IntToStr(chat) + ') does not exist.', warn_AllVersions);
Exit;
end;
end;
State := LowerCase(State);
case 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;
State := Capitalize(State);
if not FindColor(x, y, Color, mx - 10, 486, mx + 10, 506) then
begin
Mouse(mx, 496, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;
New
const
CHAT_GAME = 0;
CHAT_PUBLIC = 1;
CHAT_PRIVATE = 2;
CHAT_CLAN = 3;
CHAT_TRADE = 4;
CHAT_ASSIST = 5;
{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup?, WT-Fakawi, Starblaster100, N1ke! & Coh3n
Description: Sets Chat to desired state
Chat: Game Public Private Clan Trade Assist
0 1 2 3 4 5
*******************************************************************************}
function SetChat(state: string; chat: Integer): Boolean;
var
x, y, mx, Color: Integer;
begin
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, 506)) then
begin
Mouse(mx, 496, 4, 4, False);
Wait(RandomRange(50, 150));
if (Lowercase(State) = 'off') then
begin
case chat of
CHAT_PUBLIC: Mouse(mx, 496 - 33, 8, 3, True);
CHAT_PRIVATE..CHAT_ASSIST: Mouse(mx, 496 - 20, 8, 3, True);
end;
Wait(RandomRange(50, 150));
Result := FindColor(x, y, Color, mx - 10, 486, mx + 10, 506);
end else
Result := WaitOption(Capitalize(State), 300);
end;
end;
I did test 15-20 times turning the chats on/off/etc, so it does work. :)Comments?