SRL Archive - OSR Help

GetXPBarTotal


Element17

2012-04-28 12:22:43

How do I use the increase in exp to determine if I've done something?


If (GetXPBarTotal +(70)) Then
blah blah

Gives type mismatch, didn't think it was right ha.

Abu

2012-04-28 12:24:47

You would use GetXPBarTotal before doing something and then after.
Then minus them from each other and equal them to 70.

Check the tutorial in my signature for a better explanation :p
* How to Create a Progress Report *

Sin

2012-04-28 12:26:06

Store the GetXPBar number into a variable and then do


Start := GetXPBarTotal;
Do shit
End := GetXPBarTotal;

if End > start then
yadayadayada;


Element17

2012-04-28 12:28:07

Thanks guys :)

NCDS

2012-04-28 12:30:20

The main problem with what you posted is that an if..then statement checks for a condition. All you did was add 70 to GetXPBarTotal. There is no condition to check, it's simply a statement, therefor throwing an exception.

Abu

2012-04-28 12:31:29

From: NCDS
The main problem with what you posted is that an if..then statement checks for a condition. All you did was add 70 to GetXPBarTotal. There is no condition to check, it's simply a statement, therefor throwing an exception.


What he's trying to say is, is that it should be….

If (DifferenceInXp = 70) Then
blah blah

Element17

2012-04-28 12:38:41

I got it to work now, but it constantly clicks the toggle XP button, why?
Also it doesn't print either Writeln :|




Begin
Repeat
CrackSafe;
If FindChatBoxText('ilp an', 8, 0) Then
Writeln('Failed to open safe trying again');
Start := GetXPBarTotal;
Ending := GetXPBarTotal;
If Ending > Start Then
Writeln('Opened the safe');
Until(False);
End;


Here is the whole script *put together in an hour maybe?* Only intended to be a lite version as it was requested but has potential to be abused for goldfarming from what I've read.

program WallCracker;
{.include SRL\SRL.scar}

Var
x, y: Integer;

Procedure Antiban;
Begin
Case Random(255) Of
0: HoverSkill('Theieving', False);
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;

function FindSafe1(var fx, fy: Integer): Boolean;
var
arP: TPointArray;
ararP: T2DPointArray;
tmpCTS, i, arL: Integer;
P: TPoint;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.07, 0.82);

if not(FindColorsTolerance(arP, 4016989, MSX1, MSY1, MSX2, MSY2, 10)) then
begin
Writeln('Failed to find the color, no object found.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

SortTPAFrom(arP, Point(MSCX, MSCY));
ararP := SplitTPAEx(arP, 10, 10);
arL := High(ararP);

for i := 0 to arL do
begin
if (Length(ararP[i]) < 10) then Continue;
P := MiddleTPA(ararP[i]);
MMouse(P.x, P.y, 5, 5);
Wait(100 + Random(100));
if (IsUpText('rack')) then
begin;
Result := True;
Break;
end;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
begin
Writeln('FindObject could not find object.');
Exit;
end;

GetMousePos(fx, fy);
end;

Procedure FindSafe2;
Var
x, y, SafeDTM: Integer;
Begin
SafeDTM := DTMFromString('mwQAAAHic42RgYFBnZGAQAmI7ILYFYkEoBrE1gFgPiBWAmBWIWYBYF4gNgVgGiOWg4gZAPHv+IobyRH+GCB9nBi8bQ4YoTxuG1CBnhkA3OwZ/BxMGZytjhv9A+/gJYEYiMBwAAHq9DL0=');
If FindDTM(SafeDTM, x, y, MSX1, MSY1, MSX2, MSY2) Then
Writeln('Found safe DTM');
End;

Procedure CrackSafe;

Begin
If(Not(LoggedIn))Then Exit;
If (Not(FindSafe1(x, y))) Then
FindSafe2;
Mouse(x, y, 5, 5, True);
Writeln('Found Safe1');
While IsMoving Do
AntiBan;
Wait(3000+Random(250));
GetChatBoxText(8, 0);
End;

Procedure MainLoop;
Var Start, Ending: Integer;
Begin
Repeat
CrackSafe;
If FindChatBoxText('ilp an', 8, 0) Then
Writeln('Failed to open safe trying again');
Start := GetXPBarTotal;
Ending := GetXPBarTotal;
If Ending > Start Then
Writeln('Opned the safe');
Until(False);
End;

begin
SetupSRL;
MainLoop;
end.

Abu

2012-04-28 12:53:44

Change
{.include SRL\SRL.scar}
into
{.include SRL\SRL.simba}

Element17

2012-04-28 12:54:25

:duh:



*Edit*
Still doesn't write the lines in the MainLoop…don't understand why not.

Gucci

2012-04-28 13:25:05

There is text that comes up in the chat box when you open the safe you could just use that

Element17

2012-04-28 13:35:47

Yeah I'm using for when you fail to let the me know when I failed, but its not even showing that up.


Begin
Repeat
CrackSafe;
If FindChatBoxText('ilp an', 8, 0) Then
Writeln('Failed to open safe trying again');

That doesn't even show up when I run my mainloop but it should.

Gucci

2012-04-28 13:37:33

Try using FindBlackChatMessage(''); instead

Home

2012-04-28 13:48:51

From: 14578
Yeah I'm using for when you fail to let the me know when I failed, but its not even showing that up.


Begin
Repeat
CrackSafe;
If FindChatBoxText('ilp an', 8, 0) Then
Writeln('Failed to open safe trying again');

That doesn't even show up when I run my mainloop but it should.


Restart simba :)

~Home

i3egoHan

2012-04-28 14:12:03

From: 14578
I got it to work now, but it constantly clicks the toggle XP button, why?
Also it doesn't print either Writeln :|




Begin
Repeat
CrackSafe;
If FindChatBoxText('ilp an', 8, 0) Then
Writeln('Failed to open safe trying again');
Start := GetXPBarTotal;
Ending := GetXPBarTotal;
If Ending > Start Then
Writeln('Opened the safe');
Until(False);
End;


You have…


Start := GetXPBarTotal;
Ending := GetXPBarTotal;

That means Start and Ending will ALWAYS be true..Because your grabbing them right after one another.

First set start var…Then do your exp profitable action, then check end..

Element17

2012-04-29 01:00:44

From: i3egoHan
You have…


Start := GetXPBarTotal;
Ending := GetXPBarTotal;

That means Start and Ending will ALWAYS be true..Because your grabbing them right after one another.

First set start var…Then do your exp profitable action, then check end..


Thank you :)