Results 1 to 9 of 9

Thread: Help

  1. #1
    Join Date
    Dec 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Cool Help

    I'm currently working on a script that requires interaction with a NPC.

    In order to reach the NPC, the bot must check if a door is open or not, also after talking to the NPC the bot must check the door again (to make sure its open) before attempting to leave the room.

    I've tried using FindObjCustom but im really not having any luck.
    So far I'm using this but its resulting in the mouse going crazy:

    Code:
      If FindObjCustom(X, Y, ['Open'], [8832711], 3) Then
         Mouse(X, Y, 1, 1, False);
         WaitOption('Open', 1000);
    Is there a function or easier way i can get it to check the door?
    I can't isolate the area the bot searches because the NPC walks around and that might result in the bot isolating the wrong area.


    Anyone run into this problem before / got a fix? lmk please

    I'm off to work atm ill be back in a few hours, will post how i solved this if I figure it out after

  2. #2
    Join Date
    Apr 2007
    Posts
    581
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    I'm not one hundred percent on this, but are the Mouse and WaitOption procedure's both supposed to be inside the IF command? If so, you need a begin and end to group it together. Not sure if that'll solve your problem or not.

  3. #3
    Join Date
    Dec 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    the idea i had was: (i think i failed to implement it)

    if (search for door and Open door appears) then {
    right click door
    click open
    } else {
    (search for door and Close door appears) then {
    do nothing
    }

    except the searching for door is failing really bad and I wanted to know if there's an easier way to check for the doors (and to see if there open) other then this?

  4. #4
    Join Date
    Dec 2011
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Make a bitmap of the door open and closed.
    if DoorOpen then
    blah blah

  5. #5
    Join Date
    Feb 2006
    Location
    Canada
    Posts
    2,254
    Mentioned
    21 Post(s)
    Quoted
    238 Post(s)

    Default

    You're on the right track for sure.

    Simba Code:
    If FindObjCustom(X, Y, ['pen'], [8832711], 3)
    Then
    begin
       Mouse(X, Y, 1, 1, False);
    end
    else
    WriteLn('door is open');

    If you're going to use it as a function make sure you have it set Result := True in the begin end and Result := False in the else. But that should work for you, this is assuming you've already made sure you are where your supposed to be (aka it could not find the door but be in a totally different area and still debug you that the door is open :P )

  6. #6
    Join Date
    Dec 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Grihmm View Post
    Make a bitmap of the door open and closed.
    if DoorOpen then
    blah blah
    No idea how to do this, ill look into it when i get home.


    Quote Originally Posted by cause View Post
    You're on the right track for sure.

    Simba Code:
    If FindObjCustom(X, Y, ['pen'], [8832711], 3)
    Then
    begin
       Mouse(X, Y, 1, 1, False);
    end
    else
    WriteLn('door is open');

    If you're going to use it as a function make sure you have it set Result := True in the begin end and Result := False in the else. But that should work for you, this is assuming you've already made sure you are where your supposed to be (aka it could not find the door but be in a totally different area and still debug you that the door is open :P )
    Is it normal for the mouse to go over half the brown things in the room before locating the door? (the room has a brown outline on the wall which matches the colour of the door lol)

    Another thing I've noticed across several scripts is that you guys never use the first letter when searching for text (as you done in example), why is this?

    Ill get back into working on this when i get home in 3 hours and post results if i make a break through

  7. #7
    Join Date
    Oct 2011
    Posts
    805
    Mentioned
    21 Post(s)
    Quoted
    152 Post(s)

    Default

    Is it normal for the mouse to go over half the brown things in the room before locating the door? (the room has a brown outline on the wall which matches the colour of the door lol)
    Yes ,it's normal. That's how this function work ,first it finds pixel of color you want ,second it move mouse to this point to read text in upper left corner. So it will hover all points until it find correct text.

    To avoid this you can try to find color ,which specific only for doors ,decrease tolerance or make dtm.

  8. #8
    Join Date
    Dec 2011
    Posts
    484
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    http://villavu.com/forum/showthread.php?t=58935

    Look at this guide. Specifically, look at the if...then statements.

  9. #9
    Join Date
    Dec 2011
    Posts
    12
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks for your help everyone!

    I figured out a temporary fix for the problem (to avoid the door all together) but sadly I'm not going through with this script because its a failed idea.. I left it running for a hour and realised it wasn't as profitable as I thought and there are plenty other ways which would be easier to make rsgp =[

Thread Information

Users Browsing this Thread

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

Posting Permissions

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