SRL Archive - Outdated / Broken

Making a special woodcutting function


Pure1993

2008-02-12 11:24:11

Okay, I was thinking I am going to make my own includes for my script, so it would take less lines, and be easier to use them on different scripts and such.
Well, here is what I am trying to create:
It is supposed to be a function, which chops a tree. Now, i know there are tons of functions doing that, and they are fairly easy to create. Well, I am trying out a new way to do it, which will, if it works, cooperate with another function, which waits until the tree is down, even though if there are other trees on the screen, which might even appear closer to your character than the one you are actually chopping. Now, here is what I was thinking on doing:
First of all, it should check on the minimap for trees. If they are found, it should record where on the minimap it is located. Now, the way I intend to do this is to "split" the minimap in 4 sections, something like this:

___ ___
/ | \
/ | \
---------
\ | /
\__|__/

So it doesn't really save the coordinates, but if it is found in the upper left, upper right, lower left, or lower right corner. Then it make the main screen go to the highest angle. After that, it "divides" the main screen into 4 parts also. Now, if the tree was found in the lower right corner, the prgram will only check there for a tree. It should click on the exact tree which it chose on the minimap. Using the data of where on the screen it was originally found, it will check for the tree again after it clicked on it and walked there, taking the information it acquired earlier, to roughly make out the position on which the tree should be now. This should make it possible to wait until the tree is choped down, no matter how many trees are around and close by. Of course, the minimap ranges further than the screen, so if a tree was found on the mini map, but not on the screen, it will move closer to that tree.

Now, my question is what you think of this idea, and I would also be happy for any advice I get. :)

BTW: I am sorry if this is posted in the wrong section, I simply had no idea where this would fit in. :(

Sir R. M8gic1an

2008-02-12 13:00:02

well here's a lil problem i see:
- a tree on the minimap when you get there might already be chooped;
- there are many many icons for different trees, but i guess this could be used for our advantage
- what if there are two trees toguether?
- a player who has trees closeby won't usually walk all the way to the other side of the minimap to chop down a tree :p

click on the tree on the minimap, then re-analyze the minimap, comparing it to the middle of the minimap to know where on your screen the tree should be.

don't get me wrong, i like your idea, was just telling you possible things you need to watch out for.

~RM

FrÕzÑ_§ÕµL

2008-02-12 13:29:13

And mate, won't you be chopping in a place where there is trees in every single direction, meaning that your function either:
1. Does nothing new as it finds them everywhere,
2. Constantly only looks in the Top-Right corner of the screen if that is where it checks first

And also very good luck with the Minimap thing, I tried to do it with the Flag to determine screen shifting but it took way too long to examine even one segment, let me know if you get something ^^

Pure1993

2008-02-12 14:04:14

Haha, I think I didn't explain well enough of what I intend to do. Ýou guys didn't quite get the idea, it searches from the middle of the minimap, and then outwards (have something special for that), so it will go for the closest tree. If the tree is already chopped down, it will then search again, but skip the area in which the tree is already in. Also, if there are two trees clsoe to one another, it will find the on first which is closest, and record its position. (quite ingenious really :D *a little ego sometimes really helps :D*)
I'm getting another one of my migranes now, so I will continue tomorrow, but I'll be sure to inform you if I succeed. (already have this entire thing done in my head, only need to type it in eventually :D)

the scar noob

2008-02-12 14:51:26

From: Stur Pure
Haha, I think I didn't explain well enough of what I intend to do. Ýou guys didn't quite get the idea, it searches from the middle of the minimap, and then outwards (have something special for that), so it will go for the closest tree. If the tree is already chopped down, it will then search again, but skip the area in which the tree is already in. Also, if there are two trees clsoe to one another, it will find the on first which is closest, and record its position. (quite ingenious really :D *a little ego sometimes really helps :D*)
I'm getting another one of my migranes now, so I will continue tomorrow, but I'll be sure to inform you if I succeed. (already have this entire thing done in my head, only need to type it in eventually :D)


What'sthe special thing? FindBitmapSpiralToleranceIn or so?:p

It's a nice try, but it's just "too far searched", you could do it easier?
Just check for trees on the minimap, click it and find it on your mainscreen is more then enough:)

Haha, if you could make a reliable bitmap/dtm of a mm tree, so that you can use it to walk to trees,the you're a king:D

