SRL Archive - Help and Support

Exclude option> possible?


goider

2007-11-05 18:49:15

i was wondering if it was possible to exclude somthing from being used if i didn't want it used.

so that makes no sense, allright, IE

i have a powerchopper i made,
it's fully functioning, but i only want to chop one type of tree, 'tree' and i want it to ignore a tree from then on if it finds a yew, or even just not try to chop it, then walk 'random direction' for random time to a different area.

so currently my script looks like this.

program TrunkSmasher;

{.include SRL/SRL.scar}

/////////////////////////////////SETUP\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\

const
LoadsPerPlayer=100; //How Many Loads You Want Chopped Per Player Before Switching.
TreeColor=3506803; //Color Of Tree Leaves.
AxeEquipped=true; //Is Your Axe Equipped?
WaitPerTree=8500; //How Long To Spend Smashing A Tree.

//////////////////////////////DON'T TOUCH\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
procedure SmashTrunk;
var
x, y, MyMark : integer;
begin
if not LoggedIn then Exit;
repeat
if FindObj(x, y, 'hop', TreeColor, 25) then
begin
Mouse(x, y, 1, 1, False);
if ChooseOption('ew') then
//line(s) that makes it ignore yEW and move on
if ChooseOption('ak')
//line(s) that makes it ignore oAK and move on
//line(s) that make it walk random direction for random time.
if ChooseOption('hop') then
begin
Wait(WaitPerTree);
Exit;
end;
end;
if TimeFromMark(MyMark) >(4 * 30 * 1000) then
begin
Logout;
Exit;
end;
until false
end;

procedure DeclarePlayers;
begin
NumberOfPlayers(1);

Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;

// Players[1].Name := '';
// Players[1].Pass := '';
// Players[1].Nick := '';
// Players[1].Active := True;

// Players[2].Name := '';
// Players[2].Pass := '';
// Players[2].Nick := '';
// Players[2].Active := True;

// Players[3].Name := '';
// Players[3].Pass := '';
// Players[3].Nick := '';
// Players[3].Active := True;

// Players[4].Name := '';
// Players[4].Pass := '';
// Players[4].Nick := '';
// Players[4].Active := True;

// Players[5].Name := '';
// Players[5].Pass := '';
// Players[5].Nick := '';
// Players[5].Active := True;

CurrentPlayer := 0;
end;

begin
SetupSRL;
DeclarePlayers;
if LoggedIn then Logout;
LoginPlayer;
repeat
SmashTrunk;
if InvFull then
begin
DropToPosition(2, 28);
if AxeEquipped then DropAll;
Inc(Players[CurrentPlayer].Banked);
if Players[CurrentPlayer].Banked mod LoadsPerPlayer = 10 then
begin
NextPlayer(True);
end;
end;
if not LoggedIn then NextPlayer(False);
until false


end.

