PDA

View Full Version : How to Create a Progress Report(Proggy)



Abu
03-22-2012, 08:03 PM
Before you read:
-Go to Advanced Search
-Type in 'Proggy'
-Select 'Search Titles Only'
-Press ' Search Now'
-Wow.... a lot of people find it confusing right?


Introduction

Hello and welcome to my tutorial on how to create a Progress Report. For those of you who don't know what this is, a Progress Report is a nifty little thing that you can add to your script to tell you how your script is getting on. This tutorial will tell you everything you need to know to create a Single Player and Multiplayer Proggy for your script. When I asked for help on how to make one, this was the response I got:

just use:
writeln('put the text here');
writeln('put the text here' + ToStr(yourVar));

Now thats not very helpful if you have no knowledge on how to create a Proggy, is it ?



///---- Contents ----\\\

-Single Player Proggies

-Multiplayer Proggies



Single Player Proggies

Names and variables

To create a Single or Multiplayer Proggy the first thing you want to do is make a list of all the things you want to be updated on. For example, for a Runecrafting Script I would want to be updated on:

- How many Loads I've done
- How many Loads I've done per hour
- How much XP I've gained
- How much XP I've gained per hour
- How many Runes I've crafted
- How many Runes I've crafted per hour

Not that hard is it? I've simply made a list of all the things I want to include in my Progress Report. The next thing you want to do is create appropriate variables for each of them. So basically, if you don't know what that is, its simply what you want to name them in your script - and its called a variable because the value of it can change. You should put the variable in Camel-capped, WhichIsLikeThis.
So to do this I would simply put the variables alongside my list, like so:

- How many Loads I've done -- I'll name it LoadsDone
- How many Loads I've done per hour -- I'll name it LoadsPerHour
- How much XP I've gained -- I'll name it XPGain
- How much XP I've gained per hour -- I'll name it XPGainPerHour
- How many Runes I've crafted -- I'll name it Runes
- How many Runes I've crafted per hour -- I'll name it RunesPerHour

Now how bloomin easy is that!?

Now you just want to put these variables into your script. To do this, you declare them globally, so put 'var' at the start of your script just before you DeclarePlayers. Like so:
Var
XPGain, LoadsDone, TimeGone, Runes: Integer;
XPPerHour, LoadsPerHour, RunesPerHour, CurrentXP, OriginalXP: Integer;

Because this is a Single Player Proggy, you only need to define these variables as Integers like I have done so above. You will also need to take note that I have added three variables called:

- TimeGone, which I will use in the Proggy to help me find out at what rate I have done procedures e.g (RunesPerHour)
- OriginalXP, which I will use to tell me how much XP I had to start of with - needed to find XPGain
- CurrentXP, which I will use to tell me how much XP I have at the moment - needed to find XPGain

Now that we have successfully put these Variables into our Script we need to know how to use them.


Functions Needed

Here are the main functions you will need to get your Proggy to work...:

GetTimeRunning
Inc(variable)
IncEx(variable, amount)
GetXPBar(1,2 or 3)
InvCount
GetAmountBox(box: TBox): integer; // Thanks to Er1k!
GetBankItemAmount(const Row, Col: Integer): Integer; // Thanks to Er1k x2!

...and this is what they do:

GetTimeRunning - Gets how long you have been playing the Script in milliseconds

Inc(variable) - This increases the variable you put in the brackets by 1.

IncEx(variable, amount) - This increases the variable you put in the brackets by the amount you put in after the comma

GetXPBar(1,2 or 3) - Gets the amount of XP you currently have. You can put in the number 1, 2 or 3 depending on which one seems to work for your script

InvCount - Returns amount of items in your inventory

GetAmountBox - Returns the amount of an item at in the box ‘box’. Use this for counting stackable items in your inventory. For 'box' put InvBox(i), with i being the inventory box you want to search in.

GetBankItemAmount - Returns the amount of an item in the bank at bank screen coordinates. For the first number put in the row you're searching in and for the second put in the column.

Using Functions

Once you've learned what those functions do, you want to know where to use them in your script.

Using Functions within your Script
The variables used here: LoadsDone, Runes
This is really easy. The variables we use within our Script are the ones that change right after we have done the function and so you use them at the end of the required function . For example:

If I have just completed one load worth of Runecrafting. After I click the altar I would put this just before ending my Altar Clicking function:
Inc(LoadsDone)
So it would increase my LoadsDone by 1.

If I want to count how many Rune Essence is in my Inventory either before or after banking, I would use:
RuneEssence := InvCount
So it would get the amount of Essence I have in my inventory

And to find out how many Runes I have in my inventory, well I already showed you that earlier with the whole GetTextAtExWrap function didn't I?

Using functions in your proggy
The variables used here are: TimeGone, XPGain, XPPerHour, LoadsPerHour, RunesPerHour, CurrentXP, OriginalXP
These variables are the ones we can't just simply update after doing the function. Instead, we define them here in the Proggy so we can see how they have updated.

The first thing you want to do when creating your Proggy is find out how long the script has been running for and define it with our variable TimeGone. To do this we do:
TimeGone := (GetTimeRunning/1000);

Now we want to find out how much XP has been gained.
First we use the variable CurrentXP and the function GetXPBar(1) to find out how much XP we currently have, like so:
CurrentXP := GetXPBar(1);
Then we use the OriginalXP variable we included earlier and put it in the mainloop, right after you Log In, but before you start your actual script. Put it in like this:
OriginalXP := GetXPBar(1);
So far you've found the XP you had before actually running the script and the Current XP that the player has. Now you can use this to find the increase in XP.
To do this, we use the variable XPGain and minus the OriginalXP from the CurrentXP, like so:
XPGain := (CurrentXP - OriginalXP);
So this will tell us how much XP we have Gained since starting the script.


PerHour values require the TimeGone variable which we have already defined.
To find PerHour vales you simply divide the appropriate variables by the TimeGone and then times by 3600 to get the amount per hour.
Like so:
For XPPerHour:
XPPerhour :=(3600*(XPGain))/((TimeGone));
For LoadsPerHour:
LoadsPerhour :=(3600*(LoadsDone))/((TimeGone));
For RunesPerHour:
RunesPerHour := (3600*(Runes))/((TimeGone));

Finally, we have defined all of our variables. I you have done it right the start of your Proggy Should look like this:

procedure ProggyTest;
begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
CurrentXP := GetXPBar(1);
XPGain := (CurrentXP - OriginalXP);
XPPerhour :=(3600*(XPGain))/((TimeGone));
LoadsPerhour :=(3600*(LoadsDone))/((TimeGone));
RunesPerHour := (3600*(Runes))/((TimeGone));


Writing the Proggy

This is Probably the easiest part of the Proggy, all you need know for this part is two simple functions
WritLn('')
IntToStr()
-Writeln simply Writes a Line in the debug box. You put the text within apostrophes.
-IntToStr simply converts an integer into a string so it can be written in the debug box.

