SRL Archive - OSR Help

Reflection setup


DeSnob

2010-06-05 13:44:34

I am currently trying to set up reflection, and I'm using drags' reflection setup script example to see if I'm doing everything right.
program ReflectionScript;
{$DEFINE SMART}
{$i srl\srl.scar}
{$i reflection\reflection.simba}

const

{---SMART Setup Constants---}
WORLD = 32;
MEMBERS = false;
SIGNED = true;
{---------------------------}

begin
Smart_Members := MEMBERS;
Smart_Server := WORLD;
Smart_Signed := SIGNED;

SetupSRL;
SetupReflectionEx(true);

end.
Well, I've installed everything correctly. In the Simba directory, i made a folder named "reflection", and did svn checkout. But when i compile this example script, when it should say everything compiled correctly, it comes up with:
Exception in Script: Unable to find file 'srl\srl\Reflection\Constants.simba' used from 'reflection\reflection.simba'
doesn't exist
I can't seem to find what's wrong because Constants.simba IS there! :(

Nava2

2010-06-05 13:47:15

is it in Includes/Reflection/Reflection.simba

DeSnob

2010-06-05 14:05:34

From: Nava2
is it in Includes/Reflection/Reflection.simba


Yes, and when i tried putting it in srl/srl, it came with this error! (YAY)
[Error] C:\Simba\Includes\SRL/SRL/Core/Simba.simba(5:3): Duplicate identifier 'TDTMPointDef' at line 4
Compiling failed.

in this:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Simba.simba --//
//-----------------------------------------------------------------//

{$ifdef Simba}
{$loadlib irokiplugin}

//{$define SimbaDebug}
type
TDTMPointDef = TSDTMPointDef;
TDTMPointDefArray = TSDTMPointDefArray;
TDTM = TSDTM;
function AddDTM(DTM : TDTM) : integer;
begin
result := AddSDTM(dtm);
end;

function InitializeHTTPClient(HandleCookies,handleredirects: Boolean): Integer;
begin
{$ifdef SimbaDebug}
if HandleRedirects then
Writeln('Simba does not support automatic redirects yet');
{$endif}
result := InitializeHTTPClientWrap(HandleCookies);
end;

function IntToPoint(x,y : integer) : TPoint;
begin
result := Point(x,y);
end;

procedure GetColorspeed2Modifiers(var hue,sat : extended);
begin;
GetToleranceSpeed2Modifiers(hue,sat);
end;

procedure Disguise(s : string);
begin
Writeln(format('Disguising as: %s',[s]));
end;

function StartsWith(prefix, s: string): Boolean;
var
i,l : integer;
begin
result := false;
l := length(prefix);
if l > length(s) then
exit;
for i := 1 to l do
if s[i] <> prefix[i] then
exit;
result := true;
end;

procedure AddToReport(str : string);
begin
writeln('Status: ' + str);
end;
procedure ClearReport;
begin
DebugLn('Should clear report now..');
end;

procedure status(str : string);
begin
writeln(str);
end;

var
Bladieblatempthingy : TForm;
procedure CreateFormBladieblatempthingy;
begin
Bladieblatempthingy := TForm.Create(nil);
end;
procedure FreeFormBladieblatempthingy;
begin
if assigned(Bladieblatempthingy) then
Bladieblatempthingy.free;
end;
procedure FreeForm(var form : TForm);
var
v : TVariantArray;
begin;
Bladieblatempthingy := Form;
ThreadSafeCall('FreeFormBladieblatempthingy',v);
form := nil;
end;

function CreateForm : TForm;
var
v : TVariantArray;
begin;
ThreadSafeCall('CreateFormBladieblatempthingy',v);
result := Bladieblatempthingy;
end;

function IsFKeyDown(FKey : integer) : boolean;
begin
if not InRange(FKey,1,12) then
raiseexception(erCustomError,'FKey not in range 1..12');
result := IsKeyDown(VK_F1 + FKey);
end;

function GetColors(Coords : TPointArray) : TIntegerArray;
begin
GetColorsWrap(Coords,Result);
end;

procedure ColorToRGB(Color : TColor; var R,G,B : integer);
begin
R := Color and $ff;
G := Color shr 8 and $ff;
B := Color shr 16 and $ff;
end;

function Degrees(Radians: Extended): Extended;
begin
result := Radians * 180 / pi;
end;

function Radians(Degrees: Extended): Extended;
begin
result := Pi * degrees / 180;
end;

function InCircle(x, y, mx, my, r: Integer): Boolean;
begin
result := (Sqrt(sqr(x-mx) + sqr(y-my)) <= r);
end;

function CreateBitmapMaskFromText(txt,chars : string) : integer;
begin
result := BitmapFromText(txt,chars);
end;

function GetNumbers(text : string) : string;
begin;
result := ExtractFromStr(text,numbers);
end;

function GetLetters(Text: string): string;
begin
result := ExtractFromStr(Text,letters);
end;

function GetOthers(Text: string): string;
begin;
result := ExtractFromStr(text,others);
end;

function FindDTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;
begin;
result := FindDTMRotatedAlternating(DTM,x,y,x1,y1,x2,y2,sangle,eangle,astep,afound);
end;

const
tr_AllChars = 0;
tr_BigLetters = 1;
tr_SmallLetters = 2;
tr_Digits = 3;
tr_BigSymbols = 4;
tr_SmallSymbols = 5;
tr_SecondTableChars = 6;
tr_Letters = 7;
tr_AlphaNumericChars = 8;
tr_Symbols = 9;
tr_NormalChars = 10;

type
TCharRange = longword; //I donno

function GetTextAtEx(x, y: Integer; Tolerance: Integer; Chars: String; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange): anystring;
begin
// no hspacing, defaulting to 4. (with 4 ' and : will work)
// Defaulting MaxSpacing to 3
if TextColor = -1 then
raiseexception(ercustomerror,'GetTextAtEx with color = -1, is not supported');
Maxspacing := 3;
{$ifdef SimbaDebug}
Writeln([x, y, minSpacing, maxSpacing, 4, textcolor, tolerance, textlength, Chars]);
{$endif}
Result := GetTextAt(x, y, minSpacing, maxSpacing, 4, textcolor, tolerance, textlength, Chars);
{$ifdef SimbaDebug}
Writeln('GetTextAt result: ' + Result);
{$endif}
if Range = tr_Digits then
result := GetNumbers(result);
end;

function IsTextInAreaEx(xs, ys, xe, ye: Integer; var x, y: Integer; S: string; Tolerance: Integer; Chars: String; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer): Boolean;
var
TextTPA,SearchTPA, Matches: TPointArray;
Box : TBox;
xx,yy,i,len : integer;
begin
if TextColor = -1 then
raiseexception(ercustomerror,'IsTextInArea with color = -1, is not supported');
Result := False;
FindColorsTolerance(SearchTPA,TextColor,xs,ys,xe,ye,tolerance);
if Length(SearchTPA) < 1 then
Exit;
TextTPA:= TPAFromText(S,Chars,xx,yy);
Result := FindTextTPAinTPA(yy ,TextTPA,SearchTPA,Matches);
x := 0; y:=0;
if Result = False then
Exit;
Box := GetTPABounds(TextTPA);
SortTPAFrom(Matches, Point(Box.x1, Box.y1));
x := matches[0].x;
yy := 500000;
len := High(TextTPA);
for i := 0 to Len do
if TextTPA[i].x = Box.x1 then
yy := min(yy,TextTPA[i].y);
y := matches[0].y-yy;
{$ifdef SimbaDebug}
Writeln(Format('IsTextInAreaEx: (%d,%d)',[x,y]));
{$endif}
end;

function GetColorToleranceSpeed : integer;
begin;
result := GetToleranceSpeed;
end;

procedure ColorToleranceSpeed(cts : integer);
begin;
SetColorToleranceSpeed(cts);
end;

type
TColorComp = (ccRed, ccGreen, ccBlue, ccHue, ccSat, ccLum);

function FindColorComp(var x, y: Integer; Comp: Variant; CompType: TColorComp; xs, ys, xe, ye: Integer; Tolerance: Extended): Boolean;
begin
Writeln('FindColorComp is not yet implemented! Use another color finder ;-)');
Result := false;
end;

procedure SetColorspeed2Modifiers(huemodifier, saturationmodifier: Extended);
begin
SetToleranceSpeed2Modifiers(Huemodifier, saturationmodifier);
end;

function InStrArr(Str: string; Arr: TStringArray; CaseSensitive: Boolean): Boolean;
var
i : integer;
begin;
result := true;
if not casesensitive then
begin
str := lowercase(str);
for i := high(arr) downto 0 do
if lowercase(arr[i]) = str then
exit;
end else
for i := high(arr) downto 0 do
if arr[i] = str then
exit;
result := false;
end;

function Replace(Text, FindStr, ReplaceStr: string): string;
begin;
result := ReplaceWrap(Text,FindStr,ReplaceStr,[rfReplaceAll]);
end;

//Sends arrow to Client's window. For a, 0 = up, 1 = right, 2 = down, 3 = left.
procedure SendArrow(Key: Byte);
begin
if not InRange(Key,0,3) then
Writeln('KEY IS NOT INRANGE!!')
else
case key of
0 : PressKey(vk_up);
1 : PressKey(vk_right);
2 : PressKey(vk_down);
3 : PressKey(vk_left);
end;
end;

procedure SendArrowWait(Key: Byte; WaitTime: Integer);
var
KeyCode : integer;
begin;
if not InRange(Key,0,3) then
Writeln('KEY IS NOT INRANGE!!')
else
begin
case key of
0 : Keycode := (vk_up);
1 : Keycode := (vk_right);
2 : Keycode := (vk_down);
3 : Keycode := (vk_left);
end;
KeyDown(keycode);
wait(waittime);
KeyUp(keycode);
end;
end;

procedure SendArrowSilentWait(Key : byte; WaitTime : integer);
begin
SendArrowWait(key,waittime);
end;

procedure SendArrowSilent(Key : byte);
begin
SendArrow(key);
end;

function AMax(Data: TIntegerArray): Integer;
var
i : integer;
begin;
if length(data) = 0 then
begin
Writeln('cannot define result of AMax, input length = 0');
raiseexception(erCustomError,'AMax input with length of zero');
end;
result := data[0];
for i := high(data) downto 1 do
result := max(result,data[i]);
end;

function AddOnTerminate(const proc : string) : boolean;
var
OldProcs : TVariantArray;
i : integer;
begin
result := false;
GetScriptProp(SP_OnTerminate,OldProcs);
for i := 0 to high(OldProcs) do
if lowercase(OldProcs[i]) = lowercase(proc) then
exit;
setlength(OldProcs,Length(OldProcs)+1);
OldProcs[high(OldProcs)] := proc;
SetScriptProp(SP_OnTerminate,oldprocs);
result := True;
end;

function DeleteOnTerminate(const proc : string) : boolean;
var
OldProcs : TVariantArray;
NewProcs : TVariantArray;
i : integer;
begin
result := False;
GetScriptProp(SP_OnTerminate,OldProcs);
for i := 0 to high(OldProcs) do
if lowercase(OldProcs[i]) = lowercase(proc) then
result := true
else
begin
setlength(NewProcs,Length(NewProcs)+1);
NewProcs[high(NewProcs)] := lowercase(OldProcs[i]);
end;
SetScriptProp(SP_OnTerminate,NewProcs);
end;

function Readln(Question : string ) : string;
begin
InputQuery('Question box',Question,result);
end;
const
NPCChars = CharsNPC;
{$endif}
I don't know what to do :/

Camaro'

2010-06-05 19:06:45

From: DeSnob
Yes, and when i tried putting it in srl/srl, it came with this error! (YAY)
[Error] C:\Simba\Includes\SRL/SRL/Core/Simba.simba(5:3): Duplicate identifier 'TDTMPointDef' at line 4
Compiling failed.

in this:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Simba.simba --//
//-----------------------------------------------------------------//

{$ifdef Simba}
{$loadlib irokiplugin}

//{$define SimbaDebug}
type
TDTMPointDef = TSDTMPointDef;
TDTMPointDefArray = TSDTMPointDefArray;
TDTM = TSDTM;
function AddDTM(DTM : TDTM) : integer;
begin
result := AddSDTM(dtm);
end;

function InitializeHTTPClient(HandleCookies,handleredirects: Boolean): Integer;
begin
{$ifdef SimbaDebug}
if HandleRedirects then
Writeln('Simba does not support automatic redirects yet');
{$endif}
result := InitializeHTTPClientWrap(HandleCookies);
end;

function IntToPoint(x,y : integer) : TPoint;
begin
result := Point(x,y);
end;

procedure GetColorspeed2Modifiers(var hue,sat : extended);
begin;
GetToleranceSpeed2Modifiers(hue,sat);
end;

procedure Disguise(s : string);
begin
Writeln(format('Disguising as: %s',[s]));
end;

function StartsWith(prefix, s: string): Boolean;
var
i,l : integer;
begin
result := false;
l := length(prefix);
if l > length(s) then
exit;
for i := 1 to l do
if s[i] <> prefix[i] then
exit;
result := true;
end;

procedure AddToReport(str : string);
begin
writeln('Status: ' + str);
end;
procedure ClearReport;
begin
DebugLn('Should clear report now..');
end;

procedure status(str : string);
begin
writeln(str);
end;

var
Bladieblatempthingy : TForm;
procedure CreateFormBladieblatempthingy;
begin
Bladieblatempthingy := TForm.Create(nil);
end;
procedure FreeFormBladieblatempthingy;
begin
if assigned(Bladieblatempthingy) then
Bladieblatempthingy.free;
end;
procedure FreeForm(var form : TForm);
var
v : TVariantArray;
begin;
Bladieblatempthingy := Form;
ThreadSafeCall('FreeFormBladieblatempthingy',v);
form := nil;
end;

function CreateForm : TForm;
var
v : TVariantArray;
begin;
ThreadSafeCall('CreateFormBladieblatempthingy',v);
result := Bladieblatempthingy;
end;

function IsFKeyDown(FKey : integer) : boolean;
begin
if not InRange(FKey,1,12) then
raiseexception(erCustomError,'FKey not in range 1..12');
result := IsKeyDown(VK_F1 + FKey);
end;

function GetColors(Coords : TPointArray) : TIntegerArray;
begin
GetColorsWrap(Coords,Result);
end;

procedure ColorToRGB(Color : TColor; var R,G,B : integer);
begin
R := Color and $ff;
G := Color shr 8 and $ff;
B := Color shr 16 and $ff;
end;

function Degrees(Radians: Extended): Extended;
begin
result := Radians * 180 / pi;
end;

function Radians(Degrees: Extended): Extended;
begin
result := Pi * degrees / 180;
end;

function InCircle(x, y, mx, my, r: Integer): Boolean;
begin
result := (Sqrt(sqr(x-mx) + sqr(y-my)) <= r);
end;

function CreateBitmapMaskFromText(txt,chars : string) : integer;
begin
result := BitmapFromText(txt,chars);
end;

function GetNumbers(text : string) : string;
begin;
result := ExtractFromStr(text,numbers);
end;

function GetLetters(Text: string): string;
begin
result := ExtractFromStr(Text,letters);
end;

function GetOthers(Text: string): string;
begin;
result := ExtractFromStr(text,others);
end;

function FindDTMRotated(DTM: Integer; var x, y: Integer; x1, y1, x2, y2: Integer; sAngle, eAngle, aStep: Extended; out aFound: Extended): Boolean;
begin;
result := FindDTMRotatedAlternating(DTM,x,y,x1,y1,x2,y2,sangle,eangle,astep,afound);
end;

const
tr_AllChars = 0;
tr_BigLetters = 1;
tr_SmallLetters = 2;
tr_Digits = 3;
tr_BigSymbols = 4;
tr_SmallSymbols = 5;
tr_SecondTableChars = 6;
tr_Letters = 7;
tr_AlphaNumericChars = 8;
tr_Symbols = 9;
tr_NormalChars = 10;

type
TCharRange = longword; //I donno

function GetTextAtEx(x, y: Integer; Tolerance: Integer; Chars: String; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange): anystring;
begin
// no hspacing, defaulting to 4. (with 4 ' and : will work)
// Defaulting MaxSpacing to 3
if TextColor = -1 then
raiseexception(ercustomerror,'GetTextAtEx with color = -1, is not supported');
Maxspacing := 3;
{$ifdef SimbaDebug}
Writeln([x, y, minSpacing, maxSpacing, 4, textcolor, tolerance, textlength, Chars]);
{$endif}
Result := GetTextAt(x, y, minSpacing, maxSpacing, 4, textcolor, tolerance, textlength, Chars);
{$ifdef SimbaDebug}
Writeln('GetTextAt result: ' + Result);
{$endif}
if Range = tr_Digits then
result := GetNumbers(result);
end;

function IsTextInAreaEx(xs, ys, xe, ye: Integer; var x, y: Integer; S: string; Tolerance: Integer; Chars: String; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer): Boolean;
var
TextTPA,SearchTPA, Matches: TPointArray;
Box : TBox;
xx,yy,i,len : integer;
begin
if TextColor = -1 then
raiseexception(ercustomerror,'IsTextInArea with color = -1, is not supported');
Result := False;
FindColorsTolerance(SearchTPA,TextColor,xs,ys,xe,ye,tolerance);
if Length(SearchTPA) < 1 then
Exit;
TextTPA:= TPAFromText(S,Chars,xx,yy);
Result := FindTextTPAinTPA(yy ,TextTPA,SearchTPA,Matches);
x := 0; y:=0;
if Result = False then
Exit;
Box := GetTPABounds(TextTPA);
SortTPAFrom(Matches, Point(Box.x1, Box.y1));
x := matches[0].x;
yy := 500000;
len := High(TextTPA);
for i := 0 to Len do
if TextTPA[i].x = Box.x1 then
yy := min(yy,TextTPA[i].y);
y := matches[0].y-yy;
{$ifdef SimbaDebug}
Writeln(Format('IsTextInAreaEx: (%d,%d)',[x,y]));
{$endif}
end;

function GetColorToleranceSpeed : integer;
begin;
result := GetToleranceSpeed;
end;

procedure ColorToleranceSpeed(cts : integer);
begin;
SetColorToleranceSpeed(cts);
end;

type
TColorComp = (ccRed, ccGreen, ccBlue, ccHue, ccSat, ccLum);

function FindColorComp(var x, y: Integer; Comp: Variant; CompType: TColorComp; xs, ys, xe, ye: Integer; Tolerance: Extended): Boolean;
begin
Writeln('FindColorComp is not yet implemented! Use another color finder ;-)');
Result := false;
end;

procedure SetColorspeed2Modifiers(huemodifier, saturationmodifier: Extended);
begin
SetToleranceSpeed2Modifiers(Huemodifier, saturationmodifier);
end;

function InStrArr(Str: string; Arr: TStringArray; CaseSensitive: Boolean): Boolean;
var
i : integer;
begin;
result := true;
if not casesensitive then
begin
str := lowercase(str);
for i := high(arr) downto 0 do
if lowercase(arr[i]) = str then
exit;
end else
for i := high(arr) downto 0 do
if arr[i] = str then
exit;
result := false;
end;

function Replace(Text, FindStr, ReplaceStr: string): string;
begin;
result := ReplaceWrap(Text,FindStr,ReplaceStr,[rfReplaceAll]);
end;

//Sends arrow to Client's window. For a, 0 = up, 1 = right, 2 = down, 3 = left.
procedure SendArrow(Key: Byte);
begin
if not InRange(Key,0,3) then
Writeln('KEY IS NOT INRANGE!!')
else
case key of
0 : PressKey(vk_up);
1 : PressKey(vk_right);
2 : PressKey(vk_down);
3 : PressKey(vk_left);
end;
end;

procedure SendArrowWait(Key: Byte; WaitTime: Integer);
var
KeyCode : integer;
begin;
if not InRange(Key,0,3) then
Writeln('KEY IS NOT INRANGE!!')
else
begin
case key of
0 : Keycode := (vk_up);
1 : Keycode := (vk_right);
2 : Keycode := (vk_down);
3 : Keycode := (vk_left);
end;
KeyDown(keycode);
wait(waittime);
KeyUp(keycode);
end;
end;

procedure SendArrowSilentWait(Key : byte; WaitTime : integer);
begin
SendArrowWait(key,waittime);
end;

procedure SendArrowSilent(Key : byte);
begin
SendArrow(key);
end;

function AMax(Data: TIntegerArray): Integer;
var
i : integer;
begin;
if length(data) = 0 then
begin
Writeln('cannot define result of AMax, input length = 0');
raiseexception(erCustomError,'AMax input with length of zero');
end;
result := data[0];
for i := high(data) downto 1 do
result := max(result,data[i]);
end;

function AddOnTerminate(const proc : string) : boolean;
var
OldProcs : TVariantArray;
i : integer;
begin
result := false;
GetScriptProp(SP_OnTerminate,OldProcs);
for i := 0 to high(OldProcs) do
if lowercase(OldProcs[i]) = lowercase(proc) then
exit;
setlength(OldProcs,Length(OldProcs)+1);
OldProcs[high(OldProcs)] := proc;
SetScriptProp(SP_OnTerminate,oldprocs);
result := True;
end;

function DeleteOnTerminate(const proc : string) : boolean;
var
OldProcs : TVariantArray;
NewProcs : TVariantArray;
i : integer;
begin
result := False;
GetScriptProp(SP_OnTerminate,OldProcs);
for i := 0 to high(OldProcs) do
if lowercase(OldProcs[i]) = lowercase(proc) then
result := true
else
begin
setlength(NewProcs,Length(NewProcs)+1);
NewProcs[high(NewProcs)] := lowercase(OldProcs[i]);
end;
SetScriptProp(SP_OnTerminate,NewProcs);
end;

function Readln(Question : string ) : string;
begin
InputQuery('Question box',Question,result);
end;
const
NPCChars = CharsNPC;
{$endif}
I don't know what to do :/


Delete what ever is in your Simba plugins folder. Then go to Includes/Srl/Place in plugins folder/Simba/. Place everything in that folder in Simbas plugin folder

Then go to includes/srl/srl/reflection/place in plugins folder/ and copy that and put that in Simba's plugin folder also replacing the one that is in there.

DeSnob

2010-06-05 19:51:01

[QUOTE=Camaro';715032]Delete what ever is in your Simba plugins folder. Then go to Includes/Srl/Place in plugins folder/Simba/. Place everything in that folder in Simbas plugin folder

Then go to includes/srl/srl/reflection/place in plugins folder/ and copy that and put that in Simba's plugin folder also replacing the one that is in there.

I did that! But Simba keeps saying the same thing over and over! It's driving me INSANE. :frusty: :angry:

mormonman

2010-06-05 20:20:21

use the smartlib from the reflection svn

Narcle

2010-06-05 20:30:40

No somewhere he is declaring to include srl.scar again.

Make sure this is your folder setup:

Folder - Simba/
Includes/Reflection
Includes/SRL

So in :Simba/Includes/ you should have 2 folders, SRL & Reflection.

Delete all other Reflection folders. Make sure the svn for Reflection folder is: https://simbareflection.googlecode.com/svn/trunk this is where the new SVN is. Update to that svn, after that try the test script. (also if your still at the old svn delete the Reflection folder entirely and make a new one)

Bad Boy JH

2010-06-05 20:58:48

I think he is using the wrong source to download from…

DeSnob

2010-06-05 21:26:24

From: Bad Boy JH
I think he is using the wrong source to download from…


Yeah.. :redface:

I have so many svn links i couldn't really tell.. i clicked wrong one and didn't notice.. SORRY ALL.. Thanks for all of your help

Bad Boy JH

2010-06-05 23:39:47

I love it when I'm right…XD

DeSnob

2010-06-06 07:54:44

From: Bad Boy JH
I love it when I'm right…XD


You got a lucky guess.. :p

Bad Boy JH

2010-06-06 08:58:21

nah, I ran into the same thing.