SRL Archive - SRL Suggestions

AntiBan.scar PCItem();


NCDS

2010-02-26 21:40:56

So the idea is to have a function that will price check an item in the inventory as antiban.
I figured the params would be something like:

procedure PCItem(Item: Integer);
That way the user could specify what slot the item is in to price check, or if the user sets 'Item' to '0' it will choose an Inv slot randomly. Obviously checking with ExistsItem(); first.

I just wanted to ask opinions on it before I took the time to make it.
Would this be useful/appreciated? or just a waste of time?

Heysus

2010-02-26 21:46:24

Sounds like a good idea to me. Although, it would be a lot more useful if you made it return the value of the items. And maybe a PCRandomItem; procedure to go with it. :)

NCDS

2010-02-26 21:48:32

From: Heysus
Sounds like a good idea to me. Although, it would be a lot more useful if you made it return the value of the items. And maybe a PCRandomItem; procedure to go with it. :)

From: NCDS
or if the user sets 'Item' to '0' it will choose an Inv slot randomly.

;)

Also, by 'value' do mean you mean what it's worth?

Heysus

2010-02-26 21:49:32

From: NCDS
;)
Also, by 'value' do mean you mean what it's worth?


Yea, that way it could be used for other stuff too, not just antiban.

NCDS

2010-02-26 21:52:11

From: Heysus
Yea, that way it could be used for other stuff too, not just antiban.


I will look into it. Though, if it requires me making a new text I probably won't get to that any time too soon, I was going to just do this quick if it would be used :p

Heysus

2010-02-26 22:00:29

From: NCDS
I will look into it. Though, if it requires me making a new text I probably won't get to that any time too soon, I was going to just do this quick if it would be used :p


Looks like it uses StatChars.


NCDS

2010-02-26 22:03:29

Ok, well I'm going to let this go until tomorrow and see if anyone else has an opinion on it. then I'll see what the deal is and make it or not.

Thanks for your opinion though :)

Frement

2010-02-27 00:36:46

I liked the idea, and i had some spare time, so i decided i might give it a shot, so this is what i came up with:
function RandomItem: Integer;
var Rand: Integer;
begin
Rand := RandomRange( 1, 28 );
if ( ExistsItem( Rand ) ) then
Result := Rand
else
Result := RandomItem
end;

function PriceCheckerOpen: Boolean;
begin
Result := FindTextTPA( 2070783, 20, 213, 26, 308, 41, 'Price Checker', UpChars, Nothing );
end;

function OpenPriceChecker: Boolean;
var x, y: Integer;
begin
if ( not PriceCheckerOpen ) then begin
GameTab( tab_Equip );
if ( FindColorTolerance( x, y, 5095891, 623, 413, 661, 452, 10 ) ) then begin
Mouse( 640, 430, 10, 10, True );
Result := True;
Wait( 500 + Random( 50 ) );
end else
Result := False
end else
Result := True
end;

procedure ClosePriceChecker;
begin
if ( PriceCheckerOpen ) then begin
Mouse( 486, 35, 3, 3, True );
Wait( 100 + Random( 50 ) );
end;
end;

function PCItem( var Value: Integer; Item: Integer ): Boolean;
var ItemTP: TPoint;
begin
if ( OpenPriceChecker ) then begin
if ( InvEmpty ) then begin
Result := False;
Exit;
end;
if ( Item = 0 ) then begin
Item := RandomItem;
end;
Wait( 100 + Random( 50 ) );
if ( ExistsItem( Item ) ) then begin
ItemTP := ItemCoords( Item );
Mouse( ItemTP.X, ItemTP.Y, 5, 5, True );
end;
Wait( 600 + Random( 250 ) );
Value := StrToInt( GetNumbers( GetTextAtEx( 25, 310, 100, StatChars, False, True, 0, 1, -1, 40, True, tr_Digits ) ) );
ClosePriceChecker;
Result := True;
end else
Result := False
end;

function PCItems( var Value: Integer; Items: TIntegerArray ): Boolean;
var I: Integer;
ItemTP: TPoint;
begin
if ( OpenPriceChecker ) then begin
if ( InvEmpty ) then begin
Result := False;
Exit;
end;
for I := 0 to High( Items ) do begin
if ( ExistsItem( Items[ I ] ) ) then begin
ItemTP := ItemCoords( Items[ I ] );
Mouse( ItemTP.X, ItemTP.Y, 5, 5, True );
Wait( 400 + Random( 300 ) );
end;
Wait( 600 + Random( 250 ) );
end;
Value := StrToInt( GetNumbers( GetTextAtEx( 25, 310, 100, StatChars, False, True, 0, 1, -1, 40, True, tr_Digits ) ) );
ClosePriceChecker;
Result := True;
end else
Result := False
end;
I tested it few times and it worked flawlessly.

