SRL Archive - Help and Support

Canvas does not allow drawing


The Claw

2007-08-22 07:49:12

Just wondering, what causes these errors? These ones:

[Runtime Error] : Exception: Canvas does not allow drawing in line 

Cause people have been getting them while running my VWM, on seemingly random lines. I dont even use any canvas in my script, unless FindColorSpiralTolerance counts? But yeh any ideas on why these errors keep popping up?

Bobarkinator

2007-08-22 08:00:45

Those usually happen when you are using FindColor(…) and your top left corner declared by the first set is less than the bottom right. That's the only time I have ever gotten it.

nielsie95

2007-08-22 08:03:40

I think it also sometimes happens when you're searching out of the client.

The Claw

2007-08-22 08:19:15

Well the top left isnt bigger than the bottom right, i know that for sure. I think what nielsie is saying sounds right, cause i have also seen the script click on the sides of firefox, for unknown reasons. in my script i have this line:

if FindColorSpiralTolerance(x, y, OreColour, x - 30, y - 30, x + 30, y + 30, OreTol)

which is repeated while the player is moving towards the rock. say that something covered up the ore colour for like a millisec, x and y would get 0, 0 as the co-ords yeh? and the x - 30, etc would make a box outside of the client. then when its called next (50 millisec later) it would get that error i think?

but then i have

end else
begin
Result := False;
x:= MSCX;
y:= MSCY;

after it, which is if it doesnt find the colour, then it sets x and y to the middle of the screen. hey what would happen if the orecolour was found, but was very close to the edge? the box would be made a little off the client yeh?

how would i prevent this? soz, thinking out loud, also with my fingers lolz but any answers appreciated.

Sumilion

2007-08-22 08:25:24

if(x < 30)then
x := 30;
if(y < 30)then
y := 30;

The Claw

2007-08-22 08:42:48

But I need it to be less than 30 so it makes a box around the rock, I only want it to not be less than 0 if it is going to go offscreen. So I need a way of checking if the box that is going to be made will be off the screen or not

Sumilion

2007-08-22 09:00:36

if(x < 30)or(y < 30)then
begin
DoStuffToNotMakeItGoOffScreenPleaseOrElseItWillErrorToDeath;
end;

The Claw

2007-08-23 04:07:47

obviously lol….i need to know what DoStuffToNotMakeItGoOffScreenPleaseOrElseItWillErrorToDeath would have in it.

Sumilion

2007-08-23 05:15:41

By the way if you just want a box around the rock then my first suggestion should just work…

The Claw

2007-08-23 06:22:09

Yea, but I already have the box. You're probably right, I just don't understand what you mean fully. here's a pic I drew up.


The green is the runescape client, the red is the rock, half of it is on the screen. the box around the rock is made when this is called:

if FindColorSpiralTolerance(x, y, OreColour, x - 30, y - 30, x + 30, y + 30, OreTol)

which is every 50 millisecs, until we have stopped moving towards the rock. so in that pic, the box is made on the first call of that line ^ and then on the next call, because the box to search in is off the screen it would get the error. I think that is what happening, just to clarify that we're both on the same page here.

So is what you posted a fix for the problem? If it is, could you explain it more please? I cant see where/how to put it in my script

EDIT ———————

ok, yeh got it. sorry for not seeing what ya meant earlier, lol. :)

Bobarkinator

2007-08-23 08:18:48

If (x < MMX1) or (y < MMY1) then x:= MMX1 y:= MMY1. you could do something like that to not make it go off the screen.