SRL Archive - MSI Archives

SMART Paint.


BobboHobbo

2010-07-12 06:31:40

Well I found it sooo annoying trying to check the progressreport while the script keeps spitting out so much debug ;D. We should have a SMART paint canvas.

Like this:

I was thinking of making it like you press F12 or something and it switches between details of the canvas report on screen.

I stole the SMART canvas painting off naikes pest control script, So not sure if were even allowed to use it but.. heres the code i used to make it work..


procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour, Shadow: 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, Shadow);
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;

And this in the progress report func:

with ProgressReportArray[CurrentPlayer] do
begin
for j := 0 to High(ScriptInfo) do //scriptInfo
with ScriptInfo[j] do
begin
for l := 0 to High(MSI_Players[i].Items[j][k]) do
begin
PrintOnSmart([' Basic Progress Report'],Point(22, 30), 62207, 131072);
PrintOnSmart([
'Time Running: ' + TimeRunning,
'Players active: ' + ToStr(PlayersActive) + '/' + ToStr(HowManyPlayers),
'Time: ' + MsToTime(scriptRuntime, Time_Short),
'Loads: ' + IntToStr(playerLoads),
'Amount: '+ GroupDigits(PlayerItemAmounts[k][l], ','),
'Exp: ' + GroupDigits(playerGainedExp, ','),
''], Point(30, 60), 1959605, 131072);
end;
end;
end;

I dunno if its the best way to do it, just it was the quickiest and easiest at the time.

Sir R. M8gic1an

2010-07-12 08:24:49

I like this.

Although I think we could place it in the chat box. Just give the text the same background color as the chat box and place it there.

That way we can then use the MM to debug other stuff ;)

I'm sure naike will have no trouble with us using this code. Worst case scenario we could just re-write it.

~RM

BobboHobbo

2010-07-12 08:36:46

From: Rasta Magician
I like this.

Although I think we could place it in the chat box. Just give the text the same background color as the chat box and place it there.

That way we can then use the MM to debug other stuff ;)

I'm sure naike will have no trouble with us using this code. Worst case scenario we could just re-write it.

~RM


Ahh that would be pretty cool! nice idea. Im going to try that out right now.

EDIT*
Hmm what do you think?

Narcle

2010-07-12 10:16:26

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

There's a couple different ways of painting on the debug canvas (just scroll down I posted them).

Multi colored debug would be cool. I like the idea of having the progress report over the chat, makes it look nice.

BobboHobbo

2010-07-12 10:22:29

From: Narcle
http://villavu.com/forum/showthread.php?t=57447

There's a couple different ways of painting on the debug canvas (just scroll down I posted them).

Multi colored debug would be cool. I like the idea of having the progress report over the chat, makes it look nice.


Ohh I like how your function has multicolours that good. I likes. Ill try it with that tommorow see how it looks :).

Sir R. M8gic1an

2010-07-12 17:49:46

I'd say give it a little bit more space and a couple pretty colours ;)

~RM

Coh3n

2010-07-13 22:31:40

Haha I love this! :D

It's getting added for sure…

And I know what you mean, it is annoying trying to find the proggy. I usually pause the script (or just open the file if I have it saving them).