SRL Archive - First Scripts

[Help] lumby shop fm


Becks

2007-10-17 18:45:48

Im working on my first script which i hope will buy trees - yews burn them and repeat.

one problem at the moment XD

function OpenShopStock: Boolean;
var
x, y, f: Integer;
begin
Status('Trading Shopkeeper...');
if not(LoggedIn) then exit;
Flag;
Wait(350 + random(150));
if not ShopScreen then
repeat
if FindObjCustom(x, y, ['shop', 'assistant', 'shopkeeper'], [6057862,6057862], 5) then
Mouse(x, y, 4, 4, False);
Wait(250);
if (ChooseOption('Trade'))then
end;
end;


It talks to shop keeper trades and then…..

the shop contains tabs and i'm new at this so ca any one help me out? thank you.


and sorry if wronge section cant find a help section.. o.O

rogeruk

2007-10-17 18:48:29

Just click the tab with co-ords with random x and y..

Mouse(166,76,20,8,true);
(not proper co-ords)
like that,

Have you done the firemaking parts yet?. Buying is the easy part :)

Search for DTM's of the logs you want, eg what level is the player, can they only burn oak?, whats best for the player (yew? etc). Then right click and buy 50.

Kik

2007-10-17 18:50:39

Yeah, do what rogeruk said, or you could make a DTM or Bitmap of the tab (although that might be too hard if you're a beginning scripter).

Can't find a help section? It's sort of right there….
http://www.srl-forums.com/forum/scripting-help-f140.html

Becks

2007-10-17 20:12:33

I have been trying to figure out Radial Road Walk


RadialRoadWalk(RoadColor, 20, 30, 40, {Xmod}, {Ymod});

i set road color and the first to cords that scare gives me when i use the color tool.
but it always clicks some where else and i dont no what to put in for the last 3 numbers. i feel im doing it fully wrong.


i have only started the buying part. ill work on the other part later.


yes thank you i have the dtms i need.. i think






Var
OakDTM,WillowDTM,YewDTM,MapleDTM

procedure loadDTMs;
begin

OakDTM := DTMFromString('78DA8DD13B0A80301045D1491344145410FF1' +
'FC4A5B82097E28EF5A60B163E077227C5214D5C6B66E144739D87' +
'A56CC7B919577199EC352E2A3BBC3108B3924E989DD4C2E46414C' +
'69346988D94C224A4FF610A6116920B33132F4CF898ECDB3C7206' +
'078E');

WillowDTM := DTMFromString('78DA63946460609062400151818A0C5C409A1' +
'188FF0301A3049021C7800618914820CD07241408A861C3B40B43' +
'8D0A909020A006648F0C116AF809A801795290801A65202142400' +
'D3B613500B5D706BB');

MapleDTM := DTMFromString('78DA631466606090604001B99EBC0C5C409A1' +
'188FF030123485E86010D302291405A11488813500332839F801A' +
'4E22EC62C67433861A903DF204D4C8020969026AD88184007E350' +
'0A1120663');

YewDTM := DTMFromString('78DA631461606010634001B16E9C0C5C409A1' +
'188FF0301A3149021C9800618914820AD04248409A801C94B1350' +
'03B2588A801A164C3763A89105127C04D47000097EFC6A009B370' +
'60A');
end;


like you siad above the lvl thing is there a tut on that…? o.O

Kik

2007-10-17 21:42:38

I think there's a pretty easy function like 'GetLevel' or something… search around, i g2g to bed.

Becks

2007-10-17 22:01:42

ok thanks same. ill be looking around.

Pancakes

2007-10-17 22:48:48

Go something like this for the deciding part…


function BestLogs : Integer; //1-Normal, 2-Oak, 3-Willow, 4-Yew.
var FMLevel : Integer;
begin
FMLevel := GetSkillLevel('firemaking');
if (FMLevel >= 60) then
begin
Result := 4;
Exit;
end;
if (FMLevel < 60) and (FMLevel >= 30) then
begin
Result := 3;
Exit;
end;
if (FMLevel < 30) and (FMLevel >= 15) then
begin
Result := 2;
Exit;
end;
if (FMLevel < 15) then
begin
Result := 1;
Exit;
end;
end;

So basically, before you go into the shop window (because when you do the stats tab is disabled) go like:

case BestLogs of
1: LogsToBuy := 'Normal';
2: LogsToBuy := 'Oak';
3: LogsToBuy := 'Willow';
4: LogsToBuy := 'Yew';
end;

:)

Becks

2007-10-18 15:52:31

Thank you is still working on the buy screen to get to the Player stock and the r. walker

rogeruk

2007-10-18 16:20:56

To goto the player stock just click the tab.. it cant be any easier.

Radial walking is easy, use the RadialWalkingAid in scripting tools.

ShowerThoughts

2007-10-18 16:25:11

From: Pancakes
Go something like this for the deciding part…


function BestLogs : Integer; //1-Normal, 2-Oak, 3-Willow, 4-Yew.
var FMLevel : Integer;
begin
FMLevel := GetSkillLevel('firemaking');
if (FMLevel >= 60) then
begin
Result := 4;
Exit;
end;
if (FMLevel < 60) and (FMLevel >= 30) then
begin
Result := 3;
Exit;
end;
if (FMLevel < 30) and (FMLevel >= 15) then
begin
Result := 2;
Exit;
end;
if (FMLevel < 15) then
begin
Result := 1;
Exit;
end;
end;

So basically, before you go into the shop window (because when you do the stats tab is disabled) go like:

