SRL Archive - Archive

omgnomorenames - SRL Member Application


omgnomorenames

2012-08-11 02:16:08

How Long have You Played Runescape?
10 Year(s)


Are you affilated in anyway with Jagex LTD?
no

Were you Referred to SRL?
N/A


What is your general programming knowledge?
Java, Delphi, C, C++, Python, I am yet a journeyman.


Are you a member of any other communities?
N/A


Tell us about yourself…
From: omgnomorenames
Currently working as IT for a Loblaws warehouse (basically sit on your ass an twiddle your thumbs), taking a year off of school to pay off debts. Working towards my BS in Computer Science, but due to some personal problems have had to take some time off. Have had experience with the Srl community for some time, but mostly as a leecher rather than an actual giver. My experience with programming is broad but shallow, and am always willing to learn. My view on programming is more of an art than a science and have always felt that programming on the larger scale of things is very dynamic and ever changing, and so it can never really be considered black and white.



Please show us one (or multiple) of your scripts.
ShaftMaker v1.1
[CODE](* Ver 1.0 only works with 1 player
Ver 1.1 Better Standerds, Extra Color Find, and Slightly Faster Bank Find
Setup: Fill In DeclarePlayers or Start Smart and Login Yourself
Place character at North East Bank in GE
Put Logs in Top Left Bank Corner (Must Have more than 28 logs)
Click Run
*)

program ShaftMaker;
{$DEFINE SMART}
{$i SRL\SRL.simba}
var Time, x,y, TimesRun: Integer;

procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
// NO SPACES, LOWERCASE, Spell it wrong and you wont withdraw the fish
end;

// isUpTextMMouse moves mouse until Text is found or mouse reaches position x,y
// returns True if Text is found and ends early
// returns False if Text is not found and mouse reaches position x,y
Function isUpTextMMouse (var x, y : Integer; Text : String): Boolean;
var x1,y1,z :Integer;
begin
Result := False;
GetMousePos (x1,y1);
x := x - x1;
y := y - y1;
z := 0;
repeat
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z:= z+1;
if (x < 0) then begin
MoveMouse (x1-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))
end else if (x > 0) then begin
MoveMouse (x1+z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/x)-Round(Random(2)*Sin(Random(100)*Pi*z/x)));
end else begin
while ((z = y) or (z = (-y))) do
begin
if (isUpText (Text)) then begin
Result := True;
Exit;
end;
if (y<0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1-z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else if (y>0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1+z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else begin
Exit;
end;
z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)))
wait (200);
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
end;
end;

