Log in

View Full Version : Dropping Items?



KeepBotting
01-18-2012, 02:02 AM
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
01-18-2012, 02:05 AM
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
01-18-2012, 02:06 AM
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
01-18-2012, 02:08 AM
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
01-18-2012, 02:09 AM
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
01-18-2012, 02:10 AM
Thanks ;) Would I make a new procedure for this, or simply add it into my ChopTree procedure?
New procedure.

KeepBotting
01-18-2012, 02:11 AM
New procedure.
Thanks. Just realised that DropAllExcept is a procedure in itself, so my question was redundant :redface:

kevin33
01-18-2012, 02:12 AM
Lol its okay. Now you know.

KeepBotting
01-18-2012, 02:14 AM
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
01-18-2012, 02:16 AM
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
01-18-2012, 02:16 AM
first inventory space is 1, etc.*facepalm* I feel like a noob.
Where do I put the 1?

PatDuffy
01-18-2012, 02:20 AM
Probably something like DropAllExcept(1), idk the parameters exactly.

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

KeepBotting
01-18-2012, 02:23 AM
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
01-18-2012, 02:24 AM
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
01-18-2012, 02:27 AM
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
01-18-2012, 02:37 AM
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
01-18-2012, 02:39 AM
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
01-18-2012, 02:44 AM
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
01-18-2012, 02:47 AM
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
01-18-2012, 02:55 AM
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
01-18-2012, 02:59 AM
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
01-18-2012, 03:06 AM
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
01-18-2012, 12:14 PM
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
01-18-2012, 12:22 PM
Remember to add Antirandoms (FindNormalRandoms) Into you script.

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


~Home

KeepBotting
01-18-2012, 09:36 PM
Remember to add Antirandoms (FindNormalRandoms) Into you script.

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


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