Writing the loads done go like this:
Writeln('We have done: ' + IntToStr(LoadsDone);
So it writes in 'We have done: ' followed by the amount of LoadsDone. Simple right?

Here are a few more examples:

Writing the amount of Runes Crafted would go like this:
Writeln('We have crafted ' + IntToStr(Runes)
Writing the amount of XP Gained per hour would go like this:
Writeln('We have crafted: ' + IntToStr(RunesPerHour) + ' Runes Per Hour')

So now that you now how to Write In your variables into your Proggy. You can begin begin to mess around with it to improve the appearance of it. Here is what the code of my Proggy looks like(note that I've improved the appearance of the Proggy so it more complicated - but all it is is stars :p:

procedure ProggyTest;
begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
CurrentXP := GetXPBar(1);
XPGain := (CurrentXP - OriginalXP);
XPPerhour :=(3600*(XPGain))/((TimeGone));
LoadsPerhour :=(3600*(LoadsDone))/((TimeGone));
RunesPerHour := (3600*(Runes))/((TimeGone));
begin
Writeln('***************************************** *************************');
Writeln('*/////////---------- Abu''s''AirKrafter Version 2 ----------\\\\\\\*');
Writeln('*/////////----------____________________________----------\\\\\\\*');
Writeln('***************************************** *************************');
Writeln('');
Writeln('*/////////--------- Proggy for the player: ' + Players[0].Nick + ' --------\\\\\\\\\*');
Writeln('*/////////We have done: ' + IntToStr(LoadsDone) + ' Loads / Thats ' + IntToStr(LoadsPerHour) + ' loads per hour');
Writeln('*/////////We have gained: ' + IntToStr(XPGain) + ' xp / Thats ' + IntToStr(XPPerHour) + ' xp per hour');
Writeln('*/////////We have crafted ' + IntToStr(Runes) + ' Runes / Thats ' + IntToStr(RunesPerHour) + ' Runes Per Hour');
Writeln('');
end;
end;


And here is what it looks like in action:

************************************************** ****************
*/////////---------- Abu's'AirKrafter Version 2 ----------\\\\\\\*
*/////////----------____________________________----------\\\\\\\*
************************************************** ****************

*/////////--------- Proggy for the player: jwka --------\\\\\\\\\*
*/////////We have done: 7 Loads / Thats 29 loads per hour
*/////////We have gained: 980 xp / Thats 4126 xp per hour
*/////////We have crafted 997 Runes / Thats 4197 Runes Per Hour


And that's how to make a Progress Report for a Single Player Script!
If you have any problems, simply read over the guide.

Abu
03-22-2012, 08:04 PM
Multiplayer Proggies

If you do not know how to use Multiplayer: Go here (http://villavu.com/forum/showthread.php?t=12858)

Names and variables

Before reading this part, make sure you understand fully how to create Single Player Proggies and how to use the functions. Now, for naming variables, we want to do it exactly the same way we did above, make a list of these we want to be updated on in the Proggy and pick an appropriate variable name for it, like so:

- How many Loads I've done -- I'll name it LoadsDone
- How many Loads I've done per hour -- I'll name it LoadsPerHour
- How much XP I've gained -- I'll name it XPGain
- How much XP I've gained per hour -- I'll name it XPGainPerHour
- How many Runes I've crafted -- I'll name it Runes
- How many Runes I've crafted per hour -- I'll name it RunesPerHour


Now you just want to put these variables into your script. To do this, you declare them globally, so put 'var' at the start of your script just before you DeclarePlayers. Like so:
Var
CurrentXP, OriginalXP: Integer;
XPGain, LoadsDone, XPPerHour, Runes: Array of Integer;
TimeGone, LoadsPerHour, RunesPerHour: Array of Integer;

Because this is a Multiplayer Proggy, the variables need to be defined as an Array of Integer rather than just an integer like in the Single Player Proggies, with the exception of CurrentXP and OriginalXP. You should also take note

- TimeGone, which I will use in the Proggy to help me find out at what rate I have done procedures e.g (RunesPerHour)
- OriginalXP, which I will use to tell me how much XP I had to start of with - needed to find XPGain
- CurrentXP, which I will use to tell me how much XP I have at the moment - needed to find XPGain

Now that we have successfully put these Variables into our Script we need to know how to use them.


Functions Needed

You should know these already, but if you skipped the Single Player Proggies section....

Here are the main functions you will need to get your Proggy to work...:

GetTimeRunning
Inc(variable)
IncEx(variable, amount)
GetXPBar(1,2 or 3)
InvCount
GetAmountBox(box: TBox): integer; // Thanks to Er1k!
GetBankItemAmount(const Row, Col: Integer): Integer; // Thanks to Er1k x2!

...and this is what they do:

GetTimeRunning - Gets how long you have been playing the Script in milliseconds

Inc(variable) - This increases the variable you put in the brackets by 1.

IncEx(variable, amount) - This increases the variable you put in the brackets by the amount you put in after the comma

GetXPBar(1,2 or 3) - Gets the amount of XP you currently have. You can put in the number 1, 2 or 3 depending on which one seems to work for your script

InvCount - Returns amount of items in your inventory

GetAmountBox - Returns the amount of an item at in the box ‘box’. Use this for counting stackable items in your inventory. For 'box' put InvBox(i), with i being the inventory box you want to search in.

GetBankItemAmount - Returns the amount of an item in the bank at bank screen coordinates. For the first number put in the row you're searching in and for the second put in the column.


Using Functions

Once you've learned what those functions do, you want to know where to use them in your script.

Using Functions within your Script
The variables used here: LoadsDone, Runes
This is easy to do but it is also easy to forget. When using functions within your script on Multiplayer, you want to find out how well each player has done. You want to know how many loads each player did and how much xp each player gained.
So we do this by adding:
[CurrentPlayer]
after all our variables so it only finds the variable for the current player. If you don't understand what this means, look at the example below:

If I have just completed one load worth of Runecrafting. After I click the altar I would put this just before ending my Altar Clicking function:

Inc(LoadsDone) // for single Player Proggies
Inc(LoadsDone[CurrentPlayer]) // for Multiplayer Proggies
So it would increase my LoadsDone by 1 for the Current Player I am using..

Please not that the functions do not change, you simply add [CurrentPlayer] after your variable.


Using functions in your proggy
The variables used here are: TimeGone, XPGain, XPPerHour, LoadsPerHour, RunesPerHour, CurrentXP, OriginalXP
These variables are the ones we can't just simply update after doing the function. Instead, we define them here in the Proggy so we can see how they have updated.

The first thing you want to do when creating your Proggy is find out how long the script has been running for and define it with our variable TimeGone and the function GetTimeRunning, but remember what we said about adding [CurrentPlayer] after our variables? We do it here too:
TimeGone[CurrentPlayer] := (GetTimeRunning/1000);

Now we want to find out how much XP has been gained.
First we use the variable CurrentXP and the function GetXPBar(1) to find out how much XP we currently have, but in this case only we don't have to add [CurrentPlayer] as the we are not going to actually write in the CurrentXP, instead we're using it to find the XPGain.
CurrentXP := GetXPBar(1);
Then we use the OriginalXP variable we included earlier and put it in the mainloop, right after you Log In, but before you start your actual script. Put it in like this:
OriginalXP := GetXPBar(1);
So far you've found the XP you had before actually running the script and the Current XP that the player has. Now you can use this to find the increase in XP.
To do this, we use the variable XPGain and minus the OriginalXP from the CurrentXP, like so:
XPGain[CurrentPlayer] := (CurrentXP - OriginalXP);
So this will tell us how much XP we have Gained since starting the script. However even though I didn't use [CurrentPlayer] for CurrentXP and OriginalXP, I must use it for XPGain as I will be writing that in in the Proggy.


PerHour values require the TimeGone variable which we have already defined.
To find PerHour vales you simply divide the appropriate variables by the TimeGone and then times by 3600 to get the amount per hour. but also remember that here you must add [CurrentPlayer] after your variables.
Like so:
For XPPerHour:
XPPerhour[CurrentPlayer] :=(3600*(XPGain[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
For LoadsPerHour:
LoadsPerhour[CurrentPlayer] :=(3600*(LoadsDone[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
For RunesPerHour:
RunesPerHour[CurrentPlayer] := (3600*(Runes[CurrentPlayer]))/((TimeGone[CurrentPlayer]));

Finally, we have defined all of our variables. If you have done it right the start of your Proggy Should look like this:

procedure ProggyTest;
begin
if LoadsDone[CurrentPlayer] mod 5=0 then
ClearDebug;
CurrentXP := GetXPBar(1);
TimeGone[CurrentPlayer] := (GetTimeRunning/1000);
XPGain[CurrentPlayer] := (CurrentXP - OriginalXP);
XPPerhour[CurrentPlayer] :=(3600*(XPGain[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
LoadsPerhour[CurrentPlayer] :=(3600*(LoadsDone[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
RunesPerHour[CurrentPlayer] := (3600*(Runes[CurrentPlayer]))/((TimeGone[CurrentPlayer]));


Writing the Proggy

Here are two simple functions you will need to know to Write Proggies.
WritLn('')
IntToStr()
-Writeln simply Writes a Line in the debug box. You put the text within apostrophes.
-IntToStr simply converts an integer into a string so it can be written in the debug box.

The first thing you want to do when writing the Proggy for a Multiplayer Script is add the variable 'i' into the Proggy. Like this:
procedure ProggyTest;
var
i: Integer;
begin

Then, after all those variables we just defined, on the next line we want to write begin and add:
for i := 0 to HowManyPlayers - 1 do
This will declare the player we are using. If we are using the first player in the script(Players[0]), then i=0. If we are using the player after that then i=1. You can change the values appropriately to the number of players your script supports.

NOW, after adding this, we need to add[i] after all the variables we are writing in, that way it only writes the values for the player we are using (Players[0], Players[1] etc...) Writing the loads, unlike in Single Player Proggies now goes like this:
Writeln('We have done: ' + IntToStr(LoadsDone[i]);
So it writes in 'We have done: ' followed by the amount of LoadsDone followed by [i]. Simple right?

Here are a few more examples:

Writing the amount of Runes Crafted would go like this:
Writeln('We have crafted ' + IntToStr(Runes[i])
Writing the amount of Runes Crafted per hour would go like this:
Writeln('We have crafted: ' + IntToStr(RunesPerHour[i]) + ' Runes Per Hour')

So now that you now how to Write In your variables into your Proggy. You can begin begin to mess around with it to improve the appearance of it. Here is what the code of my Proggy looks like(note that I've improved the appearance of the Proggy so it more complicated - but all it is is stars :p:

procedure ProggyTest;
var
i: Integer;
begin
if LoadsDone[CurrentPlayer] mod 5=0 then
ClearDebug;
CurrentXP := GetXPBar(1);
TimeGone[CurrentPlayer] := (GetTimeRunning/1000);
XPGain[CurrentPlayer] := (CurrentXP - OriginalXP);
XPPerhour[CurrentPlayer] :=(3600*(XPGain[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
LoadsPerhour[CurrentPlayer] :=(3600*(LoadsDone[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
RunesPerHour[CurrentPlayer] := (3600*(Runes[CurrentPlayer]))/((TimeGone[CurrentPlayer]));
begin
Writeln('***************************************** *************************');
Writeln('*/////////---------- Abu''s''AirKrafter Version 2 ----------\\\\\\\*');
Writeln('*/////////----------____________________________----------\\\\\\\*');
Writeln('***************************************** *************************');
Writeln('');
for i := 0 to HowManyPlayers - 1 do
begin
Writeln('*/////////--------- Proggy for the player: ' + Players[i].Nick + ' --------\\\\\\\\\*');
Writeln('*/////////We have done: ' + IntToStr(LoadsDone[i]) + ' Loads / Thats ' + IntToStr(LoadsPerHour[i]) + ' loads per hour');
Writeln('*/////////We have gained: ' + IntToStr(XPGain[i]) + ' xp / Thats ' + IntToStr(XPPerHour[i]) + ' xp per hour');
Writeln('*/////////We have crafted ' + IntToStr(Runes[i]) + ' Runes / Thats ' + IntToStr(RunesPerHour[i]) + ' Runes Per Hour');
Writeln('');
end;
end;
end;


And here is what it looks like in action:

************************************************** ****************
*/////////---------- Abu's'AirKrafter Version 2 ----------\\\\\\\*
*/////////----------____________________________----------\\\\\\\*
************************************************** ****************

*/////////--------- Proggy for the player: jwka --------\\\\\\\\\*
*/////////We have done: 1 Loads / Thats 23 loads per hour
*/////////We have gained: 140 xp / Thats 3230 xp per hour
*/////////We have crafted 142 Runes / Thats 3276 Runes Per Hour

*/////////--------- Proggy for the player: N/A. --------\\\\\\\\\*
*/////////We have done: 0 Loads / Thats 0 loads per hour
*/////////We have gained: 0 xp / Thats 0 xp per hour
*/////////We have crafted 0 Runes / Thats 0 Runes Per Hour


One final thing

The last thing you have to do, is set the lengths of your array. To do this simply make a procedure like this and set the lengths to HowManyPlayers:

procedure SetArrayLengths; //renamed to fit purpose
begin
SetLength(TimeGone,HowManyPlayers);
SetLength(XPPerHour,HowManyPlayers);
SetLength(LoadsPerHour,HowManyPlayers);
SetLength(XPGain,HowManyPlayers);
SetLength(LoadsDone,HowManyPlayers);
SetLength(Runes,HowManyPlayers);
SetLength(RunesPerHour,HowManyPlayers);
end;

And then load that in your mainloop after SetUpSRL; :)

And that's how to make a Progress Report for a Single Player and Multiplayer Script!
If you have any problems, simply read over the guide.

If you want to go one step further and get your Progress Report Onscreen, then go here (http://villavu.com/forum/showthread.php?t=75666)


Special Thanks to:
bolshak25 - for helping me understand how to use Proggies

begginer
03-22-2012, 10:35 PM
Nice tutorial. I'd like to see how can I make for fighting. :)

Aegis
04-02-2012, 12:18 AM
Great tutorial! I can tell a lot of work and effort went into creating it, and I like how in-depth it goes. I'll be sure to direct anyone here if they need any help creating progress reports!

Imanoobbot
04-11-2012, 04:40 PM
Great tutorial! It really explains it all! ;)

stu
04-15-2012, 06:43 PM
ok i copied your proggy exactly and changed it slightly for my fishing script, just to test it out, but it doesnt seem to count my xp?
If i get xpbar(1) it starts on like -4000000xp, (2) it starts on +4000000xp, and (3) starts on 0xp gained and never rises?

heres the code

procedure Proggy;
begin
ClearDebug;
TimeGone := (GetTimeRunning/1000);
CurrentXP := GetXPBar(3);
XPGain := (CurrentXP - OriginalXP);
XPPerhour :=(3600*(XPGain))/((TimeGone));
begin
begin
Writeln('***************************************** *************************');
Writeln('*/////////---------- Stus Leap Fisher v0.1----- ----------\\\\\\\*');
Writeln('***************************************** *************************');
Writeln('');
Writeln('*/////////--------- Proggy for the player: ' + Players[0].Nick + ' --------\\\\\\\\\*');
Writeln('*//////////////////Running for: ' + IntToStr(TimeGone) + 'seconds' );
Writeln('*/////////We have gained: ' + IntToStr(XPGain) + ' xp / Thats ' + IntToStr(XPPerHour) + ' xp per hour');
end;
end;

Total
04-15-2012, 06:47 PM
Try using GetXPBarTotal instead.

stu
04-15-2012, 06:53 PM
that got the total xp on my xp counter as xp gained, rather than starting xp

yeah no matter what i try it doesn't seem to subtract original xp

Total
04-15-2012, 06:58 PM
Did you get your OriginalXP variable to GetXPBarTotal when you started the script? I see you have CurrentXP - OriginalXP but from what you are saying OriginalXP is set to 0.

stu
04-15-2012, 07:06 PM
Did you get your OriginalXP variable to GetXPBarTotal when you started the script? I see you have CurrentXP - OriginalXP but from what you are saying OriginalXP is set to 0.

yeah i just realised i had written that part wrong when I saw this post :p
thanks for all your help today with me being an idiot

RightClick
04-17-2012, 12:07 PM
awsome, thanks to you, will use this tuto to do my first proggy, =F

Abu
04-17-2012, 02:50 PM
awsome, thanks to you, will use this tuto to do my first proggy, =F

Thanks for sorting that out for me ;)

Er1k
04-17-2012, 03:15 PM
GetTextAtExWrap is not really necessary AFAIK.

Bank items you should be able to get it through GetBankItemAmount, Inventory you should look into GetAmountBox(InvBox(slot_here)).

I would let SRL do it for me unless these functions don't work.

Nice tutorial though. My proggy skill is totally stuck at using getXPtotal to calculate the XP gain. IMO it's ghetto, but quick and dirty :D

Abu
04-17-2012, 03:21 PM
GetTextAtExWrap is not really necessary AFAIK.

Bank items you should be able to get it through GetBankItemAmount, Inventory you should look into GetAmountBox(InvBox(slot_here)).

I would let SRL do it for me unless these functions don't work.

Nice tutorial though. My proggy skill is totally stuck at using getXPtotal to calculate the XP gain. IMO it's ghetto, but quick and dirty :D

Thanks! I had no idea they exist but I'll definitely put them in :)

Er1k
04-17-2012, 03:25 PM
Protip: You can even use getBankItemAmount to decide how many to withdraw in order to keep the placeholder for the item. I have a really ghetto one implemented in some of my scripts earlier, but I'm sure you can do a more robust "withdraw all but one" by checking the item amount and always keep the item at the same slot :D

E: As a failsafe, remember to stall the bank loading until it sees bankamount > 0 in any slot you're checking. Bank loading can be laggy and it was a bug worth remembering because it's easy to forget about this exception.

Joe
04-17-2012, 04:22 PM
Very good tutorial! Very understandable and I just made a proggy for 2 of my scripts! Thanks!

pencilbi
04-23-2012, 09:50 AM
good tut!
Very usefull report form,i will add this to my scripts.Thanks

Abu
04-24-2012, 03:38 PM
No problem guys!

samuri51
05-27-2012, 06:04 AM
procedure progressreport;
begin
ClearDebug;
TimeGone := (getrunningtime/1000);
CoalinInv := InvCount
CurrentXp := GetXPBar(1);
XpGain := (Currentxp-GetXPBarTotal);
XpPerHour :=(3600*(xpgain))/((timegone));
begin
writeln('*Simple Powerminer version one*');
writeln('*We have mined:' +IntToStr(CoalinInv) + 'coal*');
writeln('*We have gained:' + IntToStr(XpGain) + 'xp / Thats' + IntToStr(XpPerHour)+ 'xp per hour*');
writeln('*Total running time:' + IntToStr(getrunningtime/60000) + 'minutes*');
end;
end;


keep getting divide by 0 error? :S

Abu
05-27-2012, 02:27 PM
On which line?

P1ng
05-29-2012, 01:05 PM
Attempting to implement multiplayer progress report into one of my scripts, but whenever I add IncEx(strung[CurrentPlayer],14);


[Error] (560:15): Semicolon (';') expected at line 559
Compiling failed.

Does the [CurrentPlayer] addition only work for Inc instead of IncEx, or is there something else I am not adding?

NB: without the [CurrentPlayer] the script compiles perfectly.

Abu
05-29-2012, 04:36 PM
Does the [CurrentPlayer] addition only work for Inc instead of IncEx, or is there something else I am not adding?

NB: without the [CurrentPlayer] the script compiles perfectly.

Have you declared CurrentPlayer as an Array of Integer?

cadet54
05-29-2012, 07:47 PM
This is awesome just what I was looking for thanks very much for the work gone into the guide :)

P1ng
05-30-2012, 02:15 AM
Have you declared CurrentPlayer as an Array of Integer?

That'd be where I went wrong, thank-you very much! :)

EDIT: Compiles fine and the script runs through right up until IncEx(strung[CurrentPlayer],14);
then I get a
Error: Out Of Range at line 575

Any ideas?

Abu
05-30-2012, 03:54 PM
Have you set the Array Lengths?

I forgot to include this in the tutorial.

Basically make a function like this:

procedure SetArrayLengths;
begin
SetLength(TimeGone,HowManyPlayers);
SetLength(XPPerHour,HowManyPlayers);
SetLength(LoadsPerHour,HowManyPlayers);
SetLength(XPGain,HowManyPlayers);
end;

You need to do that for every variable you use - in that case, I think it's 'strung'

Master BAW
06-18-2012, 07:09 PM
Sweet! will use this to estimate profit and profit per hour :D

pulse0
02-18-2013, 06:39 PM
im having a bit of trouble with my proggie, i've got it to count exp gained and per hr, i've got it to calculate loads done and per hr. but when trying to get logs and logs per hour it keeps reseting. when i try to use Inc(logs); it only counts 1 log per invo i fill, when i use Logs:= InvCount; it counts till 28 then when i drop the load it resets im guessing i dont have them placed properly.. dont mind my code, its a butcher job atm, just kinda reading tuts and going along with it, once i get a little more knowledge ill fine tune/clean up everything,. any suggestions are greatly appreciated.

program new;
{$DEFINE SMART8}
{$i SRL/SRL.simba}
//{$i SRL/SRL/Misc/Stats.simba}

Const
SRLStats_Username = ''; //Your SRL Stats Username
SRLStats_Password = ''; //Your SRL Stats Password
BreakEvery = 120; //How many minutes to break after
BreakFor = 5; //How long to break for
Version = '1.0';
NumbOfPlayers = 1; //How many players you are using
StartPlayer = 0; //Player to start autoing with! (0 means first char)

Var
XPGained, LoadsDone, TimeRun, Logs, TooLong: Integer;
XPPerHr, LoadsPerHr, LogsPerHr, CurrentXp, OriginalXp: Integer;

procedure DeclarePlayers;
var i:integer;
begin
NumberOfPlayers(NumbOfPlayers);
CurrentPlayer := StartPlayer;
for i := 0 to NumbOfPlayers-1 do
Players[i].BoxRewards := ['mote', 'ostume', 'XP', 'Gem', 'ithril', 'oal', 'une', 'oins'];

with Players[0] do
begin
Name := ''; //Player username.
Pass := ''; //Player password.
Nick := ''; //Player nickname - 3-4 letters of Player username.
Active := True;
Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
Integers[2] := 4; //Seconds to try mining rock before clicking another.
end;

// with Players[1] do
// begin
// Name := ''; // Player username.
// Pass := ''; // Player password.
// Nick := ''; // Player nickname - 3-4 letters of Player username.
// Active := True;
// Integers[1] := 4; //1=BrightCopper,2=DarkCopper,3=Tin,4=Iron.
// Integers[2] := 4; //Seconds to try mining rock before clicking another.
// end;
end;

Procedure StatsGuise(wat:String);
Begin
Status(wat);
Disguise(wat);
End;

Procedure Antiban;
Begin
If(Not(loggedIn)) Then
Exit;
Case Random(100) of
0: HoverSkill('Woodcutting', False);
1: BoredHuman;
2: ExamineInv;
3: Wait(2500 + Random(3000));
4: HoverSkill('Firemaking', False);
5: Wait(3000);
6: CompassMovement(15, 45, True);
7: Wait(4500 + Random(2000));
8: PickUpMouse;
9: RandomTab(True);
10:HoverOnlineFriend;
end;
End;

procedure Failsafe (reason:string);
begin
Players[CurrentPlayer].Loc:=reason;
logout;
Stats_Commit;
Writeln(reason);
//ProgressReport;
TerminateScript;
end;

Function Chopping: Boolean;
var
PBox: TBox;
begin
PBox := IntToBox(245, 130, 285, 195);
Result := (AveragePixelShift(PBox, 250, 500) > 500);
Writeln(IntToStr(AveragePixelShift(PBox, 500, 650)));
end;

function TeakTreeColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.31, 0.06);

if not (FindColorsTolerance(arP, 5659235, MSX1, MSY1, MSX2, MSY2, 17)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
//Writeln('AutoColor failed in finding the color.');
end;

procedure ChopTeakTree;
var
x, y: integer;
begin
If (Chopping) then
begin
wait(100);
end else
begin
MarkTime(TooLong);
x:=MSCX;
y:=MSCY;
If FindObjTPA(x, y, TeakTreeColor, 1, 1, 1, 1, 1, ['Cho']) Then
begin
MMouse(x, y, 1, 1);
ClickMouse2(mouse_left);
StatsGuise('Chopping Teak Tree')
WaitFunc(@Chopping, 10, 3000);
Logs:= Invcount; {invCount}
end;
end;
end;

procedure DropTeakLogs;
var
x, y, LogDTM, I:Integer;
SlotBox:TBox;
LogPattern:TIntegerArray;
begin
Inc(logs); {here is logs}
MarkTime(TooLong);
LogDTM := DTMFromString('mbQAAAHicY2VgYHjPxMDwHIjvAfENIP4KxB GMDAypQBwDxLlAnAXEDAxMDL3lAWAahn8BSXTMiAWDAQBYAAzJ ');
LogPattern:=[1, 5, 9, 13, 17, 21, 25, 2, 6, 10, 14, 18, 22, 26, 3, 7, 11, 15, 19, 23, 27, 4, 8, 12, 16, 20, 24, 28];
For I:=0 to 26 do
begin
StatsGuise('Dropping Teak Log:' + IntToStr(I));
SlotBox:=InvBox(LogPattern[I]);
If FindDTM(LogDTM, x, y, SlotBox.X1, SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
begin
MouseItem(LogPattern[I], mouse_right);
ChooseOption('Dro');
end;
end;
Inc(LoadsDone); {here is loadsdone}
MarkTime(TooLong);
end;

Procedure HardwoodGroveProggie;
begin
If(Not(LoggedIn)) then
Exit;
ClearDebug;
TimeRun := (GetTimeRunning/1000);
CurrentXP := GetXPBar(1);
XPGained := (CurrentXP - OriginalXP);
XPPerHr := (3600*(XPGained))/((TimeRun));
LoadsPerHr := (3600*(LoadsDone))/((TimeRun));
LogsPerHr := (3600*(Logs))/((TimeRun));
Begin
Writeln('We Have Done: ' + IntToStr(LoadsDone) + ' Loads / Thats ' + IntToStr (LoadsPerHr) + ' Loads Per Hr ');
Writeln('We Have Gained: ' + IntToStr(XPGained) + ' XP / Thats ' + IntToStr (XPPerHr) + ' XP Per Hour ');
Writeln('We Have Cut: ' + IntToStr(Logs) + ' Logs / Thats ' + IntToStr (LogsPerHr) + ' Logs Per Hour ');
end;
end;

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
SetAngle(SRL_ANGLE_LOW);
MakeCompass( 'W');
OriginalXP := GetXPBar(1);
Repeat
ChopTeakTree;
If InvFull Then
DropTeakLogs;
HardwoodGroveProggie; {proggie}
Until(false);
end.

Le Jingle
02-18-2013, 07:51 PM
One place that won't ever allow logs to exceed 28, is, Logs:= Invcount; {invCount}. This would be able to grow/increase by changing it to Logs := Logs + InvCount; Didn't look at any of the other code, but hopefully this may help.

pulse0
02-18-2013, 08:26 PM
One place that won't ever allow logs to exceed 28, is, Logs:= Invcount; {invCount}. This would be able to grow/increase by changing it to Logs := Logs + InvCount; Didn't look at any of the other code, but hopefully this may help.

thank-you very much, all i had to do was change it to Logs := Logs + InvCount; and move it into my drop procedure and now it adds 28 logs everytime i finish dropping.