SRL Archive - Research & Development Lounge

OpenDoor


n3ss3s

2007-10-26 12:02:47

I was walking past some doors and I thought that maybe I should make a door opener, nobody likes opening doors, they're always a trouble, so, I made this function - its simple but works.

I recommend using OpenDoor(True) so it will rotate, because when door is closed, outer side of it is pretty much darker than the inner side, and when door is open its the opposite, so use the rotation.

You are free to use, just credit me properly.


Function OpenDoor(Rotate: Boolean): Boolean;
Var
TPA, TPA2: TPointArray;
C, X, Y, I: Integer;
TP: TPoint;
Begin
If(Not(LoggedIn))Then Exit;
For I := 0 To 3 Do
Begin
FindColorsSpiralTolerance(MSCX, MSCY, TPA, 2189191, 20, 20, MSX2 - 10, MSY2 - 10, 10);
For C := 0 To GetArrayLength(TPA) - 1 Do
Begin
TP := TPA[c];
FindColorsTolerance(TPA2, 2189191, TP.x - 25, TP.y - 25, TP.x + 25, TP.y + 25, 10);
If(GetArrayLength(TPA2) > 150)Then
Begin
MiddleTPAEx(TPA2, X, Y);
MMouse(X, Y, 5, 5);
If(Pos('lose', GetUpText) > 0)Then
Begin
Result := True;
Exit;
End Else
Begin
If(Pos('pen', GetUpText) > 0)Then
Begin
GetMousePos(X, Y);
Mouse(X, Y, 1, 1, True);
Result := True;
Exit;
End;
End;
End;
End;
If Not Rotate Then
Begin
Exit;
End Else
Begin
ActivateClient;
Wait(125 + Random(25));
SendArrowSilentWait(1, 1100 + Random(150));
End;
End;
End;

Wizzup?

2007-10-26 12:35:25

What kind of door is this for?

n3ss3s

2007-10-26 12:43:15

I made it with the Al-Kharid doors, so Im pretty sure its for the Misthalin doors (varrock, lumby, draynor) etc.

EDIT: Fally is not in misthalin..

vasu

2007-10-26 15:06:55

thanks, i was thinking to make own script so i need this :)

ShowerThoughts

2007-10-26 15:08:27

kk thanks it could work!

n3ss3s

2007-10-26 15:30:24

Thats good vasu..

Hermpie, seriously, some control to that spam,
it could work!
I wouldnt post it if it didnt work would I?

Smartzkid

2007-10-26 15:42:55

You got IM? I'd like to talk to you about this objectfinding stuff, if you've got the time.

Looks nice, I'll see what I can learn from it :)

mastaraymond

2007-10-26 15:45:35

May i ask you something?

Make 1 post.. Object Finding Procedures By N3ss3s… Kinda annoying making a separate post for every object finding procedure ^^. Oh and maybe, just a suggestion.. Stop making those functions and start making some real stuff, full working scripts maybe?

~Raymond

ShowerThoughts

2007-10-26 16:06:56

From: n3ss3s
Thats good vasu..

Hermpie, seriously, some control to that spam, I wouldnt post it if it didnt work would I?


im making a lumby spinner so i said it could work, i mean i will try and maybe it could work, see it like positive

n3ss3s

2007-11-03 09:04:22

Ray I have a miner which works, everything else works fully except for SRL walking.

Smartz, [email]tornaado_peluri@hotmail.com[/email]

@nawbz, dont add..

Masta everybody has their own 'direction' of scripting..

mastaraymond

2007-11-03 09:35:15

From: n3ss3s
Ray I have a miner which works, everything else works fully except for SRL walking.

Smartz, [EMAIL="tornaado_peluri@hotmail.com"]tornaado_peluri@hotmail.com[/EMAIL]

@nawbz, dont add..

Masta everybody has their own 'direction' of scripting..
I know. I mean that you can keep making those functions\procedures, not many people will use them (maybe none). But if you make a pwnage kicking script with uber 1337 object finding, many people will use it. You will become famous!

JuKKa

2007-11-03 10:53:28

Nesses make a object finder that detects if the door is open using TPA's

Heres a fast one i created


Program Test;
{.Include SRL/SRL.Scar}

Function DoorPixels(DoorColor, x1, y1, x2, y2: Integer): Integer;
Var
DoorTPA: TPointArray;
Begin
FindColorsTolerance(DoorTPA, DoorColor, x1, y1, x2, y2, 10);
Result := GetArrayLength(DoorTPA)-1;
End;