// FindUpTextSpiral moves mouse in a spiral till text is found or reaches limit
// Returns True if Text is found
function FindUpTextSpiral (var x,y:Integer; Text : String):Boolean;
var
z : Integer;
begin
z := 10;
repeat
x := Round(1.5*z*Cos(0.5*z)+260);
y := Round(z*Sin(0.5*z)+224);
if (isUpTextMMouse(x,y,Text)) then begin
wait (100);
if (isUpTextMMouse(x,y,Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
end;
z := z+1;
until (z >= 250)
Result := False;
end;


// FindColorisTextUp, Looks for specific color and upText
// If both return positive will return True
// Else Continues Search
// If never finds Text returns False

function FindColorisTextUp(x, y, Color: Integer; Text: string): Boolean;
var
LocationX, LocationY: Integer;
begin
for LocationY := 0 to 42 do
for LocationX := 0 to 51 do
if (FindColorTolerance(x, y, Color, 0 + (10 * LocationX), 0 + (9 * LocationY), 10 + (10 * LocationX), 9 + (9 * LocationY), 10)) then
begin
MMouse(x, y, 0, 0);
wait(100);
if (isUpText(Text)) then
begin
Result := True;
Exit;
end;
end;
end;

// SpiralOut: Basic Antiban Mouse Spiral
Procedure SpiralOut ();
var
z,x,y, endpoint : Integer;
begin
z := 0;
endpoint := randomRange (100,250);
repeat
x := Round(z*Cos(0.5*z)+260);
y := Round(z*Sin(0.5*z)+224);
z := z + 1;
MMouse (x,y,20,20);
until (z >= endpoint)
end;

// Basic Antiban, exmain inventory, Spiral Mouse, Check Level, and Reset View
Procedure AntiBAM ();
begin
case random(100) of
25: examineInv;
30: SpiralOut;
50: begin gameTab (23);
LevelUpEX(False,True);
hoverSkill ('fletching',false);
gameTab(25);
wait (100+Random(random(500))) end;
70: MMouse (365, 275,100,100);
99: ClickNorth(0);
end;
end;

// Waits until item 28 (last item in inventory) no longer exits, or time reaches
// 1 min 20sec, while waiting does antiban and checks for randoms
Procedure DoneFletching ();
var Time: Integer;
Begin
MarkTime(Time);
repeat
FindNormalRandoms;
AntiBAM;
wait (1000);
if not (ExistsItem(28) or FindNormalRandoms) then begin
Exit;
end;
until ((TimeFromMark(Time) > 80000))
end;

// Basic Progress
// Only ever withdraws 28 logs so everything is just a
// multiple of 28
Procedure Proggy ();
begin
TimesRun := TimesRun +1;
Writeln ('---------------------------');
writeln ('GIVE OR TAKE A FEW')
writeln ('Times Run : '+ToStr(TimesRun));
writeln ('Exp Gained: '+ToStr(5*28*TimesRun));
writeln ('Logs Cut : '+ToStr(28*TimesRun));
Writeln ('---------------------------');
end;

// Deposits inventory, Withdraws Logs
// if logs are less than 28 will log out
Procedure BankIt;
Begin
DepositAll;
if (GetBankItemAmount (0,0) <= 27) then begin
writeln ('Less than 28 Logs, Out of Stock Ending Script')
Logout;
Exit;
end else begin
writeln (ToStr(GetBankItemAmount(0,0))+' Logs Left');
end;
wait (1000+random(500));
Mouse (50,110,5,5,False);
wait (500+random (500));
ChooseOptionMulti(['Withdraw-All', 'raw-All']);
wait (random (1000));
CloseBank;
end;

// Case 1 Selects knife then Fletch Shafts and Proceeds to DoneFletching
// Case -1 Selects Fletch Shafts Proceeds to DoneFletching
// else writes uptext for debugging purposes and checks if invetory exists
// if not attempts to find/solve Random, else logs out
Procedure FletchIt (i : Integer);
begin
Case i of
1 : Begin
Mouse (260,430,20,20,True);
wait (1000+random(1000));
MMouse (110,430,20,20);
wait (1000+random(500));
Mouse (110,430,20,20,True);
DoneFletching;
Proggy;
end;
-1: Begin
Mouse (110,430,20,20,True);
DoneFletching;
Proggy;
end;
else Begin
writeln (GetUpText);
if not (TabExists (23)) then
begin
writeln ('Unable to Find Inventory');
if not(FindNormalRandoms) then
begin
Logout;
end;
end;
end;
end;
end;

Procedure Main;
begin
repeat
if (FindColorisTextUp(x,y,6590645,'ank') // Tries to Find Bank
or FindColorisTextUp(x,y,5600410,'ank') // If not logs out
or FindUpTextSpiral(x,y,'ank')) then
begin
GetMousePos (x,y);
Mouse (x,y,1,1,False); // Right Clicks Banker
wait (500+random (500));
ChooseOptionMulti(['ank Bank', 'ank Ban', 'Bank B']); // Selects option Bank Banker
MarkTime(Time);
repeat // Waits for bankscreen
wait (100);
until (BankScreen or (TimeFromMark(Time) > 10000));
wait (1000); // waits a little longer incase it needs to load
if (BankScreen) then // Makes sure bankscreen is up otherwise attempts to find banker again
begin
BankIt; // Banks inventory withdraws logs, or exits if logs < 28
wait (1000+random (1000));
MouseItem(RandomRange(0,28), mouse_Left); // Clicks a Random log in inventory
MMouse (250,430,0,0); // Moves mouse to centre of crafting screen
MarkTime(Time);
repeat // waits until either uptext 'select' or 'make all' is up
wait (100); // or times out at 10sec
until (isUpText('Select') or isUpText('Make All') or (TimeFromMark(Time) > 10000))
wait (1000+random(500)); // waits a second then begins Fletch all
FletchIt ( (Pos('Select', GetUpText) - Pos('Make All', GetUpText)) );
end;
end else begin
writeln('Did not find bank');
Logout;
end;
until (not LoggedIn);
end;

begin
SetScriptProp(SP_WriteTimeStamp, [True]);
activateClient;
SetupSRL;
DeclarePlayers;
TimesRun := 0;
LoginPlayer;
ClickNorth(0);
Main;
end. [/CODE]

One of my most recent logs
[3:36:13]: ---------------------------
[3:36:13]: GIVE OR TAKE A FEW
[3:36:13]: Times Run : 175
[3:36:13]: Exp Gained: 24500
[3:36:13]: Logs Cut : 4900
[3:36:13]: ---------------------------
[3:36:23]: 5101 Logs Left
[3:36:35]: Successfully executed.

Also Attached is AKB Cooker V1.3
Standards are a little off but only use to show use of dtm's.

[CODE](* By omgnomorenames (KW)
Ver 1.0 July 28 2012
Ver 1.1 July 29 2012 : Removed some useless variables, and increased finding efficiency
Ver 1.2 July 30 2012 : Added Proggy Bar and increased Search Area
Ver 1.3 Aug 1st 2012 : Faster and Faster
Al Kharid Cooking Script
Setup : Fill in DeclarePlayers Starting Line 19 Ending Line 32
Start standing in front of bank counter and make sure there is more
than 28 fish in bank

Ver 1.* Only Works with 1 Player.
*)

program Cook;
{$DEFINE SMART}
{$i SRL\SRL.simba}
{$i sps/sps.simba}
{$i ObjectDTM\ObjDTMInclude.simba}
{.include SRL/srl/skill/cooking.simba}
{.include SRL/srl/misc/findxp.simba}
var TEXT1,Text2,Text3,FishType : String;
x,y,Time,Runs :Integer;


procedure DeclarePlayers;
begin
HowManyPlayers := 1; // This is set to the total amount of players (more on multiplayer later ;)), for now, just keep it set as 1
NumberOfPlayers(HowManyPlayers); // This is a procedure in SRL which sets up player arrays (also, more on that later), this will always be the same
CurrentPlayer := 0; // This is the player to start with; the first player will always be 0 (you'll find out when you learn all about arrays)

Players[0].Name := ''; // Username
Players[0].Pass := ''; // Password
Players[0].Nick := ''; // 3-4 lowercase letters from username; used for random event detection
Players[0].Active := True; // Set to true if you want to use Player 0
Players[0].Pin := ''; // Leave blank if the player doesn't have a bank pin
FishType := 'tuna'; //shrimp, trout, salmon, tuna, lobster, swordfish, monkfish, shark
// NO SPACES, LOWERCASE, Spell it wrong and you wont withdraw the fish
end;

//CHANGE BELOW AT YOUR OWN RISK

// isUpTextMMouse moves mouse until Text is found or mouse reaches position x,y
// returns True if Text is found and ends early
// returns False if Text is not found and mouse reaches position x,y
Function isUpTextMMouse (var x, y : Integer; Text : String): Boolean;
var x1,y1,z :Integer;
begin
Result := False;
GetMousePos (x1,y1);
x := x - x1;
y := y - y1;
z := 0;
repeat
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z:= z+1;
if (x < 0) then begin
MoveMouse (x1-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))
end else if (x > 0) then begin
MoveMouse (x1+z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/x)-Round(Random(2)*Sin(Random(100)*Pi*z/x)));
end else begin
while ((z = y) or (z = (-y))) do
begin
if (isUpText (Text)) then begin
Result := True;
Exit;
end;
if (y<0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1-z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else if (y>0) then begin
MoveMouse (x1+Round(Random(2)*Cos(Random(100)*Pi*z/y)),y1+z+Round(Random(2)*Cos(Random(100)*Pi*z/y)));
end else begin
Exit;
end;
z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)))
wait (200);
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
end;
end;

