View Full Version : Opening Gates, and the like
Bad Boy JH
11-06-2010, 12:40 PM
I am creating a script which picks some wheat from the field above the cooking guild, goes into the guild, turns into flour, collects, banks and repeats.
The only issue I have, is to do with the gate to the wheat feild. I need help to detect if its open, and then open it.
On a side note: collecting the wheat was a pain in the arse...
Troll
11-06-2010, 12:43 PM
I'm not sure how but just a idea.
Get the colour and see if there is a straight line of 100 Then its closed if there is a line of 40 and two 30's it means its open.
Not sure if it would work or how to do it thought
ZephyrsFury
11-06-2010, 12:49 PM
You could also just walk to the gate, hover the gate with your mouse and check the uptext - 'Open' if the gate is closed and needs to be open or 'Close' if its already opened.
Camaro'
11-06-2010, 12:55 PM
Does the gate have that 'red' color on the MM?
If it does, then just try this, click a little inside the field, like 5 pixels above the red gate color on the minimap, just enough to make your character inside the field. If your character's MMCY > RedGate.Y then 'Gate is currently closed, lets open'. If you don't understand I'll try harder to explain :)
Heavenguard
11-06-2010, 04:05 PM
MM color counts aren't so reliable for something thats going to be used so often, I think Zephyr's method is good for you. Just use the uptext to check, no need to add an extra minimap count that could possibly mess up your script.
Minimap Methods: (Length)Red Color Count, (Length)White Wall Color Count, (Length)Combination of Red and White Colors in a TBox, DDTM, Player Positioning.
Easy Method: Get as close to the gate as usual, Check uptext, problem solved <3
Cstrike
11-06-2010, 04:39 PM
Reflection object handling
function OpenDoorID (ID : Integer) : Boolean;
var DoorObj : TRSObject;
begin
if not LoggedIn then Exit;
// if DoorObj = NULL_RSOBJECT then
// begin
// Result := True;
// Exit;
// end;
DoorObj := GetObjectByID (ID, OBJECT_TYPE_INTERACTABLE, 52);
// Assuming it's on the main screen here...
// Assuming you change the angle so it's wide against the screen and view is @ bottom
TP := TileToMS (DoorObj.Tile, 0);
Mouse (TP.x, TP.y, 3, 3, false);
Result := R_ChooseOptionMulti (['pen', 'gat', 'doo']);
end;
Then just get the door ID and it will always be opened.
Bad Boy JH
11-06-2010, 10:29 PM
Now, I often have my best ideas when I am about 25 seconds from sleep, so 99% of them are gone, how about.....
The gate closes in a reasonably quick time, basically it IS going to get shut when I am milling the flour etc. so when I get there, I assume gate is open, and then open it. when i open it, I START A TIMER, if the timer reaches a point (testing needed) the gate will be assumed to be shut, and I will open it, otherwise I assume gate is open.
2nd option: A mix of colour and reflection (same as I did for finding the grain). When near the gate, I do something like...Get the Ms Pos of the centre of the gate when shut (refelction), then do a count colour around that point, if above a certain amount its closed, if below its open... Obviously Ill be using an AutoColour for that...
Cstrike
11-06-2010, 10:59 PM
My advice is if you're going to throw any reflection in, just do it all based on reflection.
You can have a walking procedure where it keeps walking in, if (not CharacterMoving) then you know the door shut, and invoke the door opening procedure.
Bad Boy JH
11-07-2010, 07:16 AM
Im merely using reflection for screen position, not much more than that.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.