Bad Boy JH

2010-02-27 06:14:01

What about stackables such as water runes or feathers…I know I would love to use this for my water runecrafter/ess miner….

Frement

2010-02-27 07:15:42

From: Bad Boy JH
What about stackables such as water runes or feathers…I know I would love to use this for my water runecrafter/ess miner….


Yeah good notice…

function RandomItem: Integer;
var Rand: Integer;
begin
if ( not InvEmpty ) then begin
Rand := RandomRange( 1, 28 );
if ( ExistsItem( Rand ) ) then
Result := Rand
else
Result := RandomItem
end;
end;

function PriceCheckerOpen: Boolean;
begin
Result := FindTextTPA( 2070783, 20, 213, 26, 308, 41, 'Price Checker', UpChars, Nothing );
end;

function OpenPriceChecker: Boolean;
var x, y: Integer;
begin
if ( not PriceCheckerOpen ) then begin
GameTab( tab_Equip );
if ( FindColorTolerance( x, y, 5095891, 623, 413, 661, 452, 10 ) ) then begin
Mouse( 640, 430, 10, 10, True );
Result := True;
Wait( 500 + Random( 50 ) );
end else
Result := False
end else
Result := True
end;

procedure ClosePriceChecker;
begin
if ( PriceCheckerOpen ) then begin
Mouse( 486, 35, 3, 3, True );
Wait( 1000 + Random( 50 ) );
end;
end;

function PCItem( var Value: Integer; Item: Integer ): Boolean;
var x, y: Integer;
ItemTP: TPoint;
ItemTB: TBox;
begin
if ( OpenPriceChecker ) then begin
if ( InvEmpty ) then begin
Result := False;
Exit;
end;
if ( Item = 0 ) then begin
Item := RandomItem;
end;
Wait( 100 + Random( 50 ) );
if ( ExistsItem( Item ) ) then begin
ItemTP := ItemCoords( Item );
ItemTB := InvBox( Item );
if ( FindColorTolerance( x, y, 65535, ItemTB.X1, ItemTB.Y1, ItemTB.X2, ItemTB.Y2, 5 ) ) then begin
Mouse( ItemTP.X, ItemTP.Y, 5, 5, False );
Wait( 100 + Random( 100 ) );
ChooseOptionMulti( ['Add-All', 'dd-A', 'All'] );
end else
Mouse( ItemTP.X, ItemTP.Y, 5, 5, True )
end;
Wait( 600 + Random( 250 ) );
Value := StrToInt( GetNumbers( GetTextAtEx( 25, 310, 100, StatChars, False, True, 0, 1, -1, 40, True, tr_Digits ) ) );
ClosePriceChecker;
Result := True;
end else
Result := False
end;

function PCItems( var Value: Integer; Items: TIntegerArray ): Boolean;
var I, x, y: Integer;
ItemTP: TPoint;
ItemTB: TBox;
begin
if ( OpenPriceChecker ) then begin
if ( InvEmpty ) then begin
Result := False;
Exit;
end;
for I := 0 to High( Items ) do begin
if ( ExistsItem( Items[ I ] ) ) then begin
ItemTP := ItemCoords( Items[ I ] );
ItemTB := InvBox( Items[ I ] );
if ( FindColorTolerance( x, y, 65535, ItemTB.X1, ItemTB.Y1, ItemTB.X2, ItemTB.Y2, 5 ) ) then begin
Mouse( ItemTP.X, ItemTP.Y, 5, 5, False );
Wait( 100 + Random( 100 ) );
ChooseOptionMulti( ['Add-All', 'dd-A', 'All'] );
end else begin
Mouse( ItemTP.X, ItemTP.Y, 5, 5, True );
end;
Wait( 400 + Random( 300 ) );
end;
Wait( 600 + Random( 250 ) );
end;
Value := StrToInt( GetNumbers( GetTextAtEx( 25, 310, 100, StatChars, False, True, 0, 1, -1, 40, True, tr_Digits ) ) );
ClosePriceChecker;
Result := True;
end else
Result := False
end;

NCDS

2010-02-27 11:29:19

Ok, this should easily be do-able in a single function, and I should have it posted this evening some time.

Frement

2010-02-27 13:18:47

From: NCDS
Ok, this should easily be do-able in a single function, and I should have it posted this evening some time.


Wrapping something to a single function just to make it look smaller does not make it good. The way that there are seperate functions for opening, closing etc. will give the possibility for others to use price checker as they like.

NCDS

2010-02-27 13:49:45

From: Frement
Wrapping something to a single function just to make it look smaller does not make it good. The way that there are seperate functions for opening, closing etc. will give the possibility for others to use price checker as they like.


Were thinking about it in 2 different way's. I'm thinking of this as an AntiBan function that randomly checks something in the Inventory. You guys are wanting to add a whole new concept to SRL.

