SCAR Code:
function IsKeyDown(C:Char): Boolean;
// BETA. Not sure if it works. ~Wizzup?
begin
Result := SmartIsKeyDown(ord(c));
end;
procedure MoveMouse(x, y: Integer);
begin
SmartMoveMouse(x, y);
end;
procedure HoldMouse(x, y: Integer; left: Boolean);
begin
SmartHoldMouse(x, y, left);
end;
procedure ReleaseMouse(x, y: Integer; left: Boolean);
begin
SmartReleaseMouse(x, y, left);
end;
procedure KeyUp(key: Byte);
begin
If Key = 13 Then
Key := 10;
SmartReleaseKey(key);
end;
procedure KeyDown(key: Byte);
begin
If Key = 13 Then
Key := 10;
SmartHoldKey(key);
end;
procedure SendKeys(S: String);
begin
SmartSendKeys(S);
end;
function GetColor(x, y: Integer): Integer;
begin
result:= SmartGetColor(x, y);
end;
procedure SmartSetTarget;
var
Smart_Bitmap: Integer;
begin
Smart_Bitmap:= BitmapFromString(765,503,'');
GetBitmapCanvas(Smart_Bitmap).Handle:= SmartGetDC;
SetTargetBitmap(Smart_Bitmap);
FreeBitmap(Smart_Bitmap);
end;
function FindWindow(Title: String): Boolean;
begin
result:= true;
end;
procedure ActivateClient;
begin
end;
function FindWindowBySize(Width, Height: Integer): Boolean;
begin
result:= true;
end;
procedure SmartSetupEx(worldnumber: integer; safe, signed, superdetail: boolean);
var
prefix: string;
begin
prefix := ReadINI('World' + IntToStr(worldnumber), 'Prefix', AppPath + 'includes\SRL\SCSS\worlds.ini');
if(prefix = '')then
begin
writeln('Invalid world number or corrupted world list. Please review your settings');
TerminateScript;
end;
SmartSetup(prefix, safe, signed, superDetail);
end;
Procedure SaveScreenshot(s : string);
var
TempBMP : integer;
TempS : String;
begin;
Temps := s;
While FileExists(Temps) do
begin;
Temps := ExtractFilePath(s) + Copy(ExtractFileName(Temps),1,LastPos('.',ExtractFileName(Temps))-1) + '2' + ExtractFileExt(s);
Writeln(Temps);
end;
TempBMP := BitmapFromString(765,503,'');
Try
CopyClientToBitmap(TempBMP,0,0,765,503);
SaveBitmap(TempBMP, Temps);
Except
end;
FreeBitmap(TempBMP);
end;
SCAR Code:
{credits to JuKKa and everyone who helped JuKKa and every one who helped me
Other main credits to N3ss3s for GetPaintBitmap and also to Lee Lok Hin for beating me to putting in tiles also to bobarkinator for the concept of small chars instead of upchars}
program ReflectionAid;
{.include SRL/SRL/Misc/Smart2.scar}
{.include srl/srl.scar}
{.include srl/srl/reflection/reflection.scar}
var
i, x,y :integer;
Function GetPaintBitmap(sX, sY: Integer; Text: TStringArray; Dist: Integer): Integer;
Var
TPA: TPointArray;
H, Q, B: Integer;
Begin
Result := BitmapFromString(sX, sY, '');
For B := 0 To High(Text) Do
Begin
TPA := LoadTextTPA(Text[b], SmallChars, H);
For Q := 0 To High(TPA) Do
FastSetPixel(Result, TPA[q].x, TPA[q].y + B * Dist, 16777215);
End;
End;
Procedure ClearSMARTCanvas;
Var
BMP: Integer;
SMARTCanvas, Canvas: TCanvas;
Begin
BMP := BitmapFromString(765, 503, '')
SMARTCanvas := GetBitmapCanvas(BMP);
Canvas := GetBitmapCanvas(BMP);
SMARTCanvas.handle := SmartGetDebugDC;
CopyCanvas(Canvas, SMARTCanvas, 0, 0, 765, 503, -1000, -1000, 1000, 1000);
FreeBitmap(BMP);
End;
Procedure ShowNPCInfo;
Var
SCanvas, Canvas, InfoCanvas: TCanvas;
BMP: Integer;
Text: TStringArray;
NPCs: array of TNPC;
begin
NPCs:=getnpcs;
if not(LoggedIn) then Exit;
SmartSetDebug(True);
BMP := BitmapFromString(765, 503, '');
SCanvas := GetBitmapCanvas(BMP);
InfoCanvas := GetBitmapCanvas(BMP);
SCanvas.handle := SmartGetDebugDC;
getmousepos(x,y);
for i := 0 to high(NPCs) do
begin
if InRange(NPCs[i].MS.X,X-30,X+30) and InRange(NPCs[i].MS.Y,Y-30,Y+30) then
begin
Text := [
'NPC Name : '+NPCs[i].Name,
'NPC ID : '+IntToStr(NPCs[i].NPCType),
'NPC Tiles : ('+IntToStr(NPCs[i].Tile.X)+', '+IntToStr(NPCs[i].Tile.Y)+')']
Canvas := GetBitmapCanvas(GetPaintBitmap(400,200,text,10));
safeCopyCanvas(Canvas, SCanvas, 0, 0, 400, 200, 0,0,400,200);
While IsMouseButtonDown(True) do
Wait(30);
end;
end;
FreeBitmap(BMP);
end;
Procedure ShowAnimInfo;
Var
SCanvas, Canvas: TCanvas;
BMP, Anim: Integer;
Text: TStringArray;
begin
if not(loggedin) then Exit;
Anim:=SmartGetFieldInt(SmartGetFieldArrayObject(0,NPCArray,
SmartGetFieldArrayInt(0,NPCIndexArray,i)),CharAnim);
SmartSetDebug(True);
BMP := BitmapFromString(765, 503, '');
SCanvas := GetBitmapCanvas(BMP);
SCanvas.handle := SmartGetDebugDC;
Text := [
'Animation: '+inttostr(anim),
'Tiles : ('+IntToStr(getmypos.x)+', '+IntToStr(getmypos.y)+')']
Canvas := GetBitmapCanvas(GetPaintBitmap(400,200,text,15));
safeCopyCanvas(Canvas, SCanvas, 0, 0, 400, 200, 0,0,400,200);
FreeBitmap(BMP);
end;
Procedure SetupSMART;
Begin
SmartSetup('world37', false, false, False);
SetTargetDC(SmartGetDC);
If Not (LoggedIn) Then
While Not (SmartGetColor(360, 172) = 13158) Do
Wait(100);
End;
Procedure Setup;
begin
setupsmart;
setupsrl;
//setupreflection;
end;
Procedure DoInfo;
Var
FirstLoop : Boolean;
begin
FirstLoop:=false;
ClearSMARTCanvas;
if isfkeydown(11) then
Repeat
Showaniminfo;
If not firstloop then
while isfkeydown(11) do
wait(10);
firstloop:=true;
wait(100);
until isfkeydown(11);
if isfkeydown(9) then
writeln('Tiles : ('+IntToStr(getmypos.x)+', '+IntToStr(getmypos.y)+')')
else
shownpcinfo;
end;
begin
setup;
ClearSMARTCanvas;
repeat
DoInfo;
wait(100);
until false;
end.