SRL Archive - RS3 Help

Trouble Setting Up a Successful Paint


srlMW

2015-06-09 22:36:33

Following @Clarity's guide I manage to throw together a paint to add into my script. Upon setting it up I was fronted with a baffling problem… When starting the script it sets up the paint, but as soon as it goes to start cutting the trees, the paint goes away. :confused:

If you need more input just ask! :)

The global var
var
paintBMP := loadBitmap(appPath + '/Scripts/MWsMasterTreeChopperv1/Paint.png');

My procedure
procedure paintDisplay();
begin
smartImage.clear;
smartImage.drawBitmap(paintBMP, Point(0, 463));
end;

The mainLoop + mainloop
procedure mainLoop();
begin
clearScreen();
setCompass();
while not tabBackPack.isFull() do
begin
locateTrees();
end;
progressReport();
case random(4) of
0..2: fletchLogs();
3..4: burnLogs();
end;
progressReport();
end;

begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
paintDisplay();
findNormalRandoms();
repeat
mainLoop();
until (LoadsDone > 1000);
end.

Clarity

2015-06-09 22:38:56

You need to be constantly redrawing the paint image during every iteration of the mainLoop to update the information. SMART drawing doesn't take layers into account, if you clear an area, everything will be cleared.


procedure mainLoop();
begin
setCompass();
while not tabBackPack.isFull() do
begin
locateTrees();
end;
progressReport();
case random(4) of
0..2: fletchLogs();
3..4: burnLogs();
end;
clearScreen();
progressReport();
paintDisplay();
end;

begin
clearDebug();
smartEnableDrawing := true;
setupSRL();
findNormalRandoms();
repeat
mainLoop();
until (LoadsDone > 1000);
end.

If your loop is executing too quickly, the image will likely flicker, as it is constantly clearing and redrawing. It's up to you whether you'd like to update once every few loops, or add in wait delays.

srlMW

2015-06-09 22:41:02

From: Clarity
You need to be constantly redrawing the paint image during every iteration of the mainLoop to update the information. SMART drawing doesn't take layers into account, if you clear an area, everything will be cleared.


Cheers for the quick reply, will do the necessary changes now! :duh: