SRL Archive - Help and Support

Would this be Applicable?


FreakyMonkey

2008-12-22 01:20:28

Ya, I just got back into scripting so I'm trying to relearn. Could you guys tell me if this has the potential of working well? I was never very good at TPAs….

Procedure GoToStaircase;

Var StairPoints: TPointArray;
Var i,t2, Stairs: Integer;
Var s: String;

begin
MakeCompass('N');
SetAngle(True);
Stairs := DTMFromString('78DA63E463606050674001895A4C609A11CA6' +
'71404122AA86ADEBD7BC7F00B590D3790D04455F3FEE537B83920' +
'0C00437407C5');
if DTMRotated(Stairs,x,y,MMX1,MMX2,MMY2,MMX2) then
if rs_onminimap(x,y)then
begin
Mouse(x,y,0,0,true);
Wait(RandomRange(300,600));
FFlag(0);
end;
FindColorsSpiralTolerance(x, y, StairPoints, 4280671, MSX1, MSY1, MSX2, MSY2, 5);
t2:= GetArrayLength(StairPoints);
SetArrayLength(StairPoints, t2);
for i:=0 to t2-1 do
begin
MMouse(StairPoints[i].x, StairPoints[i].y, 0, 0);
Wait(RandomRange(300,600));
s:= rs_getuptext;
if not Pos('air',s)<>0 then
Break;
end;
if i = t2-1 then
begin
Writeln('Could not find Stairs.')
Terminatescript;
end;
x:= StairPoints[i].x;
y:= StairPoints[i].y;
Mouse(x,y,0,0,true);
FreeDTM(Stairs);
end;

just made it rigth nwo. If it has some mistakes I'm sorry, but I'm kinda lookin at the overall picture :f:

benjaa

2008-12-23 09:41:40

RadialWalk(FindLadderColor, StartRadial, EndRadial, Radius, 0, 0)

the scar noob

2008-12-23 10:22:28

From: benjaa
RadialWalk(FindLadderColor, StartRadial, EndRadial, Radius, 0, 0)


That isn't that reliable..


-Tsn.

NiCbaZ

2008-12-23 15:08:13

From: the scar noob
That isn't that reliable..


-Tsn.


Acturally it is very reliable if you it corectly, hav you seen the code fir it :o,

freakymonkey, that is very nice code.

TViYH

2008-12-23 18:22:17

What's the point in this:

if DTMRotated(Stairs,x,y,MMX1,MMX2,MMY2,MMX2) then
if rs_onminimap(x,y)then

Why are you checking to see if it was on the minimap if you found it on the minimap?

FreakyMonkey

2008-12-23 23:38:20

From: TViYH
What's the point in this:

if DTMRotated(Stairs,x,y,MMX1,MMX2,MMY2,MMX2) then
if rs_onminimap(x,y)then

Why are you checking to see if it was on the minimap if you found it on the minimap?


Well my thinking is that since the minimap is round and the coordinates for it covers a box shape there is a chance that the DTM might encompass some of the outside border. Is that kinda flawed reasoning? Idk, that's kinda what I was thinking:(


@the scar noob– what areas should I work on for this though. It doesn't seem to be working well after it finds the DTM.

@NicBaz (ty btw for compliment)and TViyh— do you guys have some suggestions that would enhance the code?

Lee Lok Hin

2008-12-23 23:51:15


t2:= GetArrayLength(StairPoints);
SetArrayLength(StairPoints, t2);

Eh?

  if DTMRotated(Stairs,x,y,MMX1,MMX2,MMY2,MMX2) then
if rs_onminimap(x,y)then
begin
Mouse(x,y,0,0,true);
Wait(RandomRange(300,600));
FFlag(0);
end;

What if not found?

But apart from that, it seems alright to me. Could be more efficient though.


And how is it not reliable?

FreakyMonkey

2008-12-24 00:20:18

Ya, I probably should add it, but now for some reason my static DTM of the staircase isn't working :( and the TPA isn't working.

Would someone like to add me on Windows Live Messenger and help me test and figure this out?

Naum

2008-12-24 05:36:03

@TViYH - Thats what I thought, but then I had a look and found out that rs_OnMinimap used InCricle with a radius of 76, but as the co-ords of the MMX/Y are in corners of a square it actually has a reason to be there.
Its similar than doing
If Not (X = 0) and (Y = 0) Then

So I think there is nothing wrong with it, infact it looks pretty good :).

Suggestion, Just do a GetMousePos instead of doing
x := stairpoint.x

e.t.c

Sir R. M8gic1an

2008-12-25 07:11:46

don't stairs change color? if so u'll need a DDTM d some way of autocoloring.

you might also need to split and sort the TPA if there are more than one set of stairs in the minimap. Have a look at WizzyPluggin.scar in your includes folder, it has a lot of things there, many to do with TPAs.

~RM

FreakyMonkey

2008-12-25 12:05:30

I checked the main stair color after logging out and back in again and it didn't change at all actually at least for the lumbridge staircase. But DDTMs are a good idea.

Bobarkinator

2008-12-25 13:32:44

From: FreakyMonkey
I checked the main stair color after logging out and back in again and it didn't change at all actually at least for the lumbridge staircase. But DDTMs are a good idea.


You have to log out and change worlds or reload the world.

FreakyMonkey

2008-12-25 14:33:11

Oh. Man, I'm really bad at autocoloring and DDTMs though. Better start reading up lol.

Nava2

2008-12-25 21:12:54

I think you missed a nest after the first if statement.