SRL Archive - First Scripts

coo too's contribution to global warming


coo too

2010-05-27 10:28:57

Hello everyone, this is my first go at scripting in over a year when I left here. I've been back for 3 or 4 days now and I've just finished my first script. This script burns logs outside varrock west bank. I have only tried this script with simba, but I don't see why it wouldn't work in scar.

You must have the logs in your first bank slot and your tinderbox in your first inventory slot. Do not tell the script to do more loads than you have enough logs for or it will start trying to burn whatever else moves to your first inventory slot. You must start inside the bank and preferably on the east side near one of the bank booths.

This script is a bit unreliable so please don't leave it running while your not there to check on it.

Please post any progress reports or bugs here, thank you :biggrin:.

mrpickle

2010-05-27 11:06:48

Maybe it would be better to stabalize the script yourself first before publishing?

coo too

2010-05-27 11:21:15

The reason I posted this script is because I need help to stabilize it and people to test it. If I could have made it stable myself then I would have.

marpis

2010-05-31 14:47:13

Gotta love the name! :D Brilliant!

coo too

2010-05-31 14:53:43

Thanks, I'm glad you like it :D.

Any comments on the actual script? Nobody has said a thing about it yet and its been on the forums for 3 or 4 days now and I would really like some feedback.

marpis

2010-05-31 15:18:41

1: The signature takes way too much time :rolleyes: Make it write it all once and wait like 2 seconds.

2:

repeat
OpenBankFast(Bank_VW);
Wait(500 + Random(500));
if not BankScreen or Pinscreen then
begin
tries:= tries + 1;
end;
if Bankscreen or Pinscreen then
begin
success:= success +5;
end;
if(tries > 10)then
begin
Writeln('Failed to bank... terminating script.');
TerminateScript;
end;
until(success > 2);
Could be replace by this

for i := 0 to 9 do
if OpenBankFast(Bank_VW) then Break;
if (i > 9) then
begin
WriteLn('OpenBank failed 10 times');
TerminateScript;
end;
Example of using if statements

var
a, b: boolean;
success, fail: integer;

begin
if (a) then
success := success + 5 // see no ";"
else // no begins and ends, because there's only one line after "then" and after "else"
fail := fail + 1;
end;


if(switch = 0)then
begin
Writeln('switch = 0');
RadialWalkTolerance(8751497, 113, 180, 70, 0, 0, 10);
Flag;
end else // you should do this here to save a millisecond or two
if(switch = 1)then
begin
Writeln('switch = 1');
RadialWalkTolerance(8751497, 180, 113, 70, 0, 0, 10);
Flag;
end;

It's a very nice script dude, very promising. :)

coo too

2010-05-31 16:32:35

Thank you very much for the tips. It seems easier to think out what I'm scripting when I do it my way but I must learn to do it the more efficient way! rep for you :D.

i luffs yeww

2010-05-31 18:02:49

A boolean seems easier to use/understand/check for the Switch thing. :) I was bored so I read through it (I standardize/edit some when I do that :p) and all I changed was a few begin..ends that weren't needed. And your proggy. And the Switch for walking.


{
__________________________________________________________
/ Coo Too's Contribution To \
( Global Warming )
)==========================================================(
( This script burns any logs outside of varrock west bank )
\__________________________________________________________/
/ Instructions \
|============================================================|
( 1.Put the logs you wish to burn in your first bank slot )
) 2.Put a tinderbox in your first inventory slot (
( 3.Make sure your player is in varrock west bank )
) 4.Make sure you have the right amount of logs for the (
( amount of loads you chose to do )
) 5.Post any progress reports or bugs (
( )
\__________________________________________________________/
}
program coo_toos_contribution_to_global_warming;
{.include SRL/SRL/Misc/SMART.scar}
{.include srl/srl.scar}
{.include SRL/SRL/Skill/Firemaking.scar}

const
Loads = 10; //number of loads to do
LampS = 'Firemaking';
Firewait = 1000; //increase to wait longer between fires, decrease to wait less between fires
SmartWorld = 171;
SmartMembers = False;
SmartSigned = True;
SmartSuperDetail = False;


var
i: Integer;

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

Players[0].Name := ''; //user name
Players[0].Pass := ''; //password
Players[0].Nick := ''; //3-4 letters representing the player
Players[0].Pin := '0000'; // Bank Pin
Players[0].Active := True;
end;

procedure Setup_SMART;
begin
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
end;

procedure Setup_Player;
begin
DeclarePlayers;
if(not(LoggedIn))then
LoginPlayer;
Wait(500 + Random(1000));
end;