case BestLogs of
1: LogsToBuy := 'Normal';
2: LogsToBuy := 'Oak';
3: LogsToBuy := 'Willow';
4: LogsToBuy := 'Yew';
end;

:)

:( why you dont fill in whichlog:='yew'
instead of that uneeded case (i mean to do the case in the level procedure ;)

Becks

2007-10-18 17:59:01

//Boker's First Script
//Buys Oaks - Yews from lumbrige shop and burns
//Thank You srl tuts.. XD
//Need lvl 15 to use Oak+

program Firemaking;
{.include srl/srl.scar}

////////////////////////////////////////////////////////////////////////////////
var
x,y:integer;


Procedure DeclarePlayers;
begin
HowManyPlayers:= 1; // Set Number of Players here.
NumberOfPlayers(HowManyPlayers); // Sets the Players Array Length
CurrentPlayer:= 0; // CurrentPlayer

Players[0].Name :='---'; //username
Players[0].Pass :='---'; //password
Players[0].Nick :='---'; //3-4 letters of username don't use first letter
Players[0].Active :=True //is this player active true/false?

end;

////////////////////////////////////////////////////////////////////////////////
Var
OakDTM,WillowDTM,YewDTM,MapleDTM,LogDTM : Integer;

procedure LoadDTMs;
begin
LogDTM := DTMFromString('78DA638C676060F0634001EEA69C0C0F81342' + //Logs
'310FF0702C64420239C010D302291403A0C48441050E30F248208' +
'A8C905128104D464821C49404D3A9008C5AF06005AEA0A55');

OakDTM := DTMFromString('78DA8DD13B0A80301045D1491344145410FF1' +
'FC4A5B82097E28EF5A60B163E077227C5214D5C6B66E144739D87' +
'A56CC7B919577199EC352E2A3BBC3108B3924E989DD4C2E46414C' +
'69346988D94C224A4FF610A6116920B33132F4CF898ECDB3C7206' +
'078E');

WillowDTM := DTMFromString('78DA63946460609062400151818A0C5C409A1' +
'188FF0301A3049021C7800618914820CD07241408A861C3B40B43' +
'8D0A909020A006648F0C116AF809A801795290801A65202142400' +
'D3B613500B5D706BB');

MapleDTM := DTMFromString('78DA631466606090604001B99EBC0C5C409A1' +
'188FF030123485E86010D302291405A11488813500332839F801A' +
'4E22EC62C67433861A903DF204D4C8020969026AD88184007E350' +
'0A1120663');

YewDTM := DTMFromString('78DA631461606010634001B16E9C0C5C409A1' +
'188FF0301A3149021C9800618914820AD04248409A801C94B1350' +
'03B2588A801A164C3763A89105127C04D47000097EFC6A009B370' +
'60A');
end;

////////////////////////////////////////////////////////////////////////////////
function BestLogs : Integer; //1-Normal, 2-Oak, 3-Willow, 4-Yew.
var FMLevel : Integer;
begin
FMLevel := GetSkillLevel('firemaking');
if (FMLevel >= 60) then
begin
Result := 4;
Exit;
end;
if (FMLevel < 60) and (FMLevel >= 30) then
begin
Result := 3;
Exit;
end;
if (FMLevel < 30) and (FMLevel >= 15) then
begin
Result := 2;
Exit;
end;
if (FMLevel < 15) then
begin
Result := 1;
Exit;
end;
end;

////////////////////////////////////////////////////////////////////////////////

Procedure DoChats;

Begin
SetChat('On', 1);
SetChat('On', 1);
SetChat('Friends', 2);
SetChat('Friends', 2);
SetChat('On', 3);
SetChat('On', 3);
End;

////////////////////////////////////////////////////////////////////////////////

Procedure Findkeeper;

begin
if (not(loggedIn))then exit;
begin
if FindObjCustom(x, y, ['shop', 'assistant', 'shopkeeper'], [6057862,6057862], 5) then
Mouse(x, y, 4, 4, False);
Wait(2500)
if (ChooseOption('Trade'))then
Wait(2220)
begin
Mouse(166,76,20,8,true);
Wait(225)
end;
end;
end;
////////////////////////////////////////////////////////////////////////////////
function BuyLogs : Integer;
var x, y, OakDTM, WillowDTM, YewDTM, MapleDTM, LogDTM : Integer;
begin
Mouse(x, y, 2, 2, False);
Wait(50 + Random(100));
case BestLogs of
1: LogDTM := 'buy 50';
2: OakDTM := 'buy 50';
3: WillowDTM := 'buy 50';
4: YewDTM := 'buy 50';
Exit;
end;
Result := 0;
end;
////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////
begin
SetupSrl;
LoadDTMs
DeclarePlayers;
LoginPlayer;
ClearDebug;
DoChats;
Findkeeper;
BestLogs;
BuyLogs
end.

////////////////////////////////////////////////////////////////////////////////

Thats what i have so far finds shop keeper opens to Player Stock but it will not buy…
and the "case" gets error ever time

 ////////////////////////////////////////////////////////////////////////////////
function BuyLogs : Integer;
var x, y, OakDTM, WillowDTM, YewDTM, MapleDTM, LogDTM : Integer;
begin
Mouse(x, y, 2, 2, False);
Wait(50 + Random(100));
case BestLogs of
1: LogDTM := 'buy 50';
2: OakDTM := 'buy 50';
3: WillowDTM := 'buy 50';
4: YewDTM := 'buy 50';
Exit;
end;
Result := 0;
end;
////////////////////////////////////////////////////////////////////////////////
Line 124: [Error] (14805:23): Type mismatch

line 22=
   1:  LogDTM := 'buy 50';