// FindUpTextSpiral moves mouse in a spiral till text is found or reaches limit
// Returns True if Text is found
function FindUpTextSpiral (var x,y:Integer; Text : String):Boolean;
var
z : Integer;
begin
z := 10;
repeat
x := Round(1.5*z*Cos(0.5*z)+260);
y := Round(z*Sin(0.5*z)+224);
if (isUpTextMMouse(x,y,Text)) then begin
wait (100);
if (isUpTextMMouse(x,y,Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
end;
z := z+1;
until (z >= 250)
Result := False;
end;

function FindColorisTextUp(Color, x, y: Integer; Text: string): Boolean;
var
LocationX, LocationY: Integer;
begin
for LocationX := 0 to 51 do
for LocationY := 0 to 42 do
if (FindColorTolerance(x, y, Color, 0 + (10 * LocationX), 0 + (9 * LocationY), 10 + (10 * LocationX), 9 + (9 * LocationY), 10)) then
begin
MMouse(x, y, 0, 0);
wait(100);
if (isUpText(Text)) then
begin
Result := True;
Exit;
end;
end;
end;

Procedure SpiralOut ();
var
z,x,y, endpoint : Integer;
begin
z := 0;
endpoint := randomRange (100,250);
repeat
x := Round(z*Cos(0.5*z)+260);
y := Round(z*Sin(0.5*z)+224);
z := z + 1;
MMouse (x,y,20,20);
until (z >= endpoint)
end;

Procedure AntiBAM ();
begin
case random(100) of
25: examineInv;
30: SpiralOut;
50: begin gameTab (23);
LevelUpEX(False,True);
hoverSkill ('cooking',false);
gameTab(25);
wait (100+Random(random(500))) end;
70: MMouse (365, 275,100,100);
99: ClickNorth(0);
end;
end;

Procedure DoneCooking ();
var Time: Integer;
Begin
MarkTime(Time);
repeat
FindNormalRandoms;
AntiBAM;
wait (1000);
if not (ExistsItem(28) or FindNormalRandoms) then begin
Exit;
end;
until ((TimeFromMark(Time) > 80000))
end;

Function BankIt ():Boolean;
begin
Result := True;
DepositAll;
SearchBank (Text2);
if (GetBankItemAmount (0,0) <= 27) then begin
writeln ('Less than 28 fish, Out of Stock Ending Script')
Result := False;
Exit;
end else begin
writeln (ToStr(GetBankItemAmount(0,0))+' Fish Left');
end;
wait (1000+random(500));
Mouse (50,110,5,5,False);
wait (500+random (500));
ChooseOptionMulti(['Withdraw-All', 'raw-All']);
wait (1000);
Mouse (578,230,5,5,True);
end;

Procedure FlagWait();
var Time:Integer;
begin
MarkTime(Time);
repeat
wait (100);
until (not (FindFlag(x,y) or FindFlag2(x,y)) or (TimeFromMark (Time) > 10000));
wait (3000);
end;

Function GoToBank ():Boolean;
begin
Result := True;
if (ObjDTM_Find('71:138:5:7:7:55:75:7:7:102:138:10:7:59:138:10:7:59:131:10:7:59:127'
,x,y,True)) then
begin
writeln ('Success, Found Primary DTM');
ObjDTM_Walk('71:138:5:7:7:55:75:7:7:102:138:10:7:59:138:10:7:59:131:10:7:59:127', 2, 100, 5, True);
end else begin
writeln ('unable to find DTM. Checking AntiRandoms and Attempting Secondary DTM');
FindNormalRandoms;
ClickNorth(0);
wait (1000);
if (ObjDTM_Find('70:137:3:7:7:106:137:7:7:53:72:7:7:32:133'
,x,y,True)) then
begin
writeln ('Success, Found Secondary DTM');
ObjDTM_Walk('70:137:3:7:7:106:137:7:7:53:72:7:7:32:133', 2, 100, 5, True);
end else begin
writeln ('unable to find Secondary DTM, Logging Off');
Logout;
Result := False;
end;
end;
end;

Function GoToRange ():Boolean;
begin
Result := True;
if (ObjDTM_Find('100:24:6:10:7:71:75:10:7:71:80:10:7:71:88:7:7:42:80:7:7:38:94:7:7:66:19',x,y,True)) then
begin
writeln ('Success, Found Primary Bank DTM');
ObjDTM_Walk('100:24:6:10:7:71:75:10:7:71:80:10:7:71:88:7:7:42:80:7:7:38:94:7:7:66:19', 2, 100, 5, True);
end else begin
writeln ('Unable To Find Primary Bank DTM, Attempting Secondary DTM');
if (ObjDTM_Find('99:37:4:7:7:38:104:7:7:43:89:7:7:66:28:10:7:70:84',x,y,True)) then
begin
writeln ('Success, Found Secondary Bank DTM');
ObjDTM_Walk('99:37:4:7:7:38:104:7:7:43:89:7:7:66:28:10:7:70:84', 2, 100, 5, True);
end else begin
writeln ('Unable to Find Secondary DTM, Attempting to realign map and Third DTM');
ClickNorth(0);
wait (1000);
if (ObjDTM_Find('97:19:3:7:7:47:119:7:7:40:85:7:7:44:73',x,y,True)) then
begin
writeln ('Success, Found Third Bank DTM');
ObjDTM_Walk('97:19:3:7:7:47:119:7:7:40:85:7:7:44:73', 2, 100, 5, True);
end else begin
writeln ('Unable to find DTMs, Logging Off');
Logout;
Result := False;
end;
end;
end;
FlagWait;
end;

procedure NotBank ();
begin
//'19:110:3:7:7:54:119:7:7:138:58:0:7:81:120'
if (ObjDTM_Find('19:110:3:7:7:54:119:7:7:138:58:0:7:81:120' ,x,y,True)) then
begin
writeln ('This isnt a bank');
ObjDTM_Walk('19:110:3:7:7:54:119:7:7:138:58:0:7:81:120' , 2, 100, 5, True);
FlagWait;
end;
end;

procedure MainLoop ();
begin
repeat
Writeln ('Runs Completed '+ToStr(Runs));
Runs := Runs+1;
NotBank;
if (FindColorisTextUp(7434612,x,y,Text1)
or FindUpTextSpiral (x,y,TEXT1)) then
begin
wait (2000);
ClickMouse2 (True);
writeln ('Success');
MarkTime(Time);
repeat
wait (100);
until (bankscreen) or (TimeFromMark(Time) > 10000);
if ((bankscreen) and BankIt) then begin
wait (1000);
if (GoToRange) then
begin
x := 616;
y := 412;
MouseItem(RandomRange(2,28), mouse_Left);
if (FindColorisTextUp(1647791,x,y,Text3) //(FindColorTolerance(x,y,1647791,0,155,215,387,10))and (isUpTextMMouse (x,y,Text3)))
or (FindRange(x,y) and (isUpTextMMouse (x,y,Text3)))
or (FindUpTextSpiral (x,y,TEXT3))) then begin
if (isUpText (Text3)) then begin
wait (2000);
ClickMouse2 (True);
MMouse (260,450,10,10);
MarkTime(Time);
repeat
wait (100);
until (isUpText ('ook All') or (TimeFromMark(Time) > 10000));
ClickMouse2 (True);
DoneCooking ();
if (GoToBank) then
begin
FlagWait;
end else begin
Exit;
end;
end;
end else begin
Writeln ('Didnt Find Range, Attempting To Going To Bank');
if (GoToBank) then
begin
FlagWait;
end else begin
Writeln ('Didnt Find Range, and Couldnt go Home');
Exit;
end;
end;
end else begin
Exit;
end;
end else begin
Exit;
end;
end else begin
writeln ('Unable to Find Bank');
Exit;
end;
until (False)
end;

begin
SetScriptProp(SP_WriteTimeStamp, [True]);
//Smart_Server := SERVER;
//Smart_Signed := True;
//Smart_Members:= MEMBERS;
SPS_Setup(RUNESCAPE_SURFACE, ['12_9']);
activateClient;
SetupSRL;
DeclarePlayers;
ObjDTM_Setup

LoginPlayer
TEXT1 := 'ank boo';
Text2 := 'aw '+FishType;
Text3 := 'ange';
Runs := 0;
wait (1000);
ClickNorth(0);
GameTab(25);
MainLoop;
Logout;
Writeln ('****Omgnomorenames Terrible Proggy Bar****');
Writeln ('------------------------------------------');
Writeln ('|<---Running Time (LMAO) |');
Writeln ('|Runs Completed : '+ToStr(Runs));
Writeln ('|Fish Cooked : '+ToStr(Runs*27));
x:=Round(FindXp ('cooking',FishType));
Writeln ('|Approx.Xp Gain : '+ToStr(Runs*27*x));

end.[\CODE]

None of my scripts contain Multiplayer reason unless your shafting more than 20k of logs not necessary. AKB cooker is still in the debugging phase. I can add but not necessary.

Caotom

2012-08-11 04:26:19

The scripting ability is definitely there and you have been around for quite a while. Your one fall is that you have not exactly been an active member for long. However I see potential so my vote is going to go YES! ;)

~Caotom

J J

2012-08-12 06:56:45

In my opinion these two scripts are still fairly basic.
The only thing that might look impressive is this:
MoveMouse (x1-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))

