SRL Archive - OSR Help

Graphical progress reports


Yanhua

2011-12-26 15:10:23


Is there a complete guide or tutorial on how to make these on Simba?

I remember every script in RSBuddy, Nexus or RSBot had one, yet they are so rare on scripts here? Why is this, are scripters just too lazy or something or are they actually much harder.

I've got no idea, tell me.

RISK

2011-12-26 15:11:24

http://villavu.com/forum/showthread.php?t=68856 :)

Shuttleu

2011-12-26 15:11:43

i have one in my scripts

here is the code

Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,131072);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;

Procedure OnScreen;
Var
h, m, s, TempExp: Integer;
SmartLines: TStringArray;
begin
TempExp:= GetXPBarTotal;

if Debug then
Writeln(TempExp);
Players[CurrentPlayer].Integers[9]:= TempExp;
ConvertTime(TimeFromMark(ScriptStarted), h, m, s);

SetArrayLength(SmartLines, 7);

SmartLines[0]:= 'Running time: '+PadZ(IntToStr(h), 2)+':'+PadZ(IntToStr(m), 2)+':'+PadZ(IntToStr(s), 2);
SmartLines[1]:= 'Woodcutting Level: '+IntToStr(Players[CurrentPlayer].Integers[2]);
SmartLines[2]:= 'Vines Chopped: '+IntToStr((Players[CurrentPlayer].Integers[9]-Players[CurrentPlayer].Integers[1])/332);
SmartLines[3]:= 'Levels Gained: '+IntToStr(Players[CurrentPlayer].Integers[10]-Players[CurrentPlayer].Integers[2]);
SmartLines[4]:= 'Experience Gained: '+IntToStr(Players[CurrentPlayer].Integers[9]-Players[CurrentPlayer].Integers[1]);
SmartLines[5]:= 'Experience/hr: '+IntToStr(round((Players[CurrentPlayer].Integers[9]-Players[CurrentPlayer].Integers[1])/ (h * 1.0 + m / 60.0 + s / 3600.0)));
SmartLines[6]:= 'Birds Nests: '+IntToStr(Players[CurrentPlayer].Integers[3]);

PrintOnSmart(['~Vine Vanquisher '+ScriptVersion+' (by Shuttleu)~'],Point(15,20),65280);
PrintOnSmart(SmartLines,Point(10,50),clWhite);

end;
just edit that as you need

~shut

Yanhua

2011-12-26 15:17:10

From: Shuttleu
i have one in my scripts

here is the code

Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,131072);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;

Procedure OnScreen;
Var
h, m, s, TempExp: Integer;
SmartLines: TStringArray;
begin
TempExp:= GetXPBarTotal;

if Debug then
Writeln(TempExp);
Players[CurrentPlayer].Integers[9]:= TempExp;
ConvertTime(TimeFromMark(ScriptStarted), h, m, s);

SetArrayLength(SmartLines, 7);

SmartLines[0]:= 'Running time: '+PadZ(IntToStr(h), 2)+':'+PadZ(IntToStr(m), 2)+':'+PadZ(IntToStr(s), 2);
SmartLines[1]:= 'Woodcutting Level: '+IntToStr(Players[CurrentPlayer].Integers[2]);
SmartLines[2]:= 'Vines Chopped: '+IntToStr((Players[CurrentPlayer].Integers[9]-Players[CurrentPlayer].Integers[1])/332);
SmartLines[3]:= 'Levels Gained: '+IntToStr(Players[CurrentPlayer].Integers[10]-Players[CurrentPlayer].Integers[2]);
SmartLines[4]:= 'Experience Gained: '+IntToStr(Players[CurrentPlayer].Integers[9]-Players[CurrentPlayer].Integers[1]);
SmartLines[5]:= 'Experience/hr: '+IntToStr(round((Players[CurrentPlayer].Integers[9]-Players[CurrentPlayer].Integers[1])/ (h * 1.0 + m / 60.0 + s / 3600.0)));
SmartLines[6]:= 'Birds Nests: '+IntToStr(Players[CurrentPlayer].Integers[3]);

PrintOnSmart(['~Vine Vanquisher '+ScriptVersion+' (by Shuttleu)~'],Point(15,20),65280);
PrintOnSmart(SmartLines,Point(10,50),clWhite);

end;
just edit that as you need

~shut


From: RISK
http://villavu.com/forum/showthread.php?t=68856 :)


Thank you guys. Very quick replies indeed.

PatDuffy

2011-12-26 15:24:40

Pssst Shut, care to add comments to yours to show what exactly everything does? :p

I know how to make the simple ones, but I would be interested to start using more detailed ones to make my scripts more smexi.

Shuttleu

2011-12-26 15:34:55

sure

Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
var
mx, my, Pic, I, B, H, TPH, Numb: Integer;
TTP: TPointArray;
Canvas: TCanvas;
begin
SmartSetDebug(True);
GetClientDimensions(mx, my);
Pic := BitmapFromString(mx, my, '');
TPH := High(TP);
for I := 0 to TPH do
begin
TTP := LoadTextTPA(TP[i], SmallChars, H);
for B := 0 to High(TTP) do
begin
Numb := ((I + 1) * 13);
FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,131072);
FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
end;
end;
Canvas := TCANVAS.Create;
Canvas.Handle := SmartGetDebugDC;
DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
FreeBitmap(Pic);
end;

// Dont need to worry about this above

Procedure OnScreen;
SmartLines: TStringArray;
begin

SetArrayLength(SmartLines, 7); // sets how many lines to write

SmartLines[0]:= 'Line 1';
SmartLines[1]:= 'Line 2';
SmartLines[2]:= 'Line 3';
SmartLines[3]:= 'Line 4';
SmartLines[4]:= 'Line 5';
SmartLines[5]:= 'Line 6';
SmartLines[6]:= 'Line 7';
//these are what to write on the lines

PrintOnSmart(['Title'],Point(15,20),65280); // title line
PrintOnSmart(SmartLines,Point(10,50),clWhite); // lines set above

end;

~shut

PatDuffy

2011-12-26 15:37:19

Ahhh, I'm going to also take a quick look at Flight's Naturez to see how to print a picture.

That was actually much more effective than the way I was doing it.