SRL Archive - Help

Dropping Items?


KeepBotting

2012-01-17 21:02:14

Hello guys.
This is my script.
How would I get the script to recognise when the inventory is full, then drop everything except the first slot?
I'm using SRL4. Call me a noob, but I spent 3 hours reading a tutorial about SRL4, so I'm going to learn SRL4 first.
Any help is appreciated.

program kbPowerChopper;
{$DEFINE SMART}
{$i srl/srl.simba}

const
{---SMART Setup Constants---}
WORLD = 0;// Set a world, if you'd like. Leave 0 to choose a random world.
MEMBERS = False;// Are you Members or Free-To-Play? False for F2P, True for P2P.
SIGNED = True; // True if running a single account, false otherwise.
{---------------------------}
{--------Script Info--------} //DON'T CHANGE
Author = 'KeepBotting';
Name = 'kbPowerChopper';
Version = '0.9';
{---------------------------} //DON'T CHANGE

procedure DeclarePlayers; //This declares the players to be used in the script.
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := ''; //Your Runescape username
Players[0].Pass := ''; //Your Runescape password
Players[0].Nick := ''; //3 or 4 lowercase letters from your Runescape username. Used as a Nickname.
Players[0].Active := True; //Set to true if you want to use this player. Set to False to disable this player.
Players[0].Pin := ''; //Leave blank if the player doesn't have a Bank PIN.
end;

procedure SetupScript; //This is almost purely cosmetic, it lets you know what procedures/functions are being activated when the script starts.
begin;
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
WriteLn('Welcome to kbPowerChopper by kbScripts and KeepBotting!');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
WriteLn('Initilizing DeclarePlayers procedure...');
wait(500)
WriteLn('Successful!');
WriteLn('Initilizing LoginPlayer procedure...');
wait(500)
WriteLn('Successful!');
WriteLn('Initilizing ChopTree procedure...');
wait(500)
WriteLn('Successful!');
WriteLn('Initilizing AntiBan procedure...');
wait(500)
WriteLn('Successful!');
WriteLn('All procedures initilized successfully! Happy botting!');
end;

procedure AntiBan; //This keeps the banhammah from striking.
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(8) of
0:
begin
WriteLn('AntiBan chosen: Hover Skill.');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
HoverSkill('Woodcutting', false); //This hovers your mouse over the Woodcutting skill.
wait(2453+Random(432));
end;
1:
begin;
WriteLn('AntiBan chosen: Human-Like Mouse.');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
PickUpMouse; //This moves the mouse in a jerky, human-like motion.
end;
2:
begin
WriteLn('AntiBan chosen: Move Camera.');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
MakeCompass('N'); //This fiddles around with the Camera. Aligns the Camera North, rotates the Camera South, then aligns North again.
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;

procedure AntiRandoms; //This is currently broken (as Reflection does not work) but it would solve Random Events if it worked.
begin
{$IfDef Reflection}
R_FindRandoms;
{$EndIf}
FindNormalRandoms;
end;

procedure ProgressReport; //This handles your proggies. DO NOT CHANGE.
begin
WriteLn('Time for a progress report!');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
WriteLn('kbPowerChopper by kbScripts and KeepBotting, Version 0.9');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
end;

procedure ChopTree; //This chops your trees.
var x, y: integer;
begin
repeat
FindNormalRandoms;
WriteLn('ChopTree procedure activated! Finding tree.');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
if FindObj(x, y, 'illow', 2306095, 35) then //This finds the object, records the X and Y values, and tells the script to find the option "Tree".
begin
WriteLn('Tree found! Clicking option.');
WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
Mouse(x, y, 0, 0, false);
ChooseOption('illow'); //This tells the script to right-click on the object and select "Tree".
end;
repeat //This is a repeat function. It repeats the steps above.
wait(400+random(250));
AntiBan;
Until not IsUpText('illow') or (InvFull); //This is an Until function. It stops the repeat function if the tree has been chopped or your inventory is full.
until(InvFull); //This tells the script to stop completely once your inventory is full.
end;

begin
Smart_Server := WORLD; //This sets up the SMART Minimizing Autoing Resource Thing.
Smart_Members := MEMBERS;
Smart_Signed := SIGNED;
Smart_SuperDetail := False;
SetupSRL; //This sets up SRL.

SetupScript; //This runs your SetupScript procedure, initilizing all of the procedures.
DeclarePlayers; //This runs your DeclarePlayers procedure, making sure that the script has a player to run.
LoginPlayer; //This logs in your player.
repeat //This is the start of the ChopTree procedure loop.
ChopTree; //Chops your trees.
AntiBan; //Runs your AntiBans.


