SRL Archive - OSR Help

FlaxSpinner(NEED HELP)


Wopey

2013-03-08 23:41:32

[LEFT]
Alright, So I started scripting after finding out that I was amazed by it.
I watched videos, Read Tuts…Etc..For about 13 hours. I'm getting the hang of this. I know how to read most of the script now.
I'm am trying to make my own script, even tho you may say I don't know much to successfully make one! Well that's why I'm here….Everyone needs helping at learning something.

Here is is….Not not done, But What am I missing and what Did I do wrong?

[/LEFT]

program FlaxSPinner;
{$i srl/srl.simba}
{$i P07Include.simba}

Var
SetupDTMs, BankDtm, StairsDTM, BankerDTM: Integer;


procedure SetupDTMs; //This is done
begin
P07_PlayerName := 'UsernameHere';
P07_PlayerPass := 'Passhere';
BankColor1 := 7181504;
DTM := DTMFromString('mwQAAAHic42RgYGAFYg4gZgNiZgZUwAaVY4fS3FDMBRVjgqoDmXF5WS3D/v1bGS5dOsNw5ugRBgcbG4aTJw8y+NhKM4Q6qTOcm1/GoMtAGDASgeEAAGeYD98=');



procedure FreeDTMss; //Done
begin
FreeDTM(BankDTM);
end;

function P07_IsMoving: boolean; //Done

begin

MoveMouse(427, 77);
ClickMouse(427, 77, 2);
ReleaseMouse(427, 77, 2);
MoveMouse(431, 140);
ClickMouse(431, 140);
writeln('Flax Collected')'


end;

Function Fixing Camera Angel;
begin
P07_COMPapassNorth;
MakeCameraAngleHigh;
writeLn('Camera Angel Fixed');
end;


Procedure Moving to Spinner; //NOT DONE....How Can I make It so that It clicks the DTM? (Spinner)


begin
Banking Out Flax;
P07_IsMoving:

end;


end.



Element17

2013-03-09 02:00:09

This wont even compile? First you list several DTMS but never use them or put any info for them. Use MMouse and ClickMouse2(true) for left and false for right. Don't click static coords. Have you read any tuts on using dtms? I'm pretty sure most of them tell you how to finddtm and if you find it clickmouse2(true). You have an okay start, keep at it!


**Edit**

Also work on your standards more, if this was long it would be hard to read.

**Edit again

writeln('Flax Collected')'
should be
writeln('Flax Collected');
you had an extra ' at the end


program FlaxSPinner;
{$i srl/srl.simba}
{$i P07Include.simba}

Var
SetupDTMs, BankDtm, StairsDTM, BankerDTM: Integer; //You have these but have nothing assigned to them yet? Also don't need SetupDTMs in here


procedure SetupDTMs; //This is done //You say it is done but you call it SetupDTMs but you have only one DTM and you never define it.
begin
P07_PlayerName := 'UsernameHere'; //I wouldn't put this in here but that is just me
P07_PlayerPass := 'Passhere'; //Same ^^^
BankColor1 := 7181504; //Same^^^
DTM {Which DTM}:= DTMFromString('mwQAAAHic42RgYGAFYg4gZgNiZgZUwAaVY4fS3FDMBRVjgqoDmXF5WS3D/v1bGS5dOsNw5ugRBgcbG4aTJw8y+NhKM4Q6qTOcm1/GoMtAGDASgeEAAGeYD98=');
// Example BankDTM := DTMFromString('blahlbahblah');


procedure FreeDTMss; //Done
begin
FreeDTM(BankDTM); //No DTM string? So nothing to free then
end;

function P07_IsMoving: boolean; //Done //Fixed standards and changed some stuff
begin
MMouse(427, 77, 2, 2);
ClickMouse2(True);
ReleaseMouse(427, 77, 2);
MMouse(431, 140, 2, 2); //First two point are x and y. The last two are x and y offset randomized
ClickMouse2(True);
writeLn('Flax Collected');
end;

