Dark_Sniper
2007-05-29 16:36:11
Procedure ChatSet(ChatType : String; ChatBox : Integer);
var
color, T : Integer;
begin
Case LowerCase(ChatType) of
'hide' : Color := 16776960;
'off' : Color := 255;
'friend' : Color := 65535;
'on' : Color := 65280;
end;
if ChatBox <= 3 then
ChatBox:= 38 + 135 * (ChatBox - 1);
if findcolor(x, y, color, chatbox, 484, chatbox+15, 484+15) then
Exit;
repeat
Mouse(ChatBox, 480, 15, 15, true)
wait(100+random(100))
T:=T + 1;
until(findcolor(x, y, color, chatbox, 484, chatbox+15, 484+15)) or (T > 5)
end;also as a function:
Function ChatSet(ChatType : String; ChatBox : Integer) : Boolean;
var
color, T : Integer;
begin
Result:=True;
Case LowerCase(ChatType) of
'hide' : Color := 16776960;
'off' : Color := 255;
'friend' : Color := 65535;
'on' : Color := 65280;
end;
if ChatBox <= 3 then
ChatBox:= 38 + 135 * (ChatBox - 1);
if findcolor(x, y, color, chatbox, 484, chatbox+15, 484+15) then
Exit;
repeat
Mouse(ChatBox, 480, 15, 15, true)
wait(100+random(100))
T:=T + 1;
until(findcolor(x, y, color, chatbox, 484, chatbox+15, 484+15)) or (T > 5)
if T >= 5 then
Result:=False;
end;ok works every time and 4x shorter.
compared to:
procedure SetChat(state: string; chat: Integer);
var
x, y, setx, sety, C: Integer;
begin
setx := 55 + ((chat - 1) * 135);
sety := 490;
State := Lowercase(State);
case State of
'hide' :
if chat = 1 then
begin
while not(FindColor(x, y, 16776960, setx - 10, sety - 10, setx + 10, sety + 10))
do
begin
if (C > 9) then Break;
Mouse(setx, sety, 5, 5, True);
Wait(900 + Random(200));
C := C + 1;
end;
end else
Writeln('You can only set Public Chat to hide!');
'on' :
while not(FindColor(x, y, 65280, setx - 10, sety - 10, setx + 10, sety + 10))
do
begin
if (C > 9) then Break;
Mouse(setx, sety, 5, 5, True);
Wait(900 + Random(200));
C := C + 1;
end;
'friends' :
while not(FindColor(x, y, 65535, setx - 10, sety - 10, setx + 10, sety + 10))
do
begin
if (C > 9) then
Break;
Mouse(setx, sety, 5, 5, True);
Wait(900 + Random(200));
C := C + 1;
end;
'off' :
while not(FindColor(x, y, 255, setx - 10, sety - 10, setx + 10, sety + 10))
do
begin
if (C > 9) then Break;
Mouse(setx, sety, 5, 5, True);
Wait(900 + Random(200));
C := C + 1;
end;
else
WriteLn('SetChat - Incorrect State! Possible values: Hide, On, Friends, Off');
end;
end;