I would like to see more SRL knowledge, some examples:
  • Use WaitUptext instead of waiting, then checking for uptext
  • DON'T use static wait times like in the DoneFletching procedure
  • In the bankit procedure you are waiting again then checking for the option instead of using waitoption
  • In the main procedure you have a static waittime for the bankscreen to appear, you could use a waitfunc
  • You haven't use any more advanced ways of detecting stuff such as TPA's. I don't think you even used arrays at all

So my vote is going for no.

[XoL]

2012-08-12 16:36:28

Yes from me, tbh the thing that impressed me most was you asking for help in another thread.
I see you are a proactive person, and are trying to do well for the community.

masterBB

2012-08-12 17:42:49

From: J J
In my opinion these two scripts are still fairly basic.
The only thing that might look impressive is this:
MoveMouse (x1-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),y1+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))


That piece of code looks so difficult. But it does the same as:
MoveMouse (x1-z+Round(Random(2)),y1+Round(y*z/(-x))-Round(Random(2)))

Also standards are a bit off, and I personally find both the scripts a tad to simple.

A tip from me, debug your algorithms a bit better. This isn't very human like. Here is my debug code I used for your function:

program new;

type
TDebug = record
tpa:TPointArray;
end;

var
debug: TDebug;

procedure TDebug.addPoint(x, y: Integer);
var
le: Integer;
begin
le := Length(Self.tpa);
SetLength(Self.tpa, le+1);
Self.tpa[le] := Point(x, y);
end;