Function FixingCameraAngel;boolean //Need to add boolean and cannot have spaces in function name
begin
P07_COMPapassNorth;
MakeCameraAngleHigh;
writeLn('Camera Angel Fixed');
end;

Procedure MovingToSpinner; //Again no spaces
begin
Banking Out Flax; //Don't know what this is?
P07_IsMoving:
end;


begin //must have a begin and end
end.

Wopey

2013-03-09 17:56:23

This wont even compile? First you list several DTMS……


I read tuts and watched so many videos on DTMs, I know the basic but still a little confused about something, I fixed some errors but at least it compiles. One question why does the client keep reopening? What line do I have to add?


program FlaxSPinner;
{$DEFINE SMART8} //What Do I have to add so I can make it support smart?
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
{$I SRL/srl/misc/SmartGraphics.simba} //Added so It can support DTMs
Var
Flax:integer;
X,y:integer; //These are getting an error, Should I remove and just
//name the VARs in a the procedure?

Procedure BankDTM; //Should I just name All the DTMs in 1 Procedure? Or sepperated

var //<< Like this
Flax:integer;
X,y:integer;

Begin
ClearDebug;
SetupSrl; //Do I have to add this in every procedure?
Flax := DTMFromString('m1gAAAHic42JgYOAGYi4gZmGAAEYgZoOK8QGxCBALQfkCUDYI8yDpYYZikHpOX04GBmdOqEkI/P8/xPSYg0fBNBcDcYCRSIwAAG5wBXA=');

