SRL Archive - OSR Help

Multiple Questions


TheJokester117

2011-12-22 22:52:57

Alright, so I followed YoHoJo's tutorial for scripting, and decided to make my own. Problem is, I'm running into a few problems. What I basically did was modify the code he taught in the tutorials to cut Yew trees in Edgeville.(Credit to him.) After I get these problems solved, I'm going to add walking and banking to the script too.

Anyways, here's a few questions to start:

1. The 2 Yew trees in Edgy have 2 sides. Of the Northern tree, the color is 5003874. Of the Southern tree, the color is 3357762. I'm using the following line of code:

if FindObjTPA(X,Y, 5003874, 10, 1, 15, 60, 600, ['Cho']) then

That code works great for finding and chopping the northern tree. But, my problem is once the tree is cut down, I need to cut the other tree. The code for that would be:

if FindObjTPA(X,Y, 3357762, 10, 1, 15, 60, 600, ['Cho']) then

I'm having trouble making an statement along the lines of

if tree 1 (the northern tree) is not found (chopped down) then
rotate camera angle and find tree 2 (the southern tree).

I don't know if I'm just a noob, but I can't for the life of me write a working code for this. I basically need it to check for the other tree once one is chopped down.

For now, this really is the only problem I've run into with the chopping part. It cuts the north tree fine, and the WriteLn debugs I've set up for it works great. I just can't get it to check for the southern tree. Any help is greatly appreciated, because once I solve this I can move onto the walking and banking parts.

PatDuffy

2011-12-22 22:56:20

You could create 2 boolean functions, 1 for each tree. Then to combine them in the way you wanted try something along the lines of

 if not FindTreeOne then
begin
MakeCompass('s');
if not FindTreeTwo then
begin
Writeln('Both trees could not be found');
Exit;
end else
Writeln('Chopping bottom tree');
end else
Writeln('Chopping top tree');

TheJokester117

2011-12-23 01:10:18

Thanks, this is exactly what I was looking for. But, if the first tree was not found, how would I implement this? Would I stick it within the first function, or between the two?

TheJokester117

2011-12-24 23:01:30

Alright, so I decided to scrap the old code and start the Chop function From scatch. I just couldn't wrap my head around the whole code I didn't really learn too well.

I do have a new questions though. What function would anyone personally use to find trees a stuff? Like would a DTM/Bitmap be the way to go, FindObjCustom or like FindColorSpirals etc? Basically, what would be the most efficient function to use for finding a Yew tree?

Kyle Undefined

2011-12-24 23:16:41

TPAs are the way to go bro. Can't link to any tuts since I'm on my phone.

TheJokester117

2011-12-25 00:21:23

From: Kyle Undefined
TPAs are the way to go bro. Can't link to any tuts since I'm on my phone.


Well, if you get the chance (or anyone who happens to read this), would you mind linking me/shortly explaining a tutorial on how to use them? Because With the one I was using, it kept clicking to chop the Yew tree each time the InvCount = PlusOne, and I didn't set it to do that.

In the meantime, I'll get to searching.

cause

2011-12-25 18:13:17

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

TheJokester117

2011-12-25 22:20:07

From: cause
http://villavu.com/forum/showthread.php?t=49067


Ahh, didn't even think to look in the Advanced section (for obvious reasons). Appreciate it.

cause

2011-12-26 18:10:36

np I was just looking through it myself.

TheJokester117

2011-12-27 00:58:16

Ok, so I have run into a problem. I can find and click the Yew tree fine, but it keeps clicking it every few seconds. How can I make it so that once it clicks the Yew tree, it only clicks it once and waits (while using AntiBan) to cut the whole tree down?

procedure CutNorthTree;

var
X, Y: Integer;

begin
MakeCompass('N');
FindNormalRandoms;
AntiBan;

X := MSCX
Y := MSCY

if FindObjTPA(X, Y, 5003875, 10, 1, 15, 60, 600, ['Cho']) then

begin
StatsGuise('Yew Tree Found.');
case Random(2) of
0: Mouse(X, Y, 3, 3, True);
1: begin
Mouse(X, Y, 3, 3, False);
WaitOption('Chop', 500 + Random(500));
end;

end;

end;

end;

E: Of course this is only the cut tree part of the code. Let me know if you need anything else.

Kyle Undefined

2011-12-27 02:28:20

Heh, you're clicking looks a lot like mine when I made my first tree chopper.

Anyway, I would look at the players pixel shift, and while it's greater than resting, do antiban.

TheJokester117

2011-12-27 11:41:23

From: Kyle Undefined
Heh, you're clicking looks a lot like mine when I made my first tree chopper.

Anyway, I would look at the players pixel shift, and while it's greater than resting, do antiban.


Yeah, between tutorials I've seen and read, this seems to be a good way to find the tree and click.

And I will check out the players pixel shift. That should do the trick.