procedure TDebug.show();
var
bmp: Integer;
bounds:TBox;
begin
bounds := GetTPABounds(Self.tpa);
DisplayDebugImgWindow(300, 300);
bmp := CreateBitmap(300, 300);
DrawTPABitmap(bmp,tpa,$FF0000);
DrawBitmapDebugImg(bmp);

end;

Function isUpTextMMouse (x, y, ex, ey: Integer): Boolean;
var
z :Integer;
begin
Result := False;
x := x - ex;
y := y - ey;
z := 0;
repeat
z:= z+1;
if (x < 0) then
debug.addPoint(ex-z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),ey+Round(y*z/(-x))-Round(Random(2)*Sin(Random(100)*Pi*z/x)))
else if (x > 0) then
debug.addPoint(ex+z+Round(Random(2)*Cos(Random(100)*Pi*z/x)),ey+Round(y*z/x)-Round(Random(2)*Sin(Random(100)*Pi*z/x)))
else begin
while ((z = y) or (z = (-y))) do
begin
if (y<0) then begin
debug.addPoint(ex+Round(Random(2)*Cos(Random(100)*Pi*z/y)),ey-z+Round(Random(2)*Cos(Random(100)*Pi*z/y)))
end else if (y>0) then begin
debug.addPoint(ex+Round(Random(2)*Cos(Random(100)*Pi*z/y)),ey+z+Round(Random(2)*Cos(Random(100)*Pi*z/y)))
end else
Exit;

