SRL Archive - OSR Help

needing help with Woodcutter:


Yush Dragon

2010-08-12 16:26:46

Hey guys,

i got a function to cut a tree but uhmm
how can i make a function that tells me that the tree is cutted?

Dynamite

2010-08-12 17:48:05

Beginner: if FindColor(TreeStump, x, x1, y, y1) then
TreeCut;
Intermediate: Same as above but with TPA :)

Another Option: if not Animating then
TreeCut;

Blumblebee

2010-08-12 17:51:09

I prefer to save the x and y where you cut the tree and search for the tree color in a 10 pixel box around that area. Once the tree color isn't found anymore then you move onto your next tree.

You can also just keep hovering the tree and watch the uptext, once the uptext is gone then move to a new tree.

Heavenguard

2010-08-12 19:07:59

I would say make a box using ATPA's around the tree you want to cut. Remove any Points outside of that box, and pretty much do what blumblebee said, except i would have done a bounds check instead of a color check :P The other responses look more then solid though =]

Blumblebee

2010-08-13 01:32:22

From: Heavenguard
I would say make a box using ATPA's around the tree you want to cut. Remove any Points outside of that box, and pretty much do what blumblebee said, except i would have done a bounds check instead of a color check :P The other responses look more then solid though =]


curious, what do you mean by bounds check? I'm interested :)

Heavenguard

2010-08-13 01:42:31

From: Blumblebee
curious, what do you mean by bounds check? I'm interested :)


Simple =]. Just check the bounds of the box you just made.


Tree.ATPA := SplitTPAEx(Tree.TPA, Tree.W, Tree.H);
// Made sure u got ur correct tree and everything.
Tree.Box := GetTPABounds(Tree.ATPA[{TheTPA}]);
while ((Tree.Box.X2 - Tree.Box.X1) >= {Width}) and ((Tree.Box.Y2 - Tree.Box.Y1) >= {Height} do
//Wait or Keep Checking the Bounds or w/e

just a simple example on what i meant :P Just checkin the bounds n stuff. I like your color method as well =]

Blumblebee

2010-08-13 01:46:26

From: Heavenguard
Simple =]. Just check the bounds of the box you just made.


Tree.ATPA := SplitTPAEx(Tree.TPA, Tree.W, Tree.H);
// Made sure u got ur correct tree and everything.
Tree.Box := GetTPABounds(Tree.ATPA[{TheTPA}]);
while ((Tree.Box.X2 - Tree.Box.X1) >= {Width}) and ((Tree.Box.Y2 - Tree.Box.Y1) >= {Height} do

just a simple example on what i meant :P Just checkin the bounds n stuff. I like your color method as well =]


ah okay so in other-words you refind the TPA and check it against the original width and height, similar to the color method just checking a different aspect of the TPA. Cool, thanks

Heavenguard

2010-08-13 01:49:53

From: Blumblebee
ah okay so in other-words you refind the TPA and check it against the original width and height, similar to the color method just checking a different aspect of the TPA. Cool, thanks


Yup =] You got it bro. Np :)