//Notice that AntiRandoms isn't in here. It would be useless to include because Reflection is currently broken.


until AllPlayersInactive; //This stops the script completely once your player has failed. e.g. Gotten into a random event, died (unlikely) or failed to find a tree.
end.

YoHoJo

2012-01-17 21:05:19

SRL5 is not rreally much different than SRL4 at all, you should change to SRL5.
You will only get a very small number, if any, errors to fix, and it will work just like before.

To start, do If InvFull Then
Then look inside of inventory.scar/inventory.simba
There is DropItem, DropItemArray, DropPattern, DropAll, DropAllExcept, etc etc etc, pick your favorite!

KeepBotting

2012-01-17 21:06:53

From: YoHoJo
SRL5 is not rreally much different than SRL4 at all, you should change to SRL5.
You will only get a very small number, if any, errors to fix, and it will work just like before.

To start, do If InvFull Then
Then look inside of inventory.scar/inventory.simba
There is DropItem, DropItemArray, DropPattern, DropAll, DropAllExcept, etc etc etc, pick your favorite!
Aha, thank you. I have seen these "DropAllExcept" things at work while using some other scripts.
Would all of this have to be in a separate procedure, or could I put them inside my ChopTree procedure? Which would work best.

PatDuffy

2012-01-17 21:08:03

I do believe there is a function DropAllExcept or something to that effect.

Check inventory.simba

Edit: dam….like 3 ninja's while I waited for the "you must wait 30 seconds to post again" nonsense.

KeepBotting

2012-01-17 21:09:26

From: PatDuffy
I do believe there is a function DropAllExcept or something to that effect.

Check inventory.simba

Edit: dam….like 3 ninja's while I waited for the "you must wait 30 seconds to post again" nonsense.
Thanks ;) Would I make a new procedure for this, or simply add it into my ChopTree procedure?

kevin33

2012-01-17 21:10:48

From: KeepBotting
Thanks ;) Would I make a new procedure for this, or simply add it into my ChopTree procedure?

New procedure.

KeepBotting

2012-01-17 21:11:55

From: kevin33
New procedure.

Thanks. Just realised that DropAllExcept is a procedure in itself, so my question was redundant :redface:

kevin33

2012-01-17 21:12:38

Lol its okay. Now you know.

KeepBotting

2012-01-17 21:14:29

From: kevin33
Lol its okay. Now you know.
Erm..Where exactly in DropAllExcept do I put the number of the slot that I do not wish to drop? I keep getting this error:

[Error] (84:11): Duplicate identifier 'DROPALLEXCEPT' at line 83

PatDuffy

2012-01-17 21:16:03

From: KeepBotting
Erm..Where exactly in DropAllExcept do I put the number of the slot that I do not wish to drop? I keep getting this error:

[Error] (84:11): Duplicate identifier 'DROPALLEXCEPT' at line 83


first inventory space is 1, etc.

KeepBotting

2012-01-17 21:16:37

From: PatDuffy
first inventory space is 1, etc.
*facepalm* I feel like a noob.
Where do I put the 1?

PatDuffy

2012-01-17 21:20:56

Probably something like DropAllExcept(1), idk the parameters exactly.

Where it is listed in Inventory.simba it should explain how to use it.

KeepBotting

2012-01-17 21:23:05

From: PatDuffy
Probably something like DropAllExcept(1), idk the parameters exactly.

Where it is listed in Inventory.simba it should explain how to use it.
Thanks, I almost got it. I can figure it from here.

Should I call the procedure in my Main Loop or from inside my ChopTree procedure?

kevin33

2012-01-17 21:24:40

Inside Chop I would say up to you though.
By the way Pat here is parameter.
{*******************************************************************************
procedure DropAllExcept(IgnoreInvSlots: TIntegerArray);
By: Nava2
Date: Dec 06, 2009
Description: Drops everything in inventory. Ignores slots specified by
DontDrop array.
*******************************************************************************}
procedure DropAllExcept(DontDrop: TIntegerArray);
var
inv, i, h: Integer;
begin
h := high(DontDrop);
for i := 0 to h do
{ Set the bit associated with the DontDrop Array }
inv := inv or (1 shl DontDrop[i]);
for i := 1 to 28 do
{ Check the bit at i, and if its high, then we dont drop. }
if (((inv shr i) and 1) = 0) then
DropItem(i);
end;

KeepBotting

2012-01-17 21:27:50