z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)));
end;

begin
isUpTextMMouse(50,50,150,150);
debug.Show();
end.

Note the similarity to:

program new;

type
TDebug = record
tpa:TPointArray;
end;

var
debug: TDebug;

procedure TDebug.addPoint(x, y: Integer);
var
le: Integer;
begin
le := Length(Self.tpa);
SetLength(Self.tpa, le+1);
Self.tpa[le] := Point(x, y);
end;

procedure TDebug.show();
var
bmp: Integer;
bounds:TBox;
begin
bounds := GetTPABounds(Self.tpa);
DisplayDebugImgWindow(300, 300);
bmp := CreateBitmap(300, 300);
DrawTPABitmap(bmp,tpa,$FF0000);
DrawBitmapDebugImg(bmp);

end;

Function isUpTextMMouse (x, y, ex, ey: Integer): Boolean;
var
z :Integer;
begin
Result := False;
x := x - ex;
y := y - ey;
z := 0;
repeat
z:= z+1;
if (x < 0) then
debug.addPoint(ex-z+Round(Random(2)),ey+Round(y*z/(-x))-Round(Random(2)))
else if (x > 0) then
debug.addPoint(ex+z+Round(Random(2)),ey+Round(y*z/x)-Round(Random(2)))
else begin
while ((z = y) or (z = (-y))) do
begin
if (y<0) then begin
debug.addPoint(ex+Round(Random(2)),ey-z+Round(Random(2)))
end else if (y>0) then begin
debug.addPoint(ex+Round(Random(2)),ey+z+Round(Random(2)))
end else
Exit;

