SRL Archive - First Scripts

Wonder's Yew Chop N'Bank [SIMBA]


wondersueak

2010-09-19 02:48:28

NOT WORKING AND i'M FIXING IT!!! stupid bad tut… XD

This is my first script and is a Yew Bank n' chopper with anti-ban and anti-randoms. For some reason it wouldn't save as a simba file, even though I am using Simba, so I have to past the entire code.

Thoughts? What do I need to add? I did this in about 30 minutes… o.0

program wonderyewbanknchop;
{$DEFINE SMART}
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}


{Setup:
1: Have Simba Set up with the latest reflection and SRL.
2: Make sure you have the required plugins.
3: Download this script.
4: Fill Out This Script.
5: Put your player next to/on the same tile as the yew tree.
6: Press the play button.}

const
World = 4;
Signed = True;
Members = False;

SRLStats_UserID = '';
SRLStats_Password = '';

BreakMins = 12; // How long the break should last

procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;

Players[0].Name := 'Username';
Players[0].Pass := 'Password';
Players[0].Nick := 'ame';
Integers[3]:= 60; // Breaks every blank amount of minutes
Players[0].Active := True;

end; {END SETUP. DO NOT CHANGE ANYTHING BELOW THIS!}



Procedure ChopTree;
begin
MakeCompass('S');
repeat
if FindObjCustom(x, y, ['Yew'], [1259052, 3168591, 1586478], 7) then
begin
Mouse(x,y,0,0,false);
repeat
Wait(100 + (random(150)));
ChooseOption('hop')
until(InvFull)
end;
until(InvFull)
end;



