SRL Archive - SRL Archives

The Devs Fixes - FFlag and LoginPlayer


Nava2

2009-04-01 19:39:59

While we put the finishing touches into the new SRL, I have put together this thread of all the immediate fixes needed!

Just do as it says and you should be able to macro again! :cool:

To solve the flag issues, replace FlagChat.scar with:

//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Mouse Flag & Chat Routines --//
//-----------------------------------------------------------------//
// * function IsMoving(WaitTime: Integer): Boolean; // * by Bullzeye95 & Nava2
// * function Flag: Boolean; // * by PPLSUQBAWLZ/Odie533
// * function FlagPresent: Boolean; // * by Mutant Squirrle
// * function FlagDistance: Integer; // * by PPLSUQBAWLZ/Odie533
// * Function MFF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * Function MFNF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * procedure FFlag(Distance: Integer); // * by Wizzup? / WT-Fakawi.
// * procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer); // * by RsN edit by EvilChicken!
// * procedure SetChat(state: String; chat: Integer); // * by Wizzup? modded by WT-Fakawi and Starblaster100
// * procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string); // * by ZephyrsFury
// * procedure ChatsOff; // * by Starblaster100

{*******************************************************************************
function IsMoving(WaitTime: Integer): Boolean;
By: Bullzeye95; Edits by Nava2
Description: Checks if the currently loaded player is moving. Uses Minimap,
ignoring all dots which can move without the player moving.
Nava2 edit: Added try..finally, also changed to work with SMART,
as well added WaitTime Parameter.
*******************************************************************************}
function IsMoving(WaitTime: Integer): Boolean;
var
BMP, BMP2, I, H, x, y: Integer;
ReplaceCols: TIntegerArray;
P: TPointArray;
DC: HDC;
begin
WaitTime := Max(100, WaitTime);
try
DC := GetTargetDC;
ReplaceCols:= [65536, 16711422, 12961221, 14869218, 16777215, 15527148, 195836, 56797, 60909, 52428,
13816530, 982782, 1310462, 62965, 2105598, 395004, 789758, 3553023, 217, 188, 241,
206, 233, 64768, 58880, 51456, 49152, 44800, 61440, 16215571, 9716750, 13129742];
BMP:= BitmapFromString(100, 100, '');
BMP2:= BitmapFromString(100, 100, '');
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(BMP), MMCX - 50, MMCY - 50, MMCX + 50, MMCY + 50, 0, 0, 100, 100);
H := High(ReplaceCols);
for I:= 0 to H do
FastReplaceColor(BMP, ReplaceCols[i], 0);
wait(WaitTime);
SafeCopyCanvas(GetClientCanvas, GetBitmapCanvas(BMP2), MMCX - 50, MMCY - 50, MMCX + 50, MMCY + 50, 0, 0, 100, 100);
SetTargetDC(GetBitmapDC(BMP2));
for I:= 0 to H do
begin
FindColorsTolerance(P, ReplaceCols[i], 0, 0, 99, 99, 0);
for x:= 0 to High(P) do
FastSetPixel(BMP2, P[x].x, P[x].y, FastGetPixel(BMP, P[x].x, P[x].y));
end;
Result:= not FindBitmapIn(BMP, x, y, 0, 0, 100, 100);
finally
SetTargetDC(DC);
FreeBitmap(BMP);
FreeBitmap(BMP2);
end;
end;

{*******************************************************************************
function FlagPresent: Boolean;
By: Mutant Squirrle
Description: T/F depending on flag exist.
*******************************************************************************}

function FlagPresent: Boolean;
var
x, y: integer;
begin
Result := FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2);
end;

{*******************************************************************************
function FlagDistance: Integer;
By: PPLSUQBAWLZ/Odie533
Description: Returns distance in pixels your char dot is from flag on mini-map
*******************************************************************************}

function FlagDistance: Integer;
var
x, y: Integer;
begin
If findcolor(x, y, 255, MMX1, MMy1, MMX2, MMY2) Then
Result := Distance(MMCX, MMCY, x + 1, y + 14);
end;

{*******************************************************************************
Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: If the flag is not present it will click at (ax, ay) increasing by
(xmod, ymod) 5 times or until the flag appears.
*******************************************************************************}
Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y, BreakOutTime: Integer;
begin
if (not LoggedIn) then Exit;
if (not (FlagPresent)) then
begin
xx := ax - xmod;
yy := ay - ymod;
MarkTime(BreakOutTime);
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(10);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True
Exit;
end;
Wait(Random(100));
until TimeFromMark(TT) > 3000;
end;
Result := False;
end;
end;

{*******************************************************************************
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: Like MFF except it will click even if the flag is present when the
function is called.
*******************************************************************************}
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
xx := ax - xmod;
yy := ay - ymod;
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(100);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True;
Exit;
end;
Wait(Random(100));
until TimeFromMark(TT) > 3000;
end;
end;

{*******************************************************************************
procedure FFlag(Distance: Integer);
By: Wizzup? / WT-Fakawi / ZephyrsFury
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}