Function OpenDoor(DoorColor, x1, y1, x2, y2: Integer): Boolean;
Var
i, X, Y, DoorPixelAmount: Integer;
DoorTPA, DoorTPA2: TPointArray;
Begin
LowestAngle;
MakeCompass('n');
Wait(300+Random(300));
DoorPixelAmount := DoorPixels(DoorColor, x1, y1, x2, y2);
Writeln('Found: '+IntToStr(DoorPixelAmount)+' Door Pixels');
If(DoorPixelAmount > 200)Then
Writeln('Door is closed')
Else Writeln('Door is open');
HighestAngle;
End;

Begin
SetupSRL; //MSCX-100, MSCY-100, MSCX+100, MSCY+100
OpenDoor(4615805, MSCX-100, MSCY-100, MSCX+100, MSCY+100);
End.

Test in edge at the stove.

Wizzup?

2007-11-03 11:07:03

From: JuKKa
Nesses make a object finder that detects if the door is open using TPA's

Heres a fast one i created


Program Test;
{.Include SRL/SRL.Scar}

Function DoorPixels(DoorColor, x1, y1, x2, y2: Integer): Integer;
Var
DoorTPA: TPointArray;
Begin
FindColorsTolerance(DoorTPA, DoorColor, x1, y1, x2, y2, 10);
Result := GetArrayLength(DoorTPA)-1;
End;

Function OpenDoor(DoorColor, x1, y1, x2, y2: Integer): Boolean;
Var
i, X, Y, DoorPixelAmount: Integer;
DoorTPA, DoorTPA2: TPointArray;
Begin
LowestAngle;
MakeCompass('n');
Wait(300+Random(300));
DoorPixelAmount := DoorPixels(DoorColor, x1, y1, x2, y2);
Writeln('Found: '+IntToStr(DoorPixelAmount)+' Door Pixels');
If(DoorPixelAmount > 200)Then
Writeln('Door is closed')
Else Writeln('Door is open');
HighestAngle;
End;

Begin
SetupSRL; //MSCX-100, MSCY-100, MSCX+100, MSCY+100
OpenDoor(4615805, MSCX-100, MSCY-100, MSCX+100, MSCY+100);
End.

Test in edge at the stove.


Or you could get it's angle and compare it to the door's minimap angle. :)

n3ss3s

2007-11-03 11:10:35

Yeah… Btw Wizzy, Im having sometimes problems with MakeCompass, I do activateclient and all, but MakeCompass doesn't do anything :confused: YAY WORKS!
EDIT:
What kind of door is this for?
Misthalin, what about it?

EE: Masta, true, but for example CM4D (coal miner for desert) has good place for obj finding, the rocks. But then the walking is hard to get stable =( Im trying to think of some script that people would love, and also had objects to find. Like, a killer is nice, but they arent so popular as ess miners etc and only one object to find, and the NPC usually differs from the nature so a simple like FindColorTolerance is enough…

Yay 2,8k posts..

EEE: Also Wizzy if I may request, could the 75-year old woman bla bla be closed? Its just a place for pc++

Killerdou

2007-11-03 11:15:46

or if it has the same direction as any white points in the area…

n3ss3s

2007-11-03 11:18:21

Yeah, but just need to make sure the map is north.

EDIT: Charmz, Wizzy, Killerdou…. My door opener is somehow ub3rspecial, legends are viewing it wtf..

Killerdou

2007-11-03 11:30:27

how am i a legend plox

n3ss3s

2007-11-03 11:33:24

Well you have your name like everywhere in the WizzyPlugin

EDIT: Now I know…. Clarion v0.8 ;)

ShowerThoughts

2007-11-03 12:13:41

Boreas, is viewing :eek:

LordGregGreg

2007-12-27 21:52:27

forgive me for the semi grave dig, but i was helping out skilld u on msn, and i thought that it would be helpfull for people to know that this function still works great and can save you quite a bit of trouble opening dorrs.

tested and works.

R0b0t1

2007-12-28 19:54:38

Are the doors in mithalin different from Members/Other?

n3ss3s

2007-12-29 09:15:46

It depends of the area, what I've seen, Misthalin doors differ from Asgarnia etc, fally doors aren't as dark I think.

Thank you Greg :)