As I thought of this, and I created this thread, I will make an Antiban function if it is desired by the public.

If it were to be requested by more than a just couple people to be created for functionality, then I would have no problem doing so.

Frement

2010-02-27 13:56:04

From: NCDS
Were thinking about it in 2 different way's. I'm thinking of this as an AntiBan function that randomly checks something in the Inventory. You guys are wanting to add a whole new concept to SRL.

As I thought of this, and I created this thread, I will make an Antiban function if it is desired by the public.

If it were to be requested by more than a just couple people to be created for functionality, then I would have no problem doing so.


As you can see from the functions i made, it has both. I dont mean anything bad. But why make just antiban when there is the possibility to make something new? True, it can be used as antiban, but it can be used for value checking also.

I would like to ask a favor, look through my code and point out to me what i should have coded differently, if there is any.

NCDS

2010-02-27 14:01:19

I don't have near enough time for that right now as I have to go pick up my son in ~20 mins, but there is a lot I would change honestly. RandomItem is not needed as it could easily be done inside another function. PCItem and PCItems should also be the same function. Why repeat so much code?


If you would like I can go through it in more detail later for you.

Frement

2010-02-27 14:16:28

From: NCDS
I don't have near enough time for that right now as I have to go pick up my son in ~20 mins, but there is a lot I would change honestly. RandomItem is not needed as it could easily be done inside another function. PCItem and PCItems should also be the same function. Why repeat so much code?


If you would like I can go through it in more detail later for you.


The point of RandomItem, PriceCheckerOpen is to make the functions clear.

If jagex changes the colors, it is easy to check and fix without having to go through a big function. Thought i tend to use small tolerances that small color differences wont affect the usage.

Phran6

2010-02-27 16:44:36

function RandomItem: Integer;
var Rand: Integer;
begin
Rand := RandomRange( 1, 28 );
if ( ExistsItem( Rand ) ) then
Result := Rand
else
Result := RandomItem
end;

if there no item in inventory you go in an infinity loop

Bionicle

2010-02-27 16:48:22

From: FrancisHelie
function RandomItem: Integer;
var Rand: Integer;
begin
Rand := RandomRange( 1, 28 );
if ( ExistsItem( Rand ) ) then
Result := Rand
else
Result := RandomItem
end;

if there no item in inventory you go in an infinity loop


function RandomItem: Integer;
var Rand: Integer;
begin
if InvEmpty then
exit;
Rand := RandomRange( 1, 28 );
if ( ExistsItem( Rand ) ) then
Result := Rand
else
Result := RandomItem
end;

Happy? :p

Frement

2010-02-27 16:50:52

Hah, totally forgot that! :)

MylesMadness

2010-05-15 13:08:11

function PCItems( var Value: Integer; Items: TIntegerArray ): Boolean;
var I: Integer;
ItemTP: TPoint;
begin
if ( OpenPriceChecker ) then begin
if ( InvEmpty ) then begin
Result := False;
Exit;
end;
for I := 0 to High( Items ) do begin
if ( ExistsItem( Items[ I ] ) ) then begin
ItemTP := ItemCoords( Items[ I ] );
Mouse( ItemTP.X, ItemTP.Y, 5, 5, True );
Wait( 400 + Random( 300 ) );
end;
Wait( 600 + Random( 250 ) );
end;
Value := StrToInt( GetNumbers( GetTextAtEx( 25, 310, 100, StatChars, False, True, 0, 1, -1, 40, True, tr_Digits ) ) );
ClosePriceChecker;
Result := True;
end else
Result := False
end;

function PCItem( var Value: Integer; Item: Integer ): Boolean;
begin
Result:=PCItems(Value, [Item]);
end;

Frement

2010-05-15 13:16:42

From: MylesMadness
function PCItems( var Value: Integer; Items: TIntegerArray ): Boolean;
var I: Integer;
ItemTP: TPoint;
begin
if ( OpenPriceChecker ) then begin
if ( InvEmpty ) then begin
Result := False;
Exit;
end;
for I := 0 to High( Items ) do begin
if ( ExistsItem( Items[ I ] ) ) then begin
ItemTP := ItemCoords( Items[ I ] );
Mouse( ItemTP.X, ItemTP.Y, 5, 5, True );
Wait( 400 + Random( 300 ) );
end;
Wait( 600 + Random( 250 ) );
end;
Value := StrToInt( GetNumbers( GetTextAtEx( 25, 310, 100, StatChars, False, True, 0, 1, -1, 40, True, tr_Digits ) ) );
ClosePriceChecker;
Result := True;
end else
Result := False
end;

function PCItem( var Value: Integer; Item: Integer ): Boolean;
begin
Result:=PCItems(Value, [Item]);
end;


Oh yeah :)

NCDS

2010-05-15 13:19:42

gravedig, pointless, closed.