function Banking: Boolean;
begin
if (InvFull) then
begin
MakeCompass('N')
Wait (300 + random(160));
OpenBankQuiet('db');
if (PinScreen) then
InPin(YourPin);
if(FindColorSpiral(x, y, 669516, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;

Function AntiBan: Boolean;
begin
case Random(20) of // how often to perform, higher number less often
0: begin
BoredHuman;
end;

1: begin
RandomMovement;
end;

2: begin
HoverSkill('Woodcutting', false);
end;

3: begin
HoverSkill('Summoning', false);

4: begin
AlmostLogout;

5: begin
BoredHuman;

6: begin
HoverSkill('Smithing', false);
End;
End;

function CheckHatchet: Boolean;
var
Item: TInvItem;
Equiped: TEquipment;
begin

for j:= 0 to 27 do
begin
Item:= GetInvItemAt(j);
for i:= 8 downto 0 do
if (Item.ID = Hatchets[i]) then
begin
Writeln('Found a'+HatchetNames[i]+' in backpack');
Result:= True;
Exit;
end else
if (j = 27) then
Writeln('Could not find a '+HatchetNames[i]+' in backpack');
end;
Equiped:= GetEquippedItemAt(3);
for i:= 8 downto 0 do
if (Equiped.id = Hatchets[i]) then
begin
Writeln('Found '+HatchetNames[i]+' in hand');
Result:= True;
Exit;
end else
Writeln('Could not find a'+HatchetNames[i]+' in hand');
Writeln('You do not have a hatchet either in your backpack or weilded');
Logout;
ChangePlayer(False);
end;


procedure DoBreak;
var
BreakTime, T: Integer;
begin
if Debug then
Writeln('Starting the Break');
if (TimeFromMark(TimeSinceLastBreak) > (Players[CurrentPlayer].Integers[3]*60*1000)) then
if (PlayersActive > 1) then
ChangePlayer(True)
else
begin
Proggy(False);
BreakTime:= ((BreakMins*60*1000)+Random(5*60*1000));
ExitToLobby;
MarkTime(T);
repeat
Wait(1000);
until(TimeFromMark(T)>BreakTime);
LoginPlayer;
MarkTime(TimeSinceLastBreak);
end;
if Debug then
Writeln('Finished the Break');
end;

procedure ProgressReport(MainLoop: Boolean);
var
TempExp, TempLvl, Player: Integer;
begin
if (x=100)or(not(MainLoop)) then
begin
Me:= GetMe;
TempExp:= Me.Experience[Skill_WoodCutting];
TempLvl:= Me.Levels[Skill_WoodCutting];
ClearDebug;
if Debug then
Writeln(TempExp);
if Debug then
Writeln(TempLvl);
Writeln('Wonders Yew Chop N Bank Progress Report');
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
Writeln('Ran for: '+ TimeRunning);
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
for Player:=0 to High(Players) do
begin
Writeln('Player: '+Players[Player].Nick);
Writeln('Woodcutting Level: '+IntToStr(Players[Player].Integers[1]));
Writeln('Experience Gained: '+IntToStr(TempExp-Players[Player].Integers[0]));
Writeln('Levels Gained: '+IntToStr(TempLvl-Players[Player].Integers[1]));
Writeln('Logs chopped: '+IntToStr((TempExp-Players[Player].Integers[0])/332));
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
Writeln('Location: '+ Players[Player].Strings[0]);
Writeln('+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_+_');
end;
x:=0;
end else
x:= x + 1;
end;

Function AntiRandom: Boolean;
Begin
If Not LoggedIn Then Exit;
Case Lowercase(AntiRandomz) Of
'c':
Begin
Result := FindNormalRandoms;
If Not Result Then Result := R_FindRandoms;
FindNormalRandoms;
End;
'r':
Begin
Result := R_FindRandoms;
If Not Result Then Result := FindNormalRandoms;
R_FindRandoms;
End;
End;
End;

Procedure MainLoop;
SetupSRL;
repeat
ChopTree;
Banking;
until(false)
end.

Shuttleu

2010-09-19 03:22:02

where is the walking ;)

~shut

wondersueak

2010-09-19 03:25:14

*headesk*
stupid not too great tut….
XD
I'll go add it.
I"m workin on the errors.

edit:
I'm looking into how to use DDTM walking. Should be done soon.

TomTuff

2010-09-19 03:29:03

What's the whole deal with the antirandom? just call on FindNormalRandoms lol
No MP
I don't think you implimented breaks properly?
Players[0]. should go before Integers[3], and [3] should be [1].
vars x and y not declared in choptree
pin entering not setup correctly, add Players[-].pin = ''; to declare players, and replace YourPin with Players[CurrentPlayer].pin
{btw, the line Players[0].Pin should go immediatley after the line you declare the players nick}
again, x and y not declared as intigers in banking
Your antiban function can be shortened to:
Function AntiBan: Boolean;
begin
case Random(20) of // how often to perform, higher number less often
0: BoredHuman;
1: RandomMovement;
2: HoverSkill('Woodcutting', false);
3: HoverSkill('Summoning', false); //Why would you hover over summoning while woodcutting?
4: AlmostLogout; // not even a function in antiban.scar, replace with RandomRClick?
5: BoredHuman;
6: HoverSkill('Smithing', false); //again, why hover over smithing while woodcutting?
End;
End;
Bad Standards =(
forgot to include reflection
need to declare i and j as intigers in CheckHatchet
Hatchets is an unknown itemId in line 107, not familiar reflection so i don't really know what this is tbh
that's as far as i could get through your script and debug it, since i came up to a roadblock with reflection, but for now you should go through and fixed the aforementioned things.

wondersueak

2010-09-19 04:21:07

Ah thanks. I'm startin to see what I did wrong.

As you can probably see, I'm no natural at scripting XD

I'll have it fixed to the best of my abillities in the morning. I have to go to sleep.

BraK

2010-09-19 04:28:11

Please Don't Make Multiple Threads for the same thing.

~Brak

wondersueak

2010-09-19 14:32:12

I was asking for help in the help section for this script. I don't think that counts as a multiple thread. (I might be wrong. )

Wyn

2010-09-25 00:59:47

Two things I quickly noticed.

You forgot to add a const for the Function AntiRandom: Boolean; Just add AntiRandom = "C"; at the top for color R for reflection.

Add Your Pin Function into your declareplayers; Etc: YourPin := "";

Also if you need help with the walking; just pm me :)

wondersueak

2010-12-05 20:39:33

I am now determined to get this thing up and running. Might take weeks though because I'm busy. Yeah, I'll pm you with help on the walking in a bit. But, I gotta go XD

Cstrike

2010-12-05 20:41:37

Keep up the good work :)

wondersueak

2010-12-05 20:43:07

Thanks.

But, I think that was a horrible first attempt. I might just scratch this and make a fisher. I would make sure it would be a Catherby one because at the moment there isn't any and I really need one :P.

Becks

2010-12-05 22:17:45

HoverSkill('Random', false); Why not just do that? Instead of Summoning and Smithing.

wondersueak

2010-12-06 00:00:59

That would work.