if it doesnt make sense still (the problem is highlighted with comment text) then write and i will try to explain it differently:duh: :(

HyperSecret

2007-11-05 19:02:04

use a IsUpText(String);

Example:


if (IsUpText('ree)) then ChopTree;

or

IsUpTextMulti(3 words)


If (FindObj(x, y, 'Tree', TreeColors, 15)) then
begin
MMouse(x, y, 0, 0);
if(IsUpText('Chop down'))then
begin
Mouse(x, y, 2, 2, true);
end;

goider

2007-11-05 19:08:05

okay, i can get it to cut fine, i just need it to EXCLUDE yews and oak, can you help with that?

Smartzkid

2007-11-05 19:11:12

If(IsUpText('Yew') or IsUpText('Oak'))then
WanderAway;

HyperSecret

2007-11-05 19:13:56

lol what i said does EXCLUDE them…lol, it only cuts 'tree's if it finds the word tree in the corner it will cut but if it finds anything other than tree, such as oak or yew it doesnt cut :D :duh:

t3hl33tn00b

2007-11-05 19:24:20

if i understand your question correctly, just make it

procedure SmashTrunk;
var
x, y, MyMark : integer;
begin
if not LoggedIn then Exit;
repeat
if FindObj(x, y, 'hop', TreeColor, 25) then
begin
Mouse(x, y, 1, 1, False);
if ChooseOption('ew') then
//line(s) that makes it ignore yEW and move on
if ChooseOption('ak')
//line(s) that makes it ignore oAK and move on
//line(s) that make it walk random direction for random time.
if ChooseOption('hop') then
begin
Wait(WaitPerTree);
Exit;
end;
end;
if TimeFromMark(MyMark) >(4 * 30 * 1000) then
begin
Logout;
Exit;
end;
until false // lol wut is this? a never ending procedure?
end;


procedure SmashTrunk;
var
x, y, c, : integer;
begin
if not LoggedIn then Exit;
c :=0;
repeat
if FindObj(x, y, 'ree', TreeColor, 25) then
begin
Mouse(x, y, 1, 1, False);
ChooseOption('hop');
c := c + 1;
Wait(WaitPerTree);
until(c = 1);
end;
end;

i THINK that should work, i havn't really scripted in scar in a while and i did that off memory but it should work (maybe the until(c = 1) should be until(c:=1), meh i hope this helps :D but what i did was make it cut 1 tree then end, i could make it so it cuts until inventory is full but i'll let you do that since its your script. test this and let me know if it works lol :D

and it should exclude the other trees

goider

2007-11-05 19:29:53

tahnks for the help guys, testing now, will get back, adding anti randoms later

t3hl33tn00b

2007-11-05 19:33:43

tell me if mine works :D

goider

2007-11-05 19:39:59

From: t3hl33tn00b
tell me if mine works :D


okay, ill test right now, i made it so if it detects it it just clicks 98, 73 on the screen heads NW:duh:

t3hl33tn00b

2007-11-05 20:13:44

Your not cutting the trees but using them to navigate or what….? you could make it so its like

if (c = 1) then
begin
mouse(x, y, 98, 73, true);
end;

that way it will cut 1 tree then walk…

the scar noob

2007-11-06 12:09:37

The "typ" of tree isn't in yhellow IsUpText, so you'll have to make another one checking the blue uptext..
{
function IsUpTextBlue(UpText: string): boolean;
Same as uptext but then Blue letters.
}
function IsUpTextBlue(UpText: string): boolean;
var
tempx, tempy: Integer;
begin
if (IsTextInAreaEx(7, 7, 334, 20, tempx, tempy, UpText, 100, upchars, True,
True, 0, 2, 13752600)) then
Result := True;
end;


Something like this:p

-Tsn.

Wizzup?

2007-11-06 12:16:28

function FindObjTree(var x, y: integer; color, tol, cts, ObjWidth, ObjHeight, minCount :Integer; UpText: string): Boolean;
var
I, tcts: Integer;
myPoint: TPoint;
Points: TPointArray;
aPoints: array of TPointArray;
begin
tcts := GetColorToleranceSpeed;
if not (cts >= 0) and (cts <= 2) then
cts := 1; // Standard.
ColorToleranceSpeed(cts);
FindColorsSpiralTolerance(x, y, Points, Color, MSX1, MSY1, MSX2, MSY2, Tol);
aPoints := TPAtoATPAEx(Points, ObjWidth, ObjHeight);
SetLength(Points, 0);
for I := 0 to Length(aPoints) - 1 do
begin
if Length(aPoints[I]) < minCount then
Continue;
myPoint := MiddleTPA(aPoints[I]);
MMouse(myPoint.X, myPoint.Y, 0, 0);
Wait(100 + Random(50));
ColorToleranceSpeed(tcts);
If IsUpText('Yew') Then
Continue;
If IsUpText('Oak') Then
Continue;
if IsUpText(UpText) then
begin
x := myPoint.X;
y := myPoint.Y;
Result := True;
ColorToleranceSpeed(tcts);
Exit;
end;
ColorToleranceSpeed(cts);
end;
ColorToleranceSpeed(tcts);
end;

n3ss3s

2007-11-06 13:09:32

Rofl, Wizzup I am slowly, slowly starting to lose the believe in that your posts like that have no intention of advertising or 'show off' :p

I can see that your point was to use continue, you could've just say that xD

[offtopic] about your function, make a TStringArray param for the ones to be 'continued', and then a for loop, and a boolean, so you'd do like:


For I := 0 To High(SkipOptions) Do
Begin
If IsUpText(SkipOptions[i]) Then
Begin
BCMD := True; // 'Break Command' = True
Break;
End;
End;
If BCMD Then Continue;
:)

Wizzup?

2007-11-06 14:18:57

From: n3ss3s
Rofl, Wizzup I am slowly, slowly starting to lose the believe in that your posts like that have no intention of advertising or 'show off' :p

I can see that your point was to use continue, you could've just say that xD

[offtopic] about your function, make a TStringArray param for the ones to be 'continued', and then a for loop, and a boolean, so you'd do like:


For I := 0 To High(SkipOptions) Do
Begin
If IsUpText(SkipOptions[i]) Then
Begin
BCMD := True; // 'Break Command' = True
Break;
End;
End;
If BCMD Then Continue;
:)


If you take a good look, it is FindObjTPA, with a small mod.
I directly copy pasted it, added the 2 if isuptext then continue's..

EDIT: Hence why I didn't use an Array of String.. :)

Santa_Clause

2007-11-06 16:29:06

I think n3ss3s meant you were showing off…?

Most of these ways would work by the way…

t3hl33tn00b

2007-11-06 16:52:06

wizzup? you never cease to amaze me :D will you have my babies? (joking!!!!) ;)