if FindDTM(Flax, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
Mouse(x, y, 4, 4, False);
ChooseOption('All');
WriteLn('Flax Collected');
end;
FreeDTM(Flax);
end;

procedure declarePlayers; //Should I remove or add P07_LogIn
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name :='';
Pass :='';
Pin := '';
Active := True;
Booleans[0] := True;
Integers[0] := 60;
end;
end;

Begin
SetupSRL;
ActivateClient;
BankDTM;
declarePlayers; //Delcare player should come first?
FreeDTM(Flax);
end.

The Mayor

2013-03-09 18:45:38

{$DEFINE SMART8}  //What Do I have to add so I can make it support smart?  

Here you have defined SMART8, which is the newer version of SMART. If you haven't installed SMART8 then delete the '8' from the end.


 {$I SRL/srl/misc/SmartGraphics.simba}   //Added so It can support DTMs 

You do not need to include this so DTMs work. This is used if you want to paint on SMART (such as painting a progress report on SMART).

 
Var
Flax:integer;
X,y:integer; //These are getting an error, Should I remove and just
//name the VARs in a the procedure?

These are your 'Global' variables. If you have variables within a procedure/function they are 'local' variables. I see you have these already in your procedure below so they are not needed here.



 Procedure BankDTM;     //Should I just name All the DTMs in 1 Procedure? Or sepperated

Var //<< Like this
Flax: Integer;
X, Y: Integer;

Begin
ClearDebug;
SetupSrl; //Do I have to add this in every procedure?
Flax := DTMFromString('m1gAAAHic42JgYOAGYi4gZmGAAEYgZoOK8QGxCBALQfkCUDYI8yDpYYZikHpOX04GBmdOqEkI/P8/xPSYg0fBNBcDcYCRSIwAAG5wBXA=');

if FindDTM(Flax, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
Mouse(x, y, 4, 4, False);
ChooseOption('All');
WriteLn('Flax Collected');
end;
FreeDTM(Flax);
end;

You don't have to include SetupSRL in all of your procedures, only at the beginning on the mainloop (which you have done below). You can put the DTM in the procedure like you have, or what I normally do is make a separate procedure just to load the DTMs.
For example:


 Procedure LoadDtms;  // This procedure calls all the DTMs I'm using in my script (note that you will have to declare the DTMs as global variables at the top of your script, see above comment).

begin
OakPlank := DTMFromString('mAAEAAHic42FgYOACYm4gZgdiVgYE4ICKCwIxHxCLADE/EPNA5dmh8iBxSSgWgurjBWImqLqsUGsojzhsxEAaYCQRIwMAk2gCXg==');
OakLogs := DTMFromString('mPwEAAHic42dgYOAHYhEglgRiKSCWAWI5KC0KlecAYkYGCGAGYjaoOA9UDCTHDsRcQMwLxMJQM8WAWALKBqnlhOpnAuIMPz0oi3RsxEA+YKQAowEAnlAC8A==');
end;


Procedure FindLogs; // I dont have to load the DTM from string here because it is already done :)

begin
if FindDtm(OakPlank, x, y, 685, 428, 728, 463) then
begin
//Do stuff here, such as fletch or something
end;
end;


begin
SetupSRL;
LoadDtms; //Notice I put the LoadDtms procedure before the FindLogs procedure. We have to load them before we can find them :)
FindLogs;
end.



procedure declarePlayers; //Should I remove or add P07_LogIn
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name :='';
Pass :='';
Pin := '';
Active := True;
Booleans[0] := True;
Integers[0] := 60;
end;
end;

I'm not familiar with 07 but I think it is P07_PlayerName:= 'username' ; and P07_PlayerPass:= 'pass';
Look at other peoples scripts, it is a good way to learn.


Begin
SetupSRL;
ActivateClient;
BankDTM;
declarePlayers; //Delcare player should come first?
FreeDTM(Flax);
end.

See my procedure above about loading DTMS, you can call this procedure before your DeclarePlayers. (However, in your case you would want to declare players first, because you have to login before finding the flax!)

Instead of the FreeDTM(Flax) you can made a separate procedure to free all of your DTMs such as:


 
Procedure FreeTheDtms;

begin
FreeDtm(OakPlank);
FreeDtm(OakLogs);
end;

//and then in your main loop you would add

SetupSRL;
ActivateClient;
DeclarePlayers;
LoginPayer;
BankDTM;
AddonTerminate('FreeTheDtms');


So when your script ends it will free the DTMs.

Wopey

2013-03-10 09:21:49

Thank you so much! You have helped me so much, :)

Wopey

2013-03-15 14:15:25

Hey, I flowed your intrutions but I'm getting error(s).
First of all here is the script. I am not done, Still working on fixing the scipt first, Then Fin
//HsMMDTM = High Stairs Mini Map
//HSMSDTM = High Stairs Main Screen
//DoorDTM = AutoMating Closing Door
//WheelDTM = Wheel Spinner
//LSMMDTM = Low Stairs Mini Map
//LSMSDTM = Low Stairs Main Screen
program FlaxSpinner;
{$DEFINE SMART8}
{$I SRL/SRL.Simba}
{$I P07Include.Simba}
{$I SRL/srl/misc/SmartGraphics.simba}
Var
x, y, bankcol: Integer;
HsMMDTM, HSMSDTM, DoorDTM, WheelDTM, LSMMDTM, LSMSDTM: Integer;

procedure bank; //Taken From [url]http://villavu.com/forum/showthread.php?t=97148[/url] by kiwiownage

begin
P07_MakeCameraAngleHigh;
P07_MakeCompassNorth;
bankcol:= 6194321
Writeln('Banking');
repeat
if P07_FindObj(x,y, 'Use', bankcol, 5) then
begin
ClickMouse2(mouse_right);
wait(randomrange(100,200));
P07_ChooseOptionMulti(['se-q']);
wait(randomrange(600,1000));
end;
if(P07_BankScreen) then
P07_Deposit(2,28,true);
wait(randomrange(400,700));
until(p07_InvCount <2);
MMouse(422,74,5,5);
wait(randomrange(15,50));
ClickMouse2(mouse_right);
wait(randomrange(400,600));
P07_chooseOptionMulti(['Withdraw All']);
wait(randomrange(500,800));
Mmouse(484,39,5,5);
wait(randomrange(15,100));
ClickMouse2(Mouse_Left);
end;


procedure SetupDTMs;
begin
HsMMDTM := DTMFromString('mlwAAAHicY2dgYGAGYkEg5gViLiBmYYAAViDmBGJGIGaDyvEAMTsDAnx59QmM3717h8LGBxjxYCgAADO/EUQ=');
HSMSDTM := DTMFromString('mPwEAAHic42dgYJAGYnEgFgZiXiDmBGI2BghghmIWIOYAYiUolgViGSBWBGItINYEYjUkrAg1gxlqDiMQcwMxHxQLAbGzoz1DoDknGPuYcDLYaDCAsZMOA4OpCoSGiYHURNtxMoRZQWhKACMFGA0AAEhLCfo=');
DoorDTM := DTMFromString('m5wEAAHicE2dgYBAGYjEglgZiFSBWhWIVJCwLxBJALAjEPEDMDsQsQMwMxIxomAEqLwBVzwTFnEDMBxUDmSUDxIpArAbF6PbKQ9XyAjEX1EwYANkTbiDHkOKiwpDgqMQQGSjPkB2nxtAYZ8RQ5qPKUJyqyeDvLcYQHKbKEIBEmzsqgDFILiBIhcHETo7B2FaOwdtdlCHDTQVsHgjTEqCHFzUxDgAA1XgU7w==');
WheelDTM := DTMFromString('mKgEAAHic42NgYOAEYm4gZgNiRgYIYIZikBgXEAsAsTAQiwOxGJQtBMQySBikjgOIWaF6YWYxQcVA8nxA3BLFxzAxWZChIZyPoSKIjyHajpOhJpSPIcyKk0FPgYEh0JyTwccEIjYjQxCstjtekIFcwEgmRgUA9J4McQ==');
LSMMDTM := DTMFromString('mrAAAAHic42CAAFYg5gRiHiTMDsTMQMwFVcMCFQPxeYGYD0q/e/eO4fWH73AaGYPECAFGAhgGABtMFww=');
LSMSDTM := DTMFromString('mAAEAAHic42FgYGAFYnYg5gZiPiQM4nMBMQsDBDBC2ewMCMAE1Q9SKwDEwkAsAcTiUDYPEKtJMzD4mHCiYBcHG4YER044BqmBYVIBI4kYGQAA3hQG6A==');
end;
procedure FreeTheDTMs;
begin
FreeDTM(HsMMDTM);
FreeDTM(HSMSDTM);
FreeDTM(DoorDTM);
FreeDTM(WheelDTM);
FreeDTM(LSMMDTM);
FreeDTM(LSMSDTM);
end;

procedure MoveToHS;

begin
writeln('Looking for HsMMDTM');
if findDTM(HsMMDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
writeln('Found DTM');
writeln('Moving to HighStairs');
Mmouse(x, y, 3, 3);
Mouse(x, y, 0, 0, True);
P07_MakeCompassEast;
end;
end;




begin
SetupSrl;
Setupp07Include;
ActivateClient;
Wait(RandomRange(500,2000));
repeat
bank;
wait(1000)
MoveToHS;
wait(1000);


FreeTheDTMs;
AddonTerminate('FreeTheDtms');
until(false);
end.


It complies, But I'm getting this error.

Error: Exception: The given DTM Index[0] doesn't exist at line 58
The following DTMs were not freed: [1, 2, 3, 4, 5]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap, SRL - NavBar Bitmap, SRL - Options Bitmap]
I'm working and studying other scipts to fix this,
————————————————————————————————————————–

My DTMs are not being found, here is the procedure
procedure MoveToHS;

begin
writeln('Looking for HsMMDTM');
if findDTM(HsMMDTM, x, y, MMX1, MMY1, MMX2, MMY2) then
begin
writeln('Found DTM');
writeln('Moving to HighStairs');
Mmouse(x, y, 3, 3);
Mouse(x, y, 0, 0, True);
P07_MakeCompassEast;
end;
end;