z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)));
end;

begin
isUpTextMMouse(50,50,100,150);
debug.Show();
end.

Sorry, I voted no. I see you tried hard to create something unique. These two scripts are just a tad to short for me. Also your activity seems to be a problem for me. Please reply to this if what I stated isn't true, and I looked over a key functionality of your algorithm.

Bam Bam

2012-08-12 23:16:23

The script does not show that you know the SRL include very well in my opinion. I dont mean for you to find this offensive at all but you need more time to learn the include and develop a script that utilizes it. SRL was developed to make your life as a scripter easier.

Things that stood out to me were the randoms inside randoms which is not significantly more random that using one random and adds cpu cycles, you appear to be using builtin simba functions instead of SRL mouse or mmouse functions and your implementation of the builtin function is not easy to read.

-Bam Bam

omgnomorenames

2012-08-14 01:17:51

I'm very sry I thought I changed it the actual isUpTextMMouse should be this

// isUpTextMMouse moves mouse until Text is found or mouse reaches position x,y
// returns True if Text is found and ends early
// returns False if Text is not found and mouse reaches position x,y
Function isUpTextMMouse (var x, y : Integer; Text : String): Boolean;
var x1,y1,z,height :Integer;
begin
Result := False;
GetMousePos (x1,y1);
x := x - x1;
y := y - y1;
z := 0;
height := Round(sqrt(x*x+y*y)/RandomRange(10,20));
repeat
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
Exit;
end;
z:= z+1;
if (x < 0) then begin
MoveMouse (x1-z+Round(height*Cos(Pi*z/x)),y1+Round(y*z/(-x))-Round(height*Sin(Pi*z/x)))
end else if (x > 0) then begin
MoveMouse (x1+z+Round(height*Cos(Pi*z/x)),y1+Round(y*z/x)-Round(height*Sin(Pi*z/x)));
end else begin
while ((z = y) or (z = (-y))) do
begin
if (isUpText (Text)) then begin
Result := True;
Exit;
end;
if (y<0) then begin
MoveMouse (x1+Round(height*Cos(Pi*z/y)),y1-z+Round(height*Cos(Pi*z/y)));
end else if (y>0) then begin
MoveMouse (x1+Round(height*Cos(Pi*z/y)),y1+z+Round(height*Cos(Pi*z/y)));
end else begin
Exit;
end;
z := z +1;
end;
Exit;
end;
until ((z = x) or (z = (-x)))
wait (200);
if (isUpText (Text)) then begin
writeln ('Found Text '+Text);
Result := True;
end;
end;

When moving small distances it moves directly to the point, but when moving large distances (slope greater than 20) it arcs towards the point. Yes the old code was basically MoveMouse with a random twitch of 2 between the points.

Hobbit

2012-08-28 02:48:35

In, Welcome :)