Results 1 to 17 of 17

Thread: Parameters for GetSecondDoorColor?

  1. #1
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Parameters for GetSecondDoorColor?

    I have looked around but have been able to figure out what to put as parameters for
    SCAR Code:
    GetSecondDoorColor(First: Integer): Integer;

  2. #2
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I think First is the color you got from Getfirstdoorcolor.

    dont quote me on it though

  3. #3
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    So, Im not sure since I havent used SRL Door things much, but anyways, I think you can use "GetSecondDoorColor(GetFirstDoorColor);"

  4. #4
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OK I will try it out thanks
    EDIT:
    SCAR Code:
    GetSecondDoorColor(GetDoorColor);
    works but I am still getting
    SCAR Code:
    Line 295: [Hint] (12530:1): Variable 'PLIST' never used in script
    Line 321: [Hint] (12556:1): Variable 'TMPAOTPA' never used in script
    Does anyone know what those vars are for?

  5. #5
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Those hints are from when I changed somethings around so the variables aren't needed anymore. You can delete them from the var section on the given lines if you want.

    GetSecondDoorColor is not designed to be used on its own, but I guess you can use it if you want.

    Sometimes, when there are doors that go pretty much vertical and horizontal, and their are doors that go diagonal, there a 2 door colors (go to draynor to see what I mean). One for diagonal and one for the rest. (The same happens for wall color btw). When both colors are present, GetDoorColor will find the first one closest to top left. GetSecondDoorColor will skip over the color in parameters, so that you have both door colors. The higher level functions (which are lower down in DoorProfiles.scar ) look at the output of both functions, and decide whether to use one or both, and then get every pixel of door color on the minimap.

    If you read through DoorProfiles.scar you can figure out how to use stuff, but then you just be rewriting the higher level functions that are already in there.

    So tell me what door you are trying to find, and I'll show you how to use GetDoors (the high level function designed for your use) for your situation.

  6. #6
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, well I am making a flax spinner script and I want to find and open/leave open the door getting to the Spinner, I was going to try to make a function for it, using the getdoorcolor stuff.
    EDIT: In the lumby castle.

  7. #7
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    K should be easy, aren't many doors on second floor IIRC. BRB.

    EDIT Try this
    SCAR Code:
    program New;
    {.include srl/srl.scar}

    procedure GoToSpinningWheelDoor;
    var
    MyDoors: array of DoorProfile;
    MyTPA: array of tpoint;
    i:integer;
    begin
      MyDoors:= GetDoors;
      setarraylength(MyTPA,getarraylength(MyDoors));
      for i:=0 to getarraylength(MyDoors)-1 do
        MyTPA[i]:=MyDoors[i].midpoint;
      MyTPA:= RearrangeTPA(MyTPA,0,1,false,false);
      Mouse(MyTPA[1].x,MyTPA[1].y,1,1,true);
      Flag;
    end;
    begin
    setupsrl;
    GOtoSpinningWheelDoor;
    end.

  8. #8
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok. Thanks a lot Boreas. I am going to go pick up a school schedule soon, and then work, so I might not post reply for a while.

  9. #9
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Could you try it in the next 5 mins? I gtg soon and my computer is bugging so Idk if it works.

  10. #10
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Works perfectly thanks boreas.

  11. #11
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    Cool. In that case here's how it works (so you can make your own for other configurations:

    BTW, if either the door in question or the one below it is covered up by symbols or people, it will go to the duke, so you might wanna do a failsafe where if it cant see the spinner or something, it will find the door again.

    Always when using GetDoors, you need to declare an array of DoorProfile. Usually you also need a TPA too.
    SCAR Code:
    var
    MyDoors: array of DoorProfile;
    MyTPA: array of tpoint;
    Then you need call GetDoors, setting it to the array, and then set the TPA to the same length.
    SCAR Code:
    MyDoors:= GetDoors;
      setarraylength(MyTPA,getarraylength(MyDoors));
    Each of the DoorProfiles in the array has a tpoint part, called midpoint, because it is the point in the middle of the door, and is a good way to represent each door. Then you need to extract these tpoints into an array of tpoints, cuz we don't need the other information in each DoorProfile (in most cases, look at the top of DoorProfile.scar for the other info).
    SCAR Code:
    for i:=0 to getarraylength(MyDoors)-1 do
        MyTPA[i]:=MyDoors[i].midpoint;
    So now we are working with an array of tpoints, where 1 tpoint is for each door.
    SCAR Code:
    MyTPA:= RearrangeTPA(MyTPA,0,1,false,false);
    That rearranges the TPA (duh ). The first boolean is the direction, false meaning north to south. The second is for going up, false meaning going down. So false,false will make the TPA start with the point that has the highest Y, and go down to the lowest Y. The 0,1 is what part of the array you want to return, this is so that you can take some of the points into a smaller array, and then sort them again in other direction. In this case, 0,1 means the first 2, which means the lowest 2 doors, with 0 being the lowest, and 1 being the second lowest.
    SCAR Code:
    Mouse(MyTPA[1].x,MyTPA[1].y,1,1,true);
      Flag;
    So that will click the second lowest door. Flag waits til it isn't moving.

    You can copy that whole procedure for most situations, just change the 0,1,false,false and the [1] [1].

  12. #12
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    wow, thanks for explaining Boreas.. will be using something similar in my script!

  13. #13
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ya you should make a tut, this helped me a lot.

  14. #14
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bourdou View Post
    Ya you should make a tut, this helped me a lot.
    i think he did make a tut, a long time ago, but ya, you should update it Boreas!

  15. #15
    Join Date
    Jun 2007
    Location
    Minnesota
    Posts
    773
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Or Stickify it

  16. #16
    Join Date
    Aug 2007
    Posts
    282
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bourdou View Post
    Or Stickify it
    or both

    haha

  17. #17
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    There's the tut in tutorial section, this question, a couple other questions, and bit on the fix thread. When I get time I'll put it all together on the tut thread.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Why do i keep getting invalid parameters for?
    By Scaper in forum OSR Help
    Replies: 1
    Last Post: 07-15-2008, 10:56 PM
  2. Replies: 3
    Last Post: 04-04-2008, 10:06 PM
  3. Invalid parameters
    By Runaway in forum OSR Help
    Replies: 1
    Last Post: 01-19-2008, 03:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •