SRL Archive - First Scripts

My First script


xaviar

2008-07-02 23:02:12

Edited My updated version of the script cleaned it up a little and added banking thanks to Sherminator giving me the link to a tut.

Ok right now im going to say i accept critisism gladly because ive only been reading how to do this for one day. This is my first script and i want to see how i could make it better feel free to leave any comments/suggestions. I will also rep you if you help me understand some harder things.




program WillownBank;  //start with axe equiped

{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/WoodCutting.scar}
var
x, y: integer;
Tries: integer;


const
WoodColor=1985364;// Currently on willows pick color of log in inv
Treecolor=1387816;// Currently on willows pick color of top of tree(not stump)
Axehead=6111295; //Unequip axe and take middle of heads color Currently on mith axehead.
YourPin=0000;//change to your bank pin leave if none
LoadsToDo=000;//How many loads to do per player?
procedure DeclarePlayers;
begin
SRLID:= '';
SRLPassword:= '';


HowManyPlayers := 5;
CurrentPlayer := 0;
NumberOfPlayers(HowManyPlayers);

Players[0].Name :='';
Players[0].Pass :='';
Players[0].Nick :='';
Players[0].Active:=True;

Players[1].Name :='';
Players[1].Pass :='';
Players[1].Nick :='';
Players[1].Active:=True;


Players[2].Name :='';
Players[2].Pass :='';
Players[2].Nick :='';
Players[2].Active:=True;

Players[3].Name :='';
Players[3].Pass :='';
Players[3].Nick :='';
Players[3].Active:=True;


Players[4].Name :='';
Players[4].Pass :='';
Players[4].Nick :='';
Players[4].Active:=True;

end;



procedure logcutting; //This cuts the logs
begin
if not(FindObjCustom (x, y, ['Wil', 'low'], [Treecolor], 10)) then //Tells it to logout if logs not found
Wait(100+random(100));
Tries := Tries + 1;
if(Tries = 25)then
Logout;
Exit;

MakeCompass('S');
repeat
if FindObjCustom(x, y, ['Wil', 'low'], [TreeColor], 10) 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, WoodColor, 547, 206, 734, 464))then
begin
Mouse(x, y, 4, 3, false);
ChooseOption('All');
end;
CloseBank;
Wait(150 + random (278));
MakeCompass('S');
end;
end;


procedure AntiBan;
begin
if not LoggedIn then Exit;
case Random(30) of
1: RandomRClick;
2: HoverSkill('Woodcutting', False);
3: RandomMovement;
4: BoredHuman;
5: AlmostLogout;
6: DoEmote(400 +Random(90));
end;
end;

procedure AntiRandom;

begin
LampSkill := 'Woodcutting';
FindNormalRandoms;
if FindFight then RunAway('N',True,1,5000);
end;


procedure Loop;
begin
SetupSRL;
LoginPlayer;
repeat
logcutting;
DropLogs;
AntiBan;
AntiRandom;
LoadsDone:=LoadsDone+1;
If(LoggedIn)and(LoadsDone=LoadsTodo) or Not(LoggedIn)then
LoadsDone:= 0;
Nextplayer(true);
WriteLn('Switching Players');
until (False)
end;
LoadsDone:=0;
begin
loop;
end.

adi1893

2008-07-02 23:28:37

I am new to this online organization. Even though this website is known to be great for its doings, I am having trouble finding my way through it. Can someone kindly show me how to use cheats/hacks?

xaviar

2008-07-02 23:33:03

this site does not offer cheats/hacks we bot through a program called scar read up on the site main

The_Shermanator

2008-07-02 23:34:35

Here's some things I found.
procedure DropLogs; 
begin
if FindObjCustom(x, y, ['Willow logs'] then
DropAll;
end;
Should be…
procedure DropLogs; 
begin
if FindObjCustom(x, y, ['Willow', 'Log'], [Treecolor], 10) then
DropAll;
end;
And this should be…
   if (FindObjCustom(x, y, ['Wil', 'low'], [Treecolor], 10)) then 
repeat
case (Random(2)) of
1: Mouse(x, y, 4, 4,false);
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
end;
this..
   if (FindObjCustom(x, y, ['Wil', 'low'], [Treecolor], 10)) then 
repeat
case (Random(2)) of
1: begin
Mouse(x, y, 4, 4,false);
Wait(300);
ChooseOption('hop');
end;
2: Mouse(x, y, 4, 4, True);
end;
until (InvFull)
end;
But if this is a fletching script, because you have knifecolor in constants, than shouldn't it be "LogColor"?
You also need a ";" after the "end" on line 91.
Hope this helps, simple, and I bet if you fixed it up a little it could do the job.;)
Here's the links to some tutorials that helped me:
http://www.villavu.com/forum/showthread.php?t=15240
http://www.villavu.com/forum/showthread.php?t=26899
http://www.villavu.com/forum/showthread.php?t=28142

xaviar

2008-07-02 23:39:10

i was going to add fletching after im just getting down the basics right now

The_Shermanator

2008-07-03 00:23:41

Since you have more than one Player setup there this will make it switch players.
Yours now…
procedure Loop;
begin
SetupSRL;
repeat
logcutting;
Banking;
AntiBan;
AntiRandom;
until (False)
end;
begin
end.
Yours that will change players..
procedure Loop;
begin
SetupSRL;
LoginPlayer;
repeat
logcutting;
DropLogs;
AntiBan;
AntiRandom;
LoadsDone:=LoadsDone+1;
If(LoggedIn)and(LoadsDone=LoadsTodo) or Not(LoggedIn)then
LoadsDone:= 0;
Nextplayer(true);
WriteLn('Switching Players');
until (False)
end;
LoadsDone:=0;
begin
end.
Add this to Constants to make it compile.
LoadsToDo=000;//How many loads to do per player?
And add "LoadsDone" to variables.

Hope this helps you some more:D

P.S. Your banking procedure is looking good, but if you want it to bank the logs better you should make "4155248" in FindColorSpiral to "WoodColor" so it clicks the color the user sets. Also I would advise you to use FindColorSpiralTolerance since the colors will change. A tolerance of 10-20 should be good.

xaviar

2008-07-03 13:18:12

alrighyt thanks updated again its looking really good now thanks to sherminator

EDIT: i am encountering a problem in my script

Line 88: [Error] (12909:1): Type mismatch in script


if (PinScreen) then
InPin(YourPin)//problem is here
if(FindColorSpiralTolerance(x, y, WoodColor, 547, 206, 734, 464))then

I program You

2008-07-03 13:38:41

try
InPin(IntToStr(YourPin))

IntToStr converts int to str like

Integer = 343;
String = '343';

insanomano

2008-07-03 13:56:16

ok that is a great first script but dont make your dropping procedure DropAll; because why would you want that?!?! what if you get a random that gives you a bunch of gems, you dont want to drop them? all you would have to do is make a willowDDTM and just make it search the inventory for that and if it does make it right-click then ChooseOption('rop'); make it repeat until it doesnt find the willowDDTM. this makes sense doesnt it? and always use color tolerance EXAMPLE:
BAD: (FindColor(x, y,WillowColor,MIX1, MIY1, MIX2, MIY2))
GOOD: (FindColorTolerance(x, y,WillowColor,MIX1, MIY1, MIX2, MIY2, 15))

BAD: (FindColorSpiral(x, y,WillowColor,MIX1, MIY1, MIX2, MIY2))
GOOD: (FindColorSpiralTolerance(x, y,WillowColor,MIX1, MIY1, MIX2, MIY2, 15))

Hope this helps. :D

insanomano7

2008-07-05 07:44:46

done like a pro

Firebrand

2008-07-06 04:25:14

I'm surprised no one noticed this but currently this script does absolutely nothing at all right now :D

This:

begin
end.

Should Be:

begin
Loop;
end.

bigboi

2008-07-06 05:06:54

"Script doesn't work anymore OUTDATED!"