From: kevin33
Inside Chop I would say up to you though.
By the way Pat here is parameter.
{*******************************************************************************
procedure DropAllExcept(IgnoreInvSlots: TIntegerArray);
By: Nava2
Date: Dec 06, 2009
Description: Drops everything in inventory. Ignores slots specified by
DontDrop array.
*******************************************************************************}
procedure DropAllExcept(DontDrop: TIntegerArray);
var
inv, i, h: Integer;
begin
h := high(DontDrop);
for i := 0 to h do
{ Set the bit associated with the DontDrop Array }
inv := inv or (1 shl DontDrop[i]);
for i := 1 to 28 do
{ Check the bit at i, and if its high, then we dont drop. }
if (((inv shr i) and 1) = 0) then
DropItem(i);
end;
It works with DropAll, but it drops my entire inventory. I'm still getting
[Error] (84:11): Duplicate identifier 'DROPALLEXCEPT' at line 83
when using DropAllExcept.

EDIT: I get a "duplicate identifier" message when using any of the procedures in inventory.simba :i'm_a_noob:

kevin33

2012-01-17 21:37:46

Copy and paste how you put it in the script and use a // to show where the line is that there is a duplicate

KeepBotting

2012-01-17 21:39:46

From: kevin33
Copy and paste how you put it in the script and use a // to show where the line is that there is a duplicate


//procedure DropAllExcept(DontDrop: TIntegerArray);
var
inv, i, h: Integer;
begin
h := high(DontDrop);
for i := 0 to h do
{ Set the bit associated with the DontDrop Array }
inv := inv or (1 shl DontDrop[i]);
for i := 1 to 28 do
{ Check the bit at i, and if its high, then we dont drop. }
if (((inv shr i) and 1) = 0) then
DropItem(i);
end;

It's the first line. But I don't understand how there can be a duplicate, I don't have any other dropping procedures in my script.

kevin33

2012-01-17 21:44:31

Idk. This problem should have an easy fix but I dont know where it was duplicated. Try changing it to DROP_ALL_EXCEPT. All i can think of. Probably wont work but give it a shot.

KeepBotting

2012-01-17 21:47:37

From: kevin33
Idk. This problem should have an easy fix but I dont know where it was duplicated. Try changing it to DROP_ALL_EXCEPT. All i can think of. Probably wont work but give it a shot.
Now it doesn't recognise the DontDrop identifier. I'll look in some other scripts, see if I can reverse-engineer something.

kevin33

2012-01-17 21:55:19

You could try the DROPALL function and just change it.
procedure DropAll;
var i: integer;
begin
for i:= 0 to 2 do
begin
DropPattern(Random(2) + 1);
if InvCount = 0 then //change to like 1
break;
end;
end;

KeepBotting

2012-01-17 21:59:25

From: kevin33
You could try the DROPALL function and just change it.
procedure DropAll;
var i: integer;
begin
for i:= 0 to 2 do
begin
DropPattern(Random(2) + 1);
if InvCount = 0 then //change to like 1
break;
end;
end;
Thanks, trying that now. Will update this post.
EDIT: Didn't work, but I'll figure it out eventually. All I needed was the correct procedure. Thanks guys :smiley:

kevin33

2012-01-17 22:06:56

Procedure DROP;
Var
i: Integer;
Begin
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
NextPlayer(false);
Writeln('dropping logs');
If Not (LoggedIn) Then Exit;
GameTab(4);
For i := 2 To 28 Do
Begin
If ExistsItem(i) Then
DropItem(i);
End;
This should work.

KeepBotting

2012-01-18 07:14:01

From: kevin33
Procedure DROP;
Var
i: Integer;
Begin
If Not (LoggedIn) Or Not (Players[CurrentPlayer].Active) Then
NextPlayer(false);
Writeln('dropping logs');
If Not (LoggedIn) Then Exit;
GameTab(4);
For i := 2 To 28 Do
Begin
If ExistsItem(i) Then
DropItem(i);
End;
This should work.
I put that in, now it doesn't recognise the identifiers for all of my other procedures :duh: sorry you guys are having to spoonfeed me…

Home

2012-01-18 07:22:18

Remember to add Antirandoms (FindNormalRandoms) Into you script.

(SRL AntiRandoms have nothing to do with Reflection AnitRandoms :) )


~Home

KeepBotting

2012-01-18 16:36:38

From: Home
Remember to add Antirandoms (FindNormalRandoms) Into you script.

(SRL AntiRandoms have nothing to do with Reflection AnitRandoms :) )


~Home
Thanks, I'll remember that.
How often should I add it? Once in every procedure? Twice? More?