I hope you can make it, because it would be very difficult (for eg. trees are positioned in grass, so you can't use many tol etc, unless you use the brown part.. which cna for eg. also be dirt:p).

-Tsn.

Negaal

2008-02-12 16:03:12

Well…
I did something similar: *click*, *Flag*, *Get the nearest tree x & y*, if one of them changes more than 5 or so, then tree is gone…Also I did GetColor from middle of tree, and if that changed then *FindEnt*

Script worked pretty well…but now it's unused

Also make your functions to include only if script starts to lagg…no offence, but peoples don't like downloading new includes:p

FrÕzÑ_§ÕµL

2008-02-12 22:37:12

Uh ok then you enjoy your function… It doesn't sound any better than FindObj lol but hey I'm probably wrong and cbf reading any more today.
GL.

Pure1993

2008-02-13 05:05:50

Waaaaaaaaahaaaaaaaa, you guys are so discouraging! I might as well give up on scripting now! I never get anything positive! Waaaaaaaaaahaaaaaaaaa!
Lol, jk, I never give up before trying at least 3 times. :D
Okay, here is the deal: If I succeed, and it does exactly what I told you it would, every single one of you owes me a rep point, and as a comment I wanna hear exactly this: "U were right! U r da king! I'm da Noob!", and if that doesn't fit, just leave out the U were right. Also, I wanna be an SRL developer XD :D (realise there is no "jk" behinde that sentence? XD)

@The Scar Noob:
How'd you know I was gonna use the Color spiral thingy?!?! OMG, are you like some guy that can see in the future?!?! Lol, I'm just joking, it uses something similar, but I created it myself, so guessing won't do anything here. :p (oh, btw, about that dtm thing, I will get to it in a hour or so, after that I will solve all un-solveable randoms, then surpass Zezima, then become SRL admin, and after that king of the world, all of which should happen in the next 5 hours :p XD)

@Neegal:
Yeah, people are just lazy. It should be made #1 deadly and contagious disease… oh my god… Oh My God… OH MY GOD!… I have teh world #1 most contagious and deadly disease! OMG!! :D Well, I am gonna put it in my includes anyway, so I can use it for some scripts which I am not gonna publish, but for those I am, I will add the function so all those poor people with that terrible disease have it easier. ;)

@ FrÕzÑ_§ÕµL:
I have no clue how good it will be, but if it gets as good as I hope, then yep, you are wrong and it will surpass all known limits to tree finding. XD

@ All:
Well, I am only a 14 year old teenage boy (well, almost 15 but not yet) with a crazy imagination, not having too much of a clue of what I am doing, so Ya all might be right, or it might be so crazy that it actually works, and all you are wrong, only time will tell. :D ;)

Rikje

2008-02-13 05:17:17

From: the scar noob
I hope you can make it, because it would be very difficult (for eg. trees are positioned in grass, so you can't use many tol etc, unless you use the brown part.. which cna for eg. also be dirt:p).


And the rotating of the MM :p

edit: but its not impossible :p
iam a king! j/k

program New;
{.include SRL/SRL.scar}
var
x, y, bitmap: Integer;

begin
setupsrl;
ActivateClient;
Bitmap := BitmapFromString(2, 8, 'beNozEFFwETQIEoeQEAQXASJzCY' +
'5gAxEEAgDNGAiR');
if FindDeformed(x, y,bitmap, MMx1, MMY1, MMX2, MMY2) then
Mouse(x, y, 2, 2, True);
FreeBitmap(Bitmap);
end.

Pure1993

2008-02-13 05:21:29

ahhh gee, I really needed that comment. :(
lol

Rikje

2008-02-13 05:40:52

lawl :p

meh,, you're idee seems cool to me. Good Luck with it! ;)
and i hope you'll finish this project :)

Pure1993

2008-02-13 05:42:30

Now that's what I am talking about, thanks for the support :D ;)

Wizzup?

2008-02-13 05:52:07

From: Stur Pure
Haha, I think I didn't explain well enough of what I intend to do. Ýou guys didn't quite get the idea, it searches from the middle of the minimap, and then outwards (have something special for that), so it will go for the closest tree. If the tree is already chopped down, it will then search again, but skip the area in which the tree is already in. Also, if there are two trees clsoe to one another, it will find the on first which is closest, and record its position. (quite ingenious really :D *a little ego sometimes really helps :D*)
I'm getting another one of my migranes now, so I will continue tomorrow, but I'll be sure to inform you if I succeed. (already have this entire thing done in my head, only need to type it in eventually :D)


Can't you use TPointArrays (not taking certain points) in combination with FindColorsSpiralTolerance (center of mm)?
EDIT: Maybe I totally misunderstood your idea… Are you talking about 'saving' the position of a tree on the Minimap?

Pure1993

2008-02-13 06:10:41

Nono, you didn't misunderstand it, I don't want to save it on the minimap, but on the main screen, but the tree should be the same one which I chose on the minimap. There is just one tini tiny problemo with TPA's… I simply don't understand them (probably the only thing so far with which I had real problems) :o

EDIT: Well, I finished it (or at least the basic layout), but talk about a killer function (well, actually there are two), it has 400 lines of code! Well, most likely it will be 500 by the time I get done. it is not yet ready to be published, but I will probably be able to finish it today. :)