procedure signature;
begin
Writeln(' ___ _____ _');
Writeln(' / __|___ ___ |_ _|___ ___( )___');
Writeln(' | (__/ _ | _ \ | | / _ | _ \/(_-<');
Writeln(' \___\___|___/ |_| \___|___/ /__/');
Writeln(' ___ _ _ _ _ _ _ ');
Writeln(' / __|___ _ _| |_ _ _(_) |__ _ _| |_(_)___ _ _ | |_ ___ ');
Writeln(' | (__/ _ \ ` \ _| `_| | `_ \ || | _| / _ \ ` \ | _/ _ \');
Writeln(' \___\___/_||_\__|_| |_|_.__/\_,_|\__|_\___/_||_| \__\___/ ');
Writeln(' ___ _ _ _ __ __ _ ');
Writeln(' / __| |___| |__ __ _| | \ \ / /__ _ _ _ _ __ (_)_ _ __ _');
Writeln(' | (_ | / _ \ `_ | _` | | \ \/\/ // _` | `_| ` \| | ` \/ _` |');
Writeln(' \___|_\___/_.__|__,_|_| \_/\_/ \__,_|_| |_|_|_|_|_||_\__, |');
Writeln(' |___/');
Wait(2000);
end;

procedure Anti_Randoms;
begin
FindNormalRandoms;
LampSkill := LampS;
UseRewardBox;
FindLamp(LampSkill);
end;

procedure Open_Bank;
var
PinTries, Tries, Success: Integer;
begin
if(not(LoggedIn))then
TerminateScript;
Writeln('Trying to open bank');
if(not(InvFull))then
begin
repeat
OpenBankFast(Bank_VW);
Wait(500 + Random(500));
if(not(BankScreen)or(Pinscreen))then
Inc(Tries);
if(Bankscreen or Pinscreen)then
IncEx(Success, 5);
if(Tries > 10)then
begin
Writeln('Failed to bank... terminating script.');
LogOut;
TerminateScript;
end;
until(success > 2);
Writeln('Successfully opened bank');
if(PinScreen)then
begin
PinTries := 0;
repeat
InPin(Players[0].Pin);
Wait(100 + Random(300));
if(not(BankScreen))then
Inc(PinTries);
if(PinTries > 2)then
begin
Writeln('Failed to enter pin correctly 3 times... terminating script.');
LogOut;
TerminateScript;
end;
until(BankScreen);
end;
if(BankScreen)then
begin
Withdraw(0, 0, 27);
Wait(100 + Random(300));
CloseBank;
Wait(100 + Random(300));
Writeln('Successfully withdrew logs');
end;
end;
end;

procedure Walking_Out;
var
Switch: Boolean;
begin
Writeln('Walking out of bank');
if(not(Switch))then
begin
RadialWalkTolerance(8751497, 113, 180, 70, 0, 0, 10);
Flag;
end else
begin
RadialWalkTolerance(8751497, 180, 113, 70, 0, 0, 10);
Flag;
end;
Switch := (not(Switch));
end;

procedure Making_Fire;
var
s: Integer;
begin
s := 2;
repeat
if(not(LoggedIn))then
TerminateScript;
Writeln('Lighting a fire');
Wait(Firewait + Random(500));
InvMouse(s, 1);
Wait(100 + Random(100));
InvMouse(1, 1);
Anti_Randoms;
Wait(500 + Random(500));
if(CantLightCheck)then
begin
Writeln('Cant light fire here, moving north one square.');
Wait(500 + Random(1000));
Mouse(258, 142, 5, 5, true);
Wait(Firewait + Random(500));
Writeln('Lighting a fire');
InvMouse(s, 1);
Wait(100 + Random(100));
InvMouse(1, 1);
Anti_Randoms;
end;
Inc(s);
until(s = 29);
end;

procedure Walking_In;
begin
Writeln('Walking to bank');
Wait(1500 + Random(500));
RadialWalkTolerance(8751497, 50, 130, 50, 2, 2, 10);
Flag;
RadialWalkTolerance(5405831, 345, 380, 40, -2, -2, 15);
Flag;
end;

procedure Progress_Report;
begin
Writeln(' //===============================\\');
Writeln('|| Thank you for using this script ||');
Writeln(Padr('|| Loads: ' + IntToStr(i), 35) + '||');
Writeln(' \\===============================//');
end;

begin
Signature;
Setup_SMART;
SetupSRL;
Setup_Player;
SetAngle(True);
MakeCompass('n');
repeat
Open_Bank;
Walking_Out;
Making_Fire;
Walking_In;
Inc(i);
Progress_Report;
until(i = Loads);
Progress_Report;
Logout;
end.

coo too

2010-06-01 04:50:37

In your version of the Walking_Out procedure doesn't switch always be false at the beginning of the procedure so doesn't that make it do the same thing every time?

i luffs yeww

2010-06-01 05:05:12

Oooh. Nice catch. :) Took it out.

coo too

2010-06-01 05:08:37

I thought it looked a little weird :).