Making a Progress Report Tutorial
by : WhiteShadow
Difficulty: pfft, easy. :]
Progress reports are reports that are debugged in Scar's Debug. It shows your autoing progress.
They should display....
- Shows how long script has been running
- How much you've gained, a value of some sort Ex. ('You've mined 10 loads!')
Alright, so how do you show a certain value in your report? I will be using mining examples since they are most common these days.
Set a Global Variable that stores the value.
Example:
Code:
program Miner;
{.include SRL/SRL.Scar}
var//Global Variable SetUp
Loadz : Integer;//Change Loadz to any var name you want
const
Now how does that "Loadz" add more instead of just 0? Whatever your doing, mining, fishing, w/e, after that thing is done, Ex. (A load of ore or fish dropped, a load banked)
Inside that procedure you do Loadz:= Loadz + 1
Examples :
Code:
procedure DropOre;
begin
DropAll;//Dropped a full load of iron!
Loadz := Loadz + 1;//Loads done would be added 1
end;
Code:
procedure BankAll;
begin
repeat
OpenBank;//Repeats till finds bank screen opened
until(BankScreen)
Deposit2(1, 28);//Deposits All A load deposited
Loadz:= Loadz + 1;//Ah, Loadz Done plus another
end;
Code:
procedure Killer;//Just more Examples
begin
if(FinObj(x, y, 'Attack', Monster, 10))then//Finds Monster
Mouse(x, y, 1, 1, true);//if finds, clicks
repeat
Wait(100);//repeats wait till not find status bar
until(not(FindColorSpiral(x, y, GreenStatusColor, x1, y1, x2, y2)))//No time for coords
Killed:= Killed + 1//Kills Plus + 1
end;
Now how do I make it get displayed as a string so it can appear in the debug?
Code:
procedure Report;//Starts procedure off
begin
Writeln('[]-------------------------------------------[]');//Do any style you want
Writeln('Worked For : ' + ScriptTime2(2))//Displays how long it worked for
Writeln('Mined/Dropped '+ IntToStr(Loadz) + ' Loads');
Writeln('[]--------------------------------------------[]');
end;
Ok I will explain. ScriptTime2(2) displays how long script worked for as a string. You can use other functions or options, look in SRL includes for more options.Or just use my way.
IntToStr(Loadz) it retuns your Global Variable as a string instead of a stored variable integer.
Integer to String.
When you need to add more text use "+" ore your going to get some kind of comma error.
Well thats about it. I have a headache, blah. Sorry for any mistakes, this computer doesn't even have SCAR right now so.
Hope you guys learned something!
~WhiteShadow