SRL Archive - OSR Help

Very new to scripting


Hazzah

2012-03-08 17:45:42

Well, I am really really new to scripting and have only ever looked at one script, and I have been spending a lot of time trying to make a decent dhide body crafter. I have been using S1n's dhide crafter as a base and started with editing it. Now right now I have been stuck with my own banking problem, I'm not sure where to go to.

if BankScreen then
begin
wait(RandomRange(200,400));
if FindDTM(dhidebodyDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
MouseItem(RandomRange(1,3),mouse_Right);
wait(RandomRange(400,600));
ChooseOption('27');
end;
//if FindDTM(dhideDTM,x,y,MIX1,MIY1,MIX2,MIY2)
//CloseBank;
//end;
if Find
Mouse(RandomRange(440,460), RandomRange(230,250),0,0,False);
wait(RandomRange(400,600));
ChooseOption('27');
wait(RandomRange(400,600));
CloseBank;
end;
end;

With the empty "if Find" one I am trying to make it so that when the script banks if it see's that the inventory is empty it will continue on to bank, if it see's there are dhidebodies in the inventory it will bank them, then continue to bank, if it see's there are dhides left, it will just close the bank and finish making them.

Also, I know that I shouldn't use cords because it will not be able to find find other peoples hides, but the DTM I make for the bank dhides outdates extremely quickly because of the amount of dhides I have, probably haven't set my tolerances correctly on it or something.

x[Warrior]x3500

2012-03-08 18:01:37

if (invempty) then

i understand now. wat a lot of people do is statically withdraw the items. withdraw(); is a common procedure. you can first check colors of the item within a certain slot. and if that color matches up with your dhide color, then use the withdraw procedure. (like use a tpa, and go by the size of the tpa)

edit: or if you want, use withdrawItem();
edit2: maybe i dont understand… lol im constantly confusing myself now :/

i luffs yeww

2012-03-08 18:02:26

To know if there's anything in the inventory, just do


if (not(InvEmpty))then
// Do whatever;

I wouldn't add logic to see if there are uncrafted dhides in the inv, as it slows down xp to close the bank and make one more dhide and then open the bank again. Just deposit the inventory and then withdraw.

EDIT: And for the DTM, buy a bunch of dhides and get the DTM from a point just below the amount text. Bitmap finding may even be better for this, but that's up to you.

Sin

2012-03-08 18:03:01

I'm SO unproud of that script ;s
Any script of mine pre-member other than Maples and Miner are extremely ghetto and work horridly. (They work, just aren't efficient).

Hazzah

2012-03-08 18:14:54

From: Sin
I'm SO unproud of that script ;s
Any script of mine pre-member other than Maples and Miner are extremely ghetto and work horridly. (They work, just aren't efficient).


Actually the crafter no longer works :P DTM's are all outdated and I couldnt be bothered to update them and not get credit for it :). Although the edited version I am running right now works pretty well with 1100-1200 bodies per hour.

To know if there's anything in the inventory, just do

pascal Code:

if (not(InvEmpty))then
// Do whatever;



I wouldn't add logic to see if there are uncrafted dhides in the inv, as it slows down xp to close the bank and make one more dhide and then open the bank again. Just deposit the inventory and then withdraw.

EDIT: And for the DTM, buy a bunch of dhides and get the DTM from a point just below the amount text. Bitmap finding may even be better for this, but that's up to you.

That probably wont work considering I need to keep inventory #28 open for thread >.<

I had 60k+ Blue hides when I started, but for some reason after every few thousand it outdated the DTM for it, so I just hard coded it to the position of my hides.

It shouldn't slow it down because I have the wait time set to be able to create an inventory before banking

procedure Declaration;
begin
writeLn('We are crafting bodies');
dhidebodyDTM := DTMFromString('mfgEAAHicrcxJCoAwEAXR1pVRUHAGB4xew1MJ4vWtwHflUhteAg3VpZk1aFEhRwqHRH/YFagxYMIiK2ZsuuPUZ2rCzV7dCK/Ga/fc7NSF5joP3viz3f6Z6CfvuQErCATf');
TimeToWait := RandomRange(14500,16000);
end;

Almost all of the methods are borrowed from S1n, however I don't really expect to release this script considering that fact

x[Warrior]x3500

2012-03-08 18:17:19

if(InvCount>1)then

Hazzah

2012-03-08 19:13:58

Another Question if anyone has time,

procedure WithdrawDhide;
var
x,y,x2,y2,x3,y3:integer;
begin
SetAngle(SRL_ANGLE_HIGH);
OpenBankChestEdge(SRL_BANK_SW);
repeat
wait(100);
until(PinScreen or BankScreen);
if PinScreen then
begin
InPin(Players[CurrentPlayer].Pin);
wait(RandomRange(900,1100));
end;
if BankScreen then
begin
wait(RandomRange(200,400));
if FindDTM(dhidebodyDTM,x,y,MIX1,MIY1,MIX2,MIY2) then
begin
MouseItem(RandomRange(1,3),mouse_Right);
wait(RandomRange(400,600));
ChooseOption('27');
wait(RandomRange(200,600));
end;
if FindDTM(dhideDTM,x,y,MIX1,MIY1,MIX2,MIY2)then
begin
CloseBank;
end;
if(InvCount=1)then
begin
Mouse(RandomRange(440,460), RandomRange(230,250),0,0,False);
wait(RandomRange(400,600));
ChooseOption('27');
wait(RandomRange(400,600));
CloseBank;
end;
if(InvCount>10)then
begin
CloseBank;
end;
end;
end;

This works, but it is very very slow, I think it is slow because of the if(InvCount=1) then line seems like it takes forever, the rest of them seem to run quickly and smoothly. Is there anyway to speed up, or another function that will work quicker?

x[Warrior]x3500

2012-03-08 19:19:54

well if you want to do it a makeshift way, when u do dhides, it goes from the top left to the bottom right in your inv. so, you can just check the inv slot #27 to see if it has a color different than the inv background. that will tell u if you have any additional items, besides slot 28.

Hazzah

2012-03-08 19:27:58

Thanks warrior, any chance you could show me how to do that? Like which Inventory function (please tell me if I am using this incorrectly) to use. and right now I have the thread in inventory top row right most column.

Joe

2012-03-08 19:39:42

From: Sin
I'm SO unproud of that script ;s
Any script of mine pre-member other than Maples and Miner are extremely ghetto and work horridly. (They work, just aren't efficient).


Not to be mean or disrespecful, but yes, this script was freaking atrocious.

x[Warrior]x3500

2012-03-08 20:28:54

try this out:


function isSlot27Open():boolean;
var
x,y:integer;
begin
result:=false;
if(findcolortolerance(x,y,2963520,707,451,707,451,3))then
result:=true;
end;

Hazzah

2012-03-08 20:54:00

That looks like it would work, but how exactly do I implement it, as the title says, I am extremely new to this and as of two days ago I had 0 knowledge on the subject. At the moment the only thing I have really been able to do is extremely basic.

Where I implemented it, it continues to return the error, "Identifier expected"

x[Warrior]x3500

2012-03-08 21:06:02

instead of:

if(InvCount=1) then

you would use:

if(isSlot27Open)then