function FFlag(Dist: Integer): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindColor(Tx, Ty, 255, MMX1, MMY1, MMX2, MMY2)) do
begin
D1 := Distance(Tx + 1, Ty + 14, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
Wait(20);
if (GetSystemTime - M > 10000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
end;

{*******************************************************************************
function Flag: Boolean;
By: PPLSUQBAWLZ/Odie533
Description: Waits while flag exists.
*******************************************************************************}

function Flag: Boolean;
begin
Result := FFlag(0);
end;

{
var
timeout, x, y: Integer;
begin
if (FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) then
begin
Result := True;
repeat
Wait(100);
if (SRL_Procs[srl_AntiBan] <> nil) then
SRL_Procs[srl_AntiBan]();
timeout := timeout + 1;
until (not FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2)) or (timeout > 300);
end;
end; }

{*******************************************************************************
procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
By: RsN edit by EvilChicken!
Description: Mouse and Flag combined into one easy procedure.
*******************************************************************************}

procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
var
i: Integer;
begin
if (not LoggedIn) then Exit;
Mouse(cx, cy, rx, ry, True);
while (not FlagPresent) and (i < 10) do
begin
Wait(100);
Inc(i);
end;
FFlag(FlagDist);
Wait(300 + Random(200));
end;

{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup? modded by WT-Fakawi and Starblaster100
Description: Sets Chat to desired state
*******************************************************************************}

procedure SetChat(state: string; chat: Integer);
var
x, y, mx, my, Color: Integer;
begin
case chat of
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': Color := 65280;
'off': Color := 255;
'hide': Color := 16776960;
'friends': 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, my, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;

{*******************************************************************************
procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
By: ZephyrsFury
Description: Sets all the chats to a particular state in one simple procedure.
Leave the parameter as '' if you wish to leave the chat as it is:
Example: SetAllChats('on', 'friends', '', 'off', '');
*******************************************************************************}

procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
var
States: TStringArray;
II: Integer;
begin
if (not(LoggedIn)) then Exit;
States := ['', Pub, Priv, Clan, Trade, Assist];
for II := 1 to 5 do
begin
if (States[II] = '') then Continue;
States[II] := Lowercase(States[II]);
if ((II <> 1) and (States[II] = 'hide')) or ((States[II] <> 'on') and
(States[II] <> 'friends') and (States[II] <> 'off') and (States[II] <> 'hide')) then
begin
srl_Warn('SetAllChats', 'ChatState ''' + States[II] + ''' does not exist for chat ''' + IntToStr(II) + ''' ', warn_AllVersions);
Continue;
end;
SetChat(States[II], II);
end
end;

{*******************************************************************************
procedure ChatsOff;
By: Starblaster100
Description: Sets all Chats to off.
*******************************************************************************}

Procedure ChatsOff;
var
i: Integer;
Begin
For i := 1 to 5 do
SetChat('off', i);
end;

To Fix Login problems replace Login.scar with
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Login Routines --//
//-----------------------------------------------------------------//
// * function RSReady: Boolean; // * by ZephyrsFury
// * Procedure LoginScreenMusic(State: Variant); // * by Wizzup?
// * procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) ); // * by ZephyrsFury
// * procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fl, gt, cs: string); // * by ZephyrsFury
// * procedure SetAutoingDefaults; // * by ZephyrsFury
// * procedure Logout; // * by Starblaster100 and Raymond
// * procedure LoginPlayer; // * by SRL Developers
// * procedure RandomNextPlayer(Active: Boolean); // * by Dankness, Ron and Raymond
// * procedure NextPlayer(Active: Boolean); // * by Dankness, Ron and Raymond
// * procedure CheckUserNicks; // * by Sumilion, Raymond and Nava2

{ var SRL_Logs: Integer;
Description: Variables needed for some login functions. }
{ var RandomPlayer, GraphicsSet: Boolean;
Description: Variables needed for some login functions. }
var
SRL_Logs: Integer;
RandomPlayer, GraphicsSet: Boolean;

procedure NextPlayer(Active: Boolean); forward;
procedure RandomNextPlayer(Active: Boolean); forward;

{*******************************************************************************
function RSReady: Boolean;
By: ZephyrsFury
Description: Returns true if we are ready to auto (on loginscreen or logged in).
Useful for waiting until RS has fully loaded.
*******************************************************************************}

function RSReady: Boolean;
begin
Result := (LoggedIn) or (GetColor(520, 146) = 4038981);
end;

{*******************************************************************************
Procedure LoginScreenMusic(State: Variant);
By: Wizzup?
Description: Takes Boolean(True, False) or Integer(1..5) as arguments.
1 or True = Off, 5 or False = Max.
1 2 3 4 5
<-o---o---o---o---o->
*******************************************************************************}

Procedure LoginScreenMusic(State: Variant);

Var
RealState: Variant;
x: Extended;

Begin
if (LoggedIn) then Exit;
if (CountColor(7750, 346, 356, 416, 369) <> 119) and (GetColor(520, 135) = 4038981) then
begin
TypeByte(vk_Escape);
Wait(100);
end;
if (CountColor(7750, 346, 356, 416, 369) <> 119) then Exit;
Case VarType(State) Of
11: RealState := (State + 1) * 4;
3: If InRange(State, 1, 5) Then
RealState := State - 1;
Else
RealState := 0;
End;
x := (425.0 - 337.0) * RealState / 4.0 + 339.0;
If CountColorTolerance(1647966, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
If CountColorTolerance(991349, Round(x) - 5, 375, Round(x) + 5, 385, 20) < 5 Then
Mouse(Round(x), RandomRange(375, 385), 0, 0, True);

End;

{*******************************************************************************
procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: (Stereo, Mono, NoChange) );
By: ZephyrsFury
Description: Sets audio options through the login screen.
Use: Enter the desired Setting for the desired Option. Make option 0 for no change.
EG. Login_SetAudio(1, 5, 2, NoChange);

1 2 3 4 5
Volume, SFX, Area: <-o---o---o---o---o->
*******************************************************************************}

procedure Login_SetAudio(Volume, SFX, Area: Integer; SMSetting: TSMSetting);
var
II, Tx, Ty, T: Integer;
Pts: TIntegerArray;
begin
if (LoggedIn) then Exit;
TypeByte(vk_Escape);
T := GetSystemTime;
while (CountColor(7750, 346, 373, 416, 386) <> 119) and (GetSystemTime - T < 5000) do
Wait(100);
if (CountColor(7750, 346, 373, 416, 386) = 119) then
MouseBox(334, 362, 426, 371, 1)
else
Exit;
Wait(100);
Pts := [Volume, SFX, Area];
for II := 0 to 2 do
begin
if (Pts[II] = 0) then Continue;
if (not(InRange(Pts[II], 0, 5))) then
begin
srl_Warn('Login_SetAudio', 'Points must be between 0 and 5', warn_AllVersions);
Continue;
end;
Tx := 337 + Round((425 - 337) * (Pts[II] - 1) / 4);
Ty := Round(3.5 * II * II + 46.5 * II + 245);
if (GetColor(Tx, Ty) <> 1121100) then
Mouse(Tx + 2, Ty - 14, 0, 0, True);
Wait(50);
end;
if (GetColor(337, 389) = 181) and (SMSetting = Stereo) then
Mouse(421, 385, 10, 10, True)
else
if (GetColor(426, 389) = 181) and (SMSetting = Mono) then
Mouse(332, 385, 10, 10, True);
Wait(100);
TypeByte(vk_Escape);
end;

{*******************************************************************************
procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fe, gt, cs: string);
By: ZephyrsFury
Description: Sets graphic options in the login screen.
Use: Enter the desired Setting for the desired Option.
Leave as 0 for no change of brightness and '' for no change in anything else.

Parameter Option Setting
Brightness Brightness 1 - 4 (0 for no change)
vl Visible Levels Current / All
rr Remove Roofs Always / Selectively
gd Ground Decoration Off / On
td Texture Detail Low / High
ia Idle Animations Few / Many
fe Flickering Effects Off / On
gt Ground Textures Few / Many
cs Chracter Shadows Off / On

1 2 3 4
Brightness: <---o---o---o---o--->

EG. Login_SetGraphics(2, 'current', '', 'off', 'low', 'few', '', 'few', 'off');

For Autoing:
Login_SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
*******************************************************************************}

procedure Login_SetGraphics(Brightness: Integer; vl, rr, gd, td, ia, fe, gt, cs: string);
var
Settings, PosSettings, OptionName: TStringArray;
II, T, W, tCol, x, y, mSpeed: Integer;
TB: TBox;
P: TPoint;
begin
if (LoggedIn) then Exit;
Settings := [vl, rr, gd, td, ia, fe, gt, cs];
PosSettings := ['Current', 'All', 'Always', 'Selectively', 'Off', 'On', 'Low',
'High', 'Few', 'Many', 'Off', 'On', 'Few', 'Many', 'Off', 'On'];
OptionName := ['Visible levels', 'Remove roofs', 'Ground decoration', 'Texture detail',
'Idle animations', 'Flickering effects', 'Ground textures', 'Character shadows'];
TypeByte(vk_Escape);
T := GetSystemTime;
while (CountColor(7750, 346, 373, 416, 386) <> 119) and (GetSystemTime - T < 5000) do
Wait(100);
if (CountColor(7750, 346, 373, 416, 386) = 119) then
MouseBox(321, 338, 443, 346, 1)
else
Exit;
mSpeed := MouseSpeed;
MouseSpeed := 25;
Wait(100);
if (Brightness > 4) then
srl_Warn('Login_SetGraphics', 'Brightness must be between 0 and 4', warn_AllVersions)
else
if (Brightness <> 0) then
begin
P := Point(89 + (Brightness - 1) * 21, 266);
if (GetColor(P.x, P.y) <> 1121100) then
Mouse(P.x - 3, P.y - 17, 6, 6, True);
end;
for II := 0 to 7 do
begin
TB.x1 := 67 + 130 * ((II + 1) mod 5);
TB.y1 := 245 + 60 * ((II + 1) div 5);
TB.x2 := TB.x1 + 109;
TB.y2 := TB.y1 + 15;
if (not(InStrArrEx(Capitalize(Settings[II]), [PosSettings[II * 2], PosSettings[II * 2 + 1]], W))) then
begin
srl_Warn('Login_SetGraphics', 'Invalid Setting: ' + Settings[II] + ' for Option: ' + OptionName[II] + '.', warn_AllVersions);
Continue;
end;
tCol := (W mod 2) * 16777088 + 127;
if (not(FindColor(x, y, tCol, TB.x1, TB.y1, TB.x2, TB.y2))) then
begin
Mouse(TB.x1 + 10, TB.y1 + 3, 10, 7, True);
if (FindColor(x, y, tCol, TB.x1, TB.y2 + 1, TB.x2, TB.y2 + 1 + 51)) then
Mouse(x, y, 10, 7, True)
else
MouseBox(TB.x1 + 10, TB.y1 + 3, TB.x2 - 40, TB.y2 - 3, 1);
end;
end;
Wait(100);
TypeByte(vk_Escape);
MouseSpeed := mSpeed;
end;

{*******************************************************************************
procedure SetAudioOff;
By: ZephyrsFury
Description: Sets the Audio to off (1 for each bar). Works logged in and out.
*******************************************************************************}

procedure SetAudioOff;
begin
if (LoggedIn) then
SetAudio(1, 1, 1, NoChange)
else
Login_SetAudio(1, 1, 1, NoChange);
end;

{*******************************************************************************
procedure SetAutoingDefaults;
By: ZephyrsFury
Description: Sets the graphic options for best SRL compatibility. Works both logged in and out.
*******************************************************************************}

procedure SetAutoingDefaults;
begin
if (LoggedIn) then
SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off')
else
Login_SetGraphics(4, 'current', 'always', 'off', 'low', 'few', 'off', 'few', 'off');
end;

{*******************************************************************************
procedure Logout;
By: Starblaster100 / Raymond
Description: Logs you out.
*******************************************************************************}

function Logout: Boolean;
var
c, i: Integer;
begin
Result := (not (LoggedIn));
if Result = True then
Exit;
if GameTab(14) = False then
Exit;
Wait(200 + Random(100));
while (LoggedIn) and (c < 10) do
begin
Inc(c);
if(ClickText('here', UpChars, MIX1, MIY1, MIX2, MIY2, True))then
for i := 0 to 10 do
begin
Wait(1000);
if not(LoggedIn)then
begin
Result := True;
Exit;
end;
end;
end;
end;

{*******************************************************************************
procedure LoginPlayer;
By: SRL Developers
Description: Logs in the Player[CurrentPlayer]. Detects most Client Login Errors
*******************************************************************************}

procedure LoginPlayer;
var
Mark, Attempts: Integer;
Actions: TVariantArray;
RetryLogin: Boolean;
label
ProcStart;
begin
ActivateClient;
Wait(100);
TypeByte(vk_Escape);

if (GetColor(207, 409) = 238301) then //At Click To Play screen
begin
Wait(1000 + Random(3000));
MouseBox(249, 419, 521, 445, 1);
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;
if (not(RSReady)) then
begin
MarkTime(Mark);
while (not(RSReady)) do
begin
Wait(100);
if (TimeFromMark(Mark) > 180000) then
begin
WriteLn('It has been 3 minutes and Runescape is not yet ready... Terminating.');
TerminateScript;
end;
end;
WriteLn('Welcome to Runescape.');
end;

LoginScreenMusic(True);
if (not(GraphicsSet)) then
begin
SetAutoingDefaults;
GraphicsSet := True;
end;
ProcStart:

if (not(LoggedIn)) then
begin
if (not(Players[CurrentPlayer].Active)) then
begin
WriteLn('Player is not Active...');
NextPlayer(False);
Exit;
end;
Wait(900 + random(60));

//Click 'Log In' on main menu
while (GetColor(343, 175) <> 7750) do //while (GetColor(343, 174) <> 7750) do
begin
MouseBox(360, 180, 400, 185, 1);
Wait(100 + Random(100));
end;

//Type Username
Mouse(315, 272, 10, 5, True);
while (CountColor(7750, 311, 269, 452, 284) > 13) do
begin
TypeByte(VK_BACK);
Wait(50 + Random(50));
end;
for Mark := 0 to 3 do
begin
TypeByte(VK_BACK);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
WriteLn(Capitalize(Players[CurrentPlayer].Name));
TypeSend(Players[CurrentPlayer].Name);
Wait(100+random(50));

//Type Password
Mouse(315, 334, 10, 5, True);
while (CountColor(7750, 311, 337, 452, 352) > 13) do
begin
TypeByte(VK_BACK);
Wait(50 + Random(50));
end;
for Mark := 0 to 3 do
begin
TypeByte(VK_BACK);
Wait(50 + Random(50));
end;
Wait(100 + Random(200));
TypeSend(Players[CurrentPlayer].Pass);
Wait(500 + Random(300));

if GetColor(315, 239) = 197552 then //Check for pvp warning and click
MouseBox(434, 416, 481, 425, 1);

MarkTime(Mark);
repeat
SetLength(Actions, 0);

if (TimeFromMark(Mark) > 60000) then
Actions := ['One minute has passed...', 0, 2, 'NextPlayer', 'Login Failed']
else
case (CountColor(12509695, 288, 205, 475, 247)) of //Number of text colour points
// Actions := ['WriteLn Text', TimeToWait, NumberOfRetries, 'FinalAction', 'PlayerStatus'];
760: Actions := ['Too many incorrect logins.', 5 * 60000, 2, 'NextPlayer', ''];
536: Actions := ['Login limit exceeded. Please wait 1 minute and try again.', 60000, 2, 'NextPlayer', ''];
711: Actions := ['Your account has been disabled', 0, 0, 'NextPlayer', 'Acc Disabled'];
598: Actions := ['Invalid Username / Password', 0, 2, 'NextPlayer', 'Wrong User/Pass'];
787: Actions := ['Not a Members Account', 0, 0, 'NextPlayer', 'Non-member'];
408: Actions := ['World is full.', 5000, 20, 'Terminate', ''];
669: Actions := ['Your account is already logged in', 5000, 0, 'RandomNextPlayer', ''];
555: Actions := ['The Server is being updated.', 60000, 4, 'Terminate', 'Server Updating'];
218: Actions := ['Error Connecting.', 20000, 9, 'Terminate', 'Error Connecting'];
335: Actions := ['Unable to connect Login Server offline.',(20000) + Random(6000), 4, 'Terminate', 'Login Server Offline'];
512: Actions := ['RuneScape has been updated. Script Terminated.', 0, 0, 'Terminate', 'RS Updated'];
489: Actions := ['Connection timed out.', 0, 4, 'Terminate', 'Connection Timed Out'];
737: Actions := ['You are standing in a members-only area.', 0, 0, 'NextPlayer', 'In Mems-Only Area'];
//10: Actions := ['Error loading your profile.', 5000, 10, 'NextPlayer', 'Profile Loading Failed']; // Error loading your profile. Will attempt to re-login 5 more times.)
//11: Actions := ['Login server rejected session.', 1000, 10, 'NextPlayer', 'Login Serv. Rejected']; // Login server rejected session.
end;

if (Length(Actions) > 0) then
begin
WriteLn(Actions[0]);
Wait(Actions[1] + Random(100));
if (Actions[2] <> 0) then
if (Attempts < Actions[2]) or (Actions[2] = -1) then
begin
RetryLogin := True;
Break;
end;
if (Actions[4] <> '') then
Players[CurrentPlayer].Loc := Actions[4];
case Actions[3] of
'NextPlayer': NextPlayer(False);
'RandomNextPlayer': RandomNextPlayer(True);
'Terminate': TerminateScript;
end;
Exit;
end;
Wait(100);
until (GetColor(207, 409) = 238301) or (LoggedIn);

if (RetryLogin) then
begin
RetryLogin := False;
Inc(Attempts);
goto ProcStart;
end;

if (GetColor(207, 409) = 238301) then
begin
Wait(500 + Random(1000));
MouseBox(249, 419, 521, 445, 1);
end;
MarkTime(Mark);
while (TimeFromMark(Mark) < 30000) and (not(LoggedIn)) do
Wait(1000 + Random(1000));
end;

if (LoggedIn) then
begin
PlayerStartTime := (GetSystemTime div 1000); // PlayerStartTime
if Length(Players[CurrentPlayer].NickTPA) < 2 then
begin;
Writeln('Creating the NickTPA.');
if Players[CurrentPlayer].Nick <> '' then
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Nick, UpChars)
else
begin;
Writeln('Nickname isn''t set, taking the username instead..');
Players[CurrentPlayer].NickTPA := CreateTPAFromText(Players[CurrentPlayer].Name, UpChars);
end;
end;
AddToSRLLog('Current player: ' + Capitalize(Players[CurrentPlayer].Name));
end;
end;

{*******************************************************************************
procedure RandomNextPlayer(Active: Boolean);
By: Dankness based on WT-Fawki's NextPlayer and modified by Ron and by Raymond
Description: Picks Random Player that is Active and Logs in
*******************************************************************************}

procedure RandomNextPlayer(Active: Boolean);
var
LastPlayer: Integer;
begin
WriteLn('NextPlayer');
LastPlayer := CurrentPlayer;
Players[CurrentPlayer].Active := Active;
Logout;
PlayerCurTime := (GetSystemTime div 1000);
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
((PlayerCurTime - PlayerStartTime) / 60);
repeat
if (AllPlayersInactive) then Wait(5000);
if (PlayersActive = 1) then Break;
CurrentPlayer := Random(HowManyPlayers);
Wait(100);
until (Players[CurrentPlayer].Active) and (LastPlayer <> CurrentPlayer);
SRL_Logs := SRL_Logs + 1;
LoginPlayer;
end;

{*******************************************************************************
procedure NextPlayer(Active: Boolean);
By: Dankness and modified by Ron and by Raymond
Description: Logs in the next player.
Boolean: True - Current player is ok. False - Current player is false.
*******************************************************************************}

procedure NextPlayer(Active: Boolean);
begin
if RandomPlayer then
RandomNextPlayer(Active)
else
begin
WriteLn('NextPlayer(Active: ' + BoolToStr(Active)+ ');');
Players[CurrentPlayer].Active := Active;
Logout;
if (SRL_Procs[srl_OnNextPlayer] <> nil) then
SRL_Procs[srl_OnNextPlayer]();
PlayerCurTime := (GetSystemTime div 1000);
Players[CurrentPlayer].Worked := Players[CurrentPlayer].Worked +
((PlayerCurTime - PlayerStartTime) / 60);
CurrentPlayer := (CurrentPlayer + 1) mod Length(Players);
while Players[CurrentPlayer].Active = False do
begin
CurrentPlayer := (CurrentPlayer + 1) mod Length(Players);
if (AllPlayersInactive) then Wait(5000); // Everybody False. Endless Loop.
end;
SRL_Logs := SRL_Logs + 1;
LoginPlayer;
end;
end;

{*******************************************************************************
procedure CheckUserNicks;
By: Sumilion, Raymond, and Nava2
Description: Checks if all nicks are set correct.
*******************************************************************************}

procedure CheckUserNicks;
var
I, II: Integer;
Wrong, FWrong: Boolean;
WarnStrings: TStringArray;
begin
WarnStrings := ['Please fill in your nickname.', 'Please Uncapitalise your nickname.',
'Dont use the first letter in your nick.', 'Dont use spaces in your Nick.',
'Nick does NOT match the name.'];
for i := 0 to HowManyPlayers - 1 do
for II := 0 to 4 do
begin
case II of
0: Wrong := (Players[i].Nick = '');
1: Wrong := (Players[i].Nick <> LowerCase(Players[i].Nick));
2: Wrong := (Pos(Players[i].Nick, LowerCase(Players[i].Name)) = 1);
3: Wrong := (Pos(' ', Players[i].Nick) > 0);
4: Wrong := (Pos(LowerCase(Players[i].Nick), Capitalize(LowerCase(Players[i].Name))) = 0);
end;
if Wrong then
begin;
Writeln('--');
Writeln('WARNING: ' + WarnStrings[II] + ' with player: ' + Players[i].Name);
FWrong := True;
end;
end;
if FWrong then
begin
Writeln('');
//Writeln('For more information, visit [url]http://www.villavu.com/forum/showthread.php?t=5410');[/url]
end;
end;

Devs, feel free to edit in new posts. :)

Redeye_6

2009-04-04 11:19:10

Are we suppose to Replace FFlag(Dist: Integer), and Flag: Boolean with FFlag(0)?

JPHamlett

2009-04-04 12:43:11

what do i repelace the whole file or just the little parts of it

ian.

2009-04-04 12:55:13

just FFlag and Flag..

tazzin44

2009-04-04 15:40:11

what about Reflections fflag, can this be used to fix that as well?

Nava2

2009-04-04 15:46:11

Tazzin, yes it can be. Its not as accurate, but it will do the same. :)

Also, just replace the functions listed.

tazzin44

2009-04-04 15:49:24

ty nava ;p <3

jas0npc

2009-04-04 17:27:15

thanks for taking the time to post and make sticky

lordsaturn

2009-04-04 18:18:58

From: jas0npc
thanks for taking the time to post and make sticky

Haha, thanks for making sticky Nava.

[/spam]

noidea

2009-04-04 20:05:03

It doesnt detect when you're not moving and the flag is still there.

Edit: Nvm, I put Flag instead of Flag2 (The why I have it setup)
Testing now

Edit2: Works

Kasi

2009-04-04 20:13:29

why dont we just remove flag and keep fflag since there's no point of having flag; and fflag(0);

noidea

2009-04-04 21:01:11

Bah, sorry double post :redface:

Redeye_6

2009-04-04 22:14:41

K, I am really lost. First of all, I copied the code in this thread and put in '/core'/ folder of SRL. Next, I tested a script and the flag issue still was not fixed. Am I suppose to alter the code? For example, I believe im suppose to replace (QUOTE) "just FFlag and Flag.." which was said by 99_. Replace this with what? FFlag(0), Flag2? I am confused.. Please tell me if im doing it correct or not, I would appreciate it very much. Thanks..

ZephyrsFury

2009-04-04 22:17:27

From: Redeye_6
K, I am really lost. First of all, I copied the code in this thread and put in '/core'/ folder of SRL. Next, I tested a script and the flag issue still was not fixed. Am I suppose to alter the code? For example, I believe im suppose to replace (QUOTE) "just FFlag and Flag.." which was said by 99_. Replace this with what? FFlag(0), Flag2? I am confused.. Please tell me if im doing it correct or not, I would appreciate it very much. Thanks..


Go to SRL > SRL > Core > FlagChat.scar and find the functions: FFlag and Flag. Replace those with the functions above.

Redeye_6

2009-04-04 22:31:07

From: ZephyrsFury
Go to SRL > SRL > Core > FlagChat.scar and find the functions: FFlag and Flag. Replace those with the functions above.


What functions above? Flag? FFlag(0)? fflag?
Thanks.

ian.

2009-04-04 22:34:41

omg..

replace you're WHOLE FlagChat.scar with..


//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Mouse Flag & Chat Routines --//
//-----------------------------------------------------------------//
// * function Flag: Boolean; // * by PPLSUQBAWLZ/Odie533
// * function FlagPresent: Boolean; // * by Mutant Squirrle
// * function FlagDistance: Integer; // * by PPLSUQBAWLZ/Odie533
// * Function MFF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * Function MFNF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * procedure FFlag(Distance: Integer); // * by Wizzup? / WT-Fakawi.
// * procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer); // * by RsN edit by EvilChicken!
// * procedure SetChat(state: String; chat: Integer); // * by Wizzup? modded by WT-Fakawi and Starblaster100
// * procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string); // * by ZephyrsFury
// * procedure ChatsOff; // * by Starblaster100

{*******************************************************************************
function Flag: Boolean;
By: PPLSUQBAWLZ/Odie533
Description: Waits while flag exists.
*******************************************************************************}

function Flag: Boolean;
begin
Result := FFlag(0);
end;

{*******************************************************************************
function FlagPresent: Boolean;
By: Mutant Squirrle
Description: T/F depending on flag exist.
*******************************************************************************}

function FlagPresent: Boolean;
var
x, y: integer;
begin
Result := FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2);
end;

{*******************************************************************************
function FlagDistance: Integer;
By: PPLSUQBAWLZ/Odie533
Description: Returns distance in pixels your char dot is from flag on mini-map
*******************************************************************************}

function FlagDistance: Integer;
var
x, y: Integer;
begin
If findcolor(x, y, 255, MMX1, MMy1, MMX2, MMY2) Then
Result := Distance(MMCX, MMCY, x + 1, y + 14);
end;

{*******************************************************************************
Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: If the flag is not present it will click at (ax, ay) increasing by
(xmod, ymod) 5 times or until the flag appears.
*******************************************************************************}

Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y, BreakOutTime: Integer;
begin
if (not LoggedIn) then Exit;
if (not (FlagPresent)) then
begin
xx := ax - xmod;
yy := ay - ymod;
MarkTime(BreakOutTime);
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(10);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True
Exit;
end;
until TimeFromMark(TT) > 3000;
end;
Result := False;
end;
end;

{*******************************************************************************
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: Like MFF except it will click even if the flag is present when the
function is called.
*******************************************************************************}

Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
xx := ax - xmod;
yy := ay - ymod;
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(100);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True;
Exit;
end;
until TimeFromMark(TT) > 3000;
end;
end;


{*******************************************************************************
procedure FFlag(Distance: Integer);
By: Wizzup? / WT-Fakawi.
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}

{*******************************************************************************
procedure FFlag(Distance: Integer);
By: Wizzup? / WT-Fakawi / ZephyrsFury
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}

function FFlag(Dist: Integer): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindColor(Tx, Ty, 255, MMX1, MMY1, MMX2, MMY2)) do
begin
D1 := Distance(Tx + 1, Ty + 14, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
Wait(20);
if (GetSystemTime - M > 10000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
end;

{*******************************************************************************
procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
By: RsN edit by EvilChicken!
Description: Mouse and Flag combined into one easy procedure.
*******************************************************************************}

procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
var
i: Integer;
begin
if (not LoggedIn) then Exit;
Mouse(cx, cy, rx, ry, True);
while (not FlagPresent) and (i < 10) do
begin
Wait(100);
Inc(i);
end;
FFlag(FlagDist);
Wait(300 + Random(200));
end;

{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup? modded by WT-Fakawi and Starblaster100
Description: Sets Chat to desired state
*******************************************************************************}

procedure SetChat(state: string; chat: Integer);
var
x, y, mx, my, Color: Integer;
begin
case chat of
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;
my := 496;
case LowerCase(State) of
'on': begin Color := 65280; State :='On'; end;
'off': begin Color := 255; State :='Off'; end;
'hide': begin Color := 16776960; State :='Hide'; end;
'friends': begin Color := 65535; State :='Friends'; end;
else srl_Warn('SetChat', state + ' does not exist.', warn_AllVersions);
end;
if not FindColor(x, y, Color, mx - 10, my - 10, mx + 10, my + 10) then
begin
Mouse(mx, my, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;

{*******************************************************************************
procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
By: ZephyrsFury
Description: Sets all the chats to a particular state in one simple procedure.
Leave the parameter as '' if you wish to leave the chat as it is:
Example: SetAllChats('on', 'friends', '', 'off', '');
*******************************************************************************}

procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
var
States: TStringArray;
II: Integer;
begin
if (not(LoggedIn)) then Exit;
States := ['', Pub, Priv, Clan, Trade, Assist];
for II := 1 to 5 do
begin
if (States[II] = '') then Continue;
States[II] := Lowercase(States[II]);
if ((II <> 1) and (States[II] = 'hide')) or ((States[II] <> 'on') and
(States[II] <> 'friends') and (States[II] <> 'off') and (States[II] <> 'hide')) then
begin
srl_Warn('SetAllChats', 'ChatState ''' + States[II] + ''' does not exist for chat ''' + IntToStr(II) + ''' ', warn_AllVersions);
Continue;
end;
SetChat(States[II], II);
end
end;

{*******************************************************************************
procedure ChatsOff;
By: Starblaster100
Description: Sets all Chats to off.
*******************************************************************************}

Procedure ChatsOff;
var
i: Integer;
Begin
For i := 1 to 5 do
SetChat('off', i);
end;

Redeye_6

2009-04-04 22:38:05

Alright, i did what yout told me and now it told me this… =/

Line 24: [Error] (4757:11): Unknown identifier 'FFlag' in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/FlagChat.scar

ian.

2009-04-04 22:44:03

lol I know ^^

didn't mean to sound rude.. just a lot of IRL stuff going on.. =X

sowwy <3

forgive me? :]

Redeye_6

2009-04-04 22:47:55

Yea i know what you mean… But now read my edited post ^^

Sorry for double posting.

ZaSz

2009-04-04 22:48:13

From: Redeye_6
Alright, i did what yout told me and now it told me this… =/

Line 24: [Error] (4757:11): Unknown identifier 'FFlag' in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/FlagChat.scar


99 was trying to hurry up.

its


//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Mouse Flag & Chat Routines --//
//-----------------------------------------------------------------//
// * function Flag: Boolean; // * by PPLSUQBAWLZ/Odie533
// * function FlagPresent: Boolean; // * by Mutant Squirrle
// * function FlagDistance: Integer; // * by PPLSUQBAWLZ/Odie533
// * Function MFF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * Function MFNF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * procedure FFlag(Distance: Integer); // * by Wizzup? / WT-Fakawi.
// * procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer); // * by RsN edit by EvilChicken!
// * procedure SetChat(state: String; chat: Integer); // * by Wizzup? modded by WT-Fakawi and Starblaster100
// * procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string); // * by ZephyrsFury
// * procedure ChatsOff; // * by Starblaster100

{*******************************************************************************
procedure FFlag(Distance: Integer);
By: Wizzup? / WT-Fakawi / ZephyrsFury
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}

function FFlag(Dist: Integer): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindColor(Tx, Ty, 255, MMX1, MMY1, MMX2, MMY2)) do
begin
D1 := Distance(Tx + 1, Ty + 14, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
Wait(20);
if (GetSystemTime - M > 10000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
end;
{*******************************************************************************
function Flag: Boolean;
By: PPLSUQBAWLZ/Odie533
Description: Waits while flag exists.
*******************************************************************************}

function Flag: Boolean;
begin
Result := FFlag(0);
end;

{*******************************************************************************
function FlagPresent: Boolean;
By: Mutant Squirrle
Description: T/F depending on flag exist.
*******************************************************************************}

function FlagPresent: Boolean;
var
x, y: integer;
begin
Result := FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2);
end;

{*******************************************************************************
function FlagDistance: Integer;
By: PPLSUQBAWLZ/Odie533
Description: Returns distance in pixels your char dot is from flag on mini-map
*******************************************************************************}

function FlagDistance: Integer;
var
x, y: Integer;
begin
If findcolor(x, y, 255, MMX1, MMy1, MMX2, MMY2) Then
Result := Distance(MMCX, MMCY, x + 1, y + 14);
end;

{*******************************************************************************
Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: If the flag is not present it will click at (ax, ay) increasing by
(xmod, ymod) 5 times or until the flag appears.
*******************************************************************************}

Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y, BreakOutTime: Integer;
begin
if (not LoggedIn) then Exit;
if (not (FlagPresent)) then
begin
xx := ax - xmod;
yy := ay - ymod;
MarkTime(BreakOutTime);
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(10);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True
Exit;
end;
until TimeFromMark(TT) > 3000;
end;
Result := False;
end;
end;

{*******************************************************************************
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: Like MFF except it will click even if the flag is present when the
function is called.
*******************************************************************************}

Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
xx := ax - xmod;
yy := ay - ymod;
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(100);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True;
Exit;
end;
until TimeFromMark(TT) > 3000;
end;
end;

{*******************************************************************************
procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
By: RsN edit by EvilChicken!
Description: Mouse and Flag combined into one easy procedure.
*******************************************************************************}

procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
var
i: Integer;
begin
if (not LoggedIn) then Exit;
Mouse(cx, cy, rx, ry, True);
while (not FlagPresent) and (i < 10) do
begin
Wait(100);
Inc(i);
end;
FFlag(FlagDist);
Wait(300 + Random(200));
end;

{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup? modded by WT-Fakawi and Starblaster100
Description: Sets Chat to desired state
*******************************************************************************}

procedure SetChat(state: string; chat: Integer);
var
x, y, mx, my, Color: Integer;
begin
case chat of
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;
my := 496;
case LowerCase(State) of
'on': begin Color := 65280; State :='On'; end;
'off': begin Color := 255; State :='Off'; end;
'hide': begin Color := 16776960; State :='Hide'; end;
'friends': begin Color := 65535; State :='Friends'; end;
else srl_Warn('SetChat', state + ' does not exist.', warn_AllVersions);
end;
if not FindColor(x, y, Color, mx - 10, my - 10, mx + 10, my + 10) then
begin
Mouse(mx, my, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;

{*******************************************************************************
procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
By: ZephyrsFury
Description: Sets all the chats to a particular state in one simple procedure.
Leave the parameter as '' if you wish to leave the chat as it is:
Example: SetAllChats('on', 'friends', '', 'off', '');
*******************************************************************************}

procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
var
States: TStringArray;
II: Integer;
begin
if (not(LoggedIn)) then Exit;
States := ['', Pub, Priv, Clan, Trade, Assist];
for II := 1 to 5 do
begin
if (States[II] = '') then Continue;
States[II] := Lowercase(States[II]);
if ((II <> 1) and (States[II] = 'hide')) or ((States[II] <> 'on') and
(States[II] <> 'friends') and (States[II] <> 'off') and (States[II] <> 'hide')) then
begin
srl_Warn('SetAllChats', 'ChatState ''' + States[II] + ''' does not exist for chat ''' + IntToStr(II) + ''' ', warn_AllVersions);
Continue;
end;
SetChat(States[II], II);
end
end;

{*******************************************************************************
procedure ChatsOff;
By: Starblaster100
Description: Sets all Chats to off.
*******************************************************************************}

Procedure ChatsOff;
var
i: Integer;
Begin
For i := 1 to 5 do
SetChat('off', i);
end;

He replaced at wrong spots.

Redeye_6

2009-04-04 22:51:30

Alright, "looks" like its working now. Thanks for all your help guys. =]

ian.

2009-04-04 23:00:42

=X wow lol I feel stupid…

thanks zasz ^^

04basir

2009-04-05 07:57:50

From: zasz
99 was trying to hurry up.

its


//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- » Mouse Flag & Chat Routines --//
//-----------------------------------------------------------------//
// * function Flag: Boolean; // * by PPLSUQBAWLZ/Odie533
// * function FlagPresent: Boolean; // * by Mutant Squirrle
// * function FlagDistance: Integer; // * by PPLSUQBAWLZ/Odie533
// * Function MFF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * Function MFNF(ax, ay, xmod, ymod: Integer):Boolean; // * by WT-Fakawi
// * procedure FFlag(Distance: Integer); // * by Wizzup? / WT-Fakawi.
// * procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer); // * by RsN edit by EvilChicken!
// * procedure SetChat(state: String; chat: Integer); // * by Wizzup? modded by WT-Fakawi and Starblaster100
// * procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string); // * by ZephyrsFury
// * procedure ChatsOff; // * by Starblaster100

{*******************************************************************************
procedure FFlag(Distance: Integer);
By: Wizzup? / WT-Fakawi / ZephyrsFury
Description: Waits until Flag is within "Distance" distance.
*******************************************************************************}

function FFlag(Dist: Integer): Boolean;
var
Tx, Ty, M, D1, D2: Integer;
begin
Result := False;
M := GetSystemTime;
while (FindColor(Tx, Ty, 255, MMX1, MMY1, MMX2, MMY2)) do
begin
D1 := Distance(Tx + 1, Ty + 14, MMCX, MMCY);
if (D1 <= Dist) then
begin
Result := True;
Exit;
end;
Wait(20);
if (GetSystemTime - M > 10000) then
begin
if (D1 = D2) then Exit;
D2 := D1;
M := GetSystemTime;
end;
if (Random(20) = 0) then IdleTime(500, 1000, 0.01);
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
end;
end;
{*******************************************************************************
function Flag: Boolean;
By: PPLSUQBAWLZ/Odie533
Description: Waits while flag exists.
*******************************************************************************}

function Flag: Boolean;
begin
Result := FFlag(0);
end;

{*******************************************************************************
function FlagPresent: Boolean;
By: Mutant Squirrle
Description: T/F depending on flag exist.
*******************************************************************************}

function FlagPresent: Boolean;
var
x, y: integer;
begin
Result := FindColor(x, y, 255, MMX1, MMY1, MMX2, MMY2);
end;

{*******************************************************************************
function FlagDistance: Integer;
By: PPLSUQBAWLZ/Odie533
Description: Returns distance in pixels your char dot is from flag on mini-map
*******************************************************************************}

function FlagDistance: Integer;
var
x, y: Integer;
begin
If findcolor(x, y, 255, MMX1, MMy1, MMX2, MMY2) Then
Result := Distance(MMCX, MMCY, x + 1, y + 14);
end;

{*******************************************************************************
Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: If the flag is not present it will click at (ax, ay) increasing by
(xmod, ymod) 5 times or until the flag appears.
*******************************************************************************}

Function MFF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y, BreakOutTime: Integer;
begin
if (not LoggedIn) then Exit;
if (not (FlagPresent)) then
begin
xx := ax - xmod;
yy := ay - ymod;
MarkTime(BreakOutTime);
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(10);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True
Exit;
end;
until TimeFromMark(TT) > 3000;
end;
Result := False;
end;
end;

{*******************************************************************************
Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
By: WT-Fakawi
Description: Like MFF except it will click even if the flag is present when the
function is called.
*******************************************************************************}

Function MFNF(ax, ay, xmod, ymod: Integer):Boolean;
var
TT, i, xx, yy, x, y: Integer;
begin
Result := False;
if (not LoggedIn) then Exit;
xx := ax - xmod;
yy := ay - ymod;
for i := 0 to 4 do
begin
xx := xx + xmod;
yy := yy + ymod;
if rs_OnMiniMap(xx, yy) then
Mouse(xx, yy, 2, 2, True)
else
Continue;
Wait(50);
MarkTime(TT);
repeat
Wait(100);
if FindColor(x, y, 255, MMx1, MMy1, MMx2, MMy2) then
begin
Result := True;
Exit;
end;
until TimeFromMark(TT) > 3000;
end;
end;

{*******************************************************************************
procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
By: RsN edit by EvilChicken!
Description: Mouse and Flag combined into one easy procedure.
*******************************************************************************}

procedure MouseFlag(cx, cy, rx, ry, FlagDist: Integer);
var
i: Integer;
begin
if (not LoggedIn) then Exit;
Mouse(cx, cy, rx, ry, True);
while (not FlagPresent) and (i < 10) do
begin
Wait(100);
Inc(i);
end;
FFlag(FlagDist);
Wait(300 + Random(200));
end;

{*******************************************************************************
procedure SetChat(state: String; chat: Integer);
By: Wizzup? modded by WT-Fakawi and Starblaster100
Description: Sets Chat to desired state
*******************************************************************************}

procedure SetChat(state: string; chat: Integer);
var
x, y, mx, my, Color: Integer;
begin
case chat of
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;
my := 496;
case LowerCase(State) of
'on': begin Color := 65280; State :='On'; end;
'off': begin Color := 255; State :='Off'; end;
'hide': begin Color := 16776960; State :='Hide'; end;
'friends': begin Color := 65535; State :='Friends'; end;
else srl_Warn('SetChat', state + ' does not exist.', warn_AllVersions);
end;
if not FindColor(x, y, Color, mx - 10, my - 10, mx + 10, my + 10) then
begin
Mouse(mx, my, 8, 8, False);
Wait(450 + Random(175));
ChooseOption(State);
end;
end;

{*******************************************************************************
procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
By: ZephyrsFury
Description: Sets all the chats to a particular state in one simple procedure.
Leave the parameter as '' if you wish to leave the chat as it is:
Example: SetAllChats('on', 'friends', '', 'off', '');
*******************************************************************************}

procedure SetAllChats(Pub, Priv, Clan, Trade, Assist: string);
var
States: TStringArray;
II: Integer;
begin
if (not(LoggedIn)) then Exit;
States := ['', Pub, Priv, Clan, Trade, Assist];
for II := 1 to 5 do
begin
if (States[II] = '') then Continue;
States[II] := Lowercase(States[II]);
if ((II <> 1) and (States[II] = 'hide')) or ((States[II] <> 'on') and
(States[II] <> 'friends') and (States[II] <> 'off') and (States[II] <> 'hide')) then
begin
srl_Warn('SetAllChats', 'ChatState ''' + States[II] + ''' does not exist for chat ''' + IntToStr(II) + ''' ', warn_AllVersions);
Continue;
end;
SetChat(States[II], II);
end
end;

{*******************************************************************************
procedure ChatsOff;
By: Starblaster100
Description: Sets all Chats to off.
*******************************************************************************}

Procedure ChatsOff;
var
i: Integer;
Begin
For i := 1 to 5 do
SetChat('off', i);
end;

He replaced at wrong spots.





Forgive my noobness so.. all i have to do is open my flagchat found in core then remove everything and paste this one ? sorry am new at these stuff but am havin the flag problems is well and i get this error when i play this script

Line 28: [Error] (28:31): Unknown identifier 'MMX1' in script C:\Program Files\SCAR 3.15\Includes\SRL\SRL\core\FlagChat.scar

senrath

2009-04-05 07:58:33

From: 04basir
Forgive my noobness so.. all i have to do is open my flagchat found in core then remove everything and paste this one ? sorry am new at these stuff but am havin the flag problems is well


Simply put, yes.

04basir

2009-04-05 08:18:32

From: senrath
Simply put, yes.


can u read my new edited post please? = (

senrath

2009-04-05 08:22:17

From: 04basir
can u read my new edited post please? = (


Sure. Don't run FlagChat. Simply copy the new version in place of the old one, and save it. Then use your regular scripts.

04basir

2009-04-05 08:55:14

From: senrath
Sure. Don't run FlagChat. Simply copy the new version in place of the old one, and save it. Then use your regular scripts.

thnx alot for helping i did that now when i play my script its still thinking its walking when its right next to the flag on the minimap o well i guess something might be rong with script.. thnx alot for helping XD

Nava2

2009-04-05 11:03:48

Added the full FlagChat.scar

Also added the Login Player fixes.

yourock12345

2009-04-08 17:05:13

what the hell? right when i change it i get this error… Line 25: [Error] (5495:1): Identifier expected in script C:\Program Files (x86)\SCAR 3.15\includes\SRL/SRL/Core/Mapwalk.scar help me?

Nava2

2009-04-08 17:45:22

Did you copy the entire thing?

yourock12345

2009-04-08 19:05:31

yupp. nvm fixed delete

Smile

2009-04-08 19:20:49

The login is not working for me, Line 36: [Error] (36:12): Unknown identifier 'LoggedIn' in script E:\Programs\SCAR 3.15\includes\SRL\SRL\Core\Login.scar

yourock12345

2009-04-08 19:31:29

wow… now that is messed up… redownload ur srl than make sure you are going to
SCAR 3.15\Includes\SRL\SRL\core/login.scar

mrpickle

2009-04-08 19:37:06

Works nicely now =D.

Baked0420

2009-04-08 23:36:54

Nava, you need to take out the Url tags, for some reason you have them in what you are telling people to copy and paste, and people who don't know how to script will never pick up on it, they'll wind up just destroying their login.scar file. You should fix that for the leechers, don't forget in the string to take out the opening Url tag. It's the 3rd to last line in login.scar and its under CheckUserNicks procedure.

boomitzben

2009-04-09 00:21:31

I am having trouble with the LOGIN fix i am getting Line 551: [Error] (5610:96): Identifier expected in script C: Program Files/Scar 3.15/includes/SRL/SRL/Core/ Login.scar

and Line 36: [Error] (36:12): Unknown identifier 'LoggedIn' in script C: Program Files/Scar 3.15/includes/SRL/SRL/Core/ Login.scar

any help would be appreciated

hello world

2009-04-09 00:28:33

take out the url tag.

Nava2

2009-04-09 00:51:02

All fixed up, it did that on its own. :eek:

lorenz00

2009-04-09 23:02:35

much appreciated for the hard work!

and for the people having problems (Line 551: [Error] (5610:96): Identifier expected in script C: Program Files/Scar 3.15/includes/SRL/SRL/Core/ Login.scar) as mentioned before:

you have to remove the "" text wich is on the third last line, i take it is because its not a scar command and messes it up.

Nava2

2009-04-10 13:18:02

From: lorenz00
much appreciated for the hard work!

and for the people having problems (Line 551: [Error] (5610:96): Identifier expected in script C: Program Files/Scar 3.15/includes/SRL/SRL/Core/ Login.scar) as mentioned before:

you have to remove the "" text wich is on the third last line, i take it is because its not a scar command and messes it up.


Nice to see a contribution ;)

Yes, the URL tags got added because vBulliton tried to parse the urls in the scar tags.. not sure why really.. o.O

ZaSz

2009-04-10 13:37:49

Nava, just edit the post and take out the http part. And it wont do that.

botsrs

2009-04-10 15:20:47

You ROCK! Thanks for the Easter login update!

JPHamlett

2009-04-10 21:17:24

hey u said the new srl is it being released soon??

Nava2

2009-04-10 23:10:27

Probably in a few days, no guarantees though.

Bro

2009-04-11 06:37:46

OK… I'm gonna need a 100% tutorial on how and where to insert this into my SCAR File's.

Literally ANY help would be appreciated :S



:norris:

ZephyrsFury

2009-04-11 07:03:03

From: Bro
OK… I'm gonna need a 100% tutorial on how and where to insert this into my SCAR File's.

Literally ANY help would be appreciated :S



:norris:



  1. Go to your SCAR folder.
  2. Then go to includes > SRL > SRL > core.
  3. Open up FlagChat.scar
  4. Delete the contents of FlagChat.scar
  5. Copy and Paste the FlagChat.scar from the first post into FlagChat.scar and Save
  6. Now go to Login.scar and repeat 3 - 5 except using Login.scar and Login.scar from the first post.

Bro

2009-04-11 08:06:07

From: ZephyrsFury
  1. Go to your SCAR folder.
  2. Then go to includes > SRL > SRL > core.
  3. Open up FlagChat.scar
  4. Delete the contents of FlagChat.scar
  5. Copy and Paste the FlagChat.scar from the first post into FlagChat.scar and Save
  6. Now go to Login.scar and repeat 3 - 5 except using Login.scar and Login.scar from the first post.


I fricken love you man!@!@Not to mention Nava2!! gonna test this now, THANK'S SO MUCH!@#$%

EDIT: IT WORKED!@! OH GOD, IT WORKED!@@! YOU'RE AWESOME!!!


:norris:

tom43

2009-04-14 17:54:32

okay i got this error what does that mean?

Failed when compiling
Line 201: [Error] (5440:1): Unknown identifier 'MFNF' in script C:\Program Files\SCAR 3.15\includes\SRL/SRL/Core/Mapwalk.scar

I got this when i tried to run a script, i thought it might just be the script so i tried another and it didn't work either.

EDIT: okay wow for the fourth time the i replaced the FlagChat scar it worked randomly. So its okay, idk what happened maybe it didnt copy all of it but works good thanks!

TomTuff

2009-04-16 10:22:55

mind wrapping in scart tags so we can just copy and paste the whole danm thing?
*attempting* to get both right now for edgy fisher

ZephyrsFury

2009-04-17 06:50:21

The fixes from this thread are no longer needed. All fixes can now be found in Rev #32. Please get that instead.

Thanks for all your help,
Zeph.

Nava2 Edit: POWA ABUSE!