Results 1 to 13 of 13

Thread: Find objgame seems to always returns false

  1. #1
    Join Date
    Feb 2017
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default Find objgame seems to always returns false

    For some reason it always returns false

    Currently I'm trying to find fishing spot (to be more specific, draynor's net fishing spot), but it returns false even while standing right next of it.

    My code below produces these comments (imo it's odd that standing still doing nothing returns True value from IsAnimating)

    "start
    True
    not animated
    False
    on spot
    already busy"

    Simba Code:
    program Netfishing;

    {$DEFINE SMART8}
    {$i reflection/Reflection.simba}


    procedure FindFish();
    Begin
    End;
    var

    Fspot: TReflectObject;

    MyPlayer: TReflectLocalPlayer;




    begin
    MyPlayer.Username := '';
    MyPlayer.Password := '';
    MyPlayer.Active := True;
           WriteLn('start');
        WriteLn(MyPlayer.IsAnimating);
        if MyPlayer.IsAnimating = True then
        begin
      WriteLn('not animated');
      WriteLn(Fspot.Find(objGame, 'Net Fishing spot', 10));
      WriteLn('on spot')
            if Fspot.Find(objGame, 'Net Fishing spot', 10) = true then
                begin
                    Reflect.Mouse.Move(Fspot.GetMSPoint, 10, 10);
                    Reflect.Mouse.Click(Mouse_Left);
            WriteLn('start fishing');
        wait(50);
        WriteLn('after start fishing command');
      WriteLn(MyPlayer.IsAnimating);
                end else
          begin
        wait(50);
            WriteLn('already busy');
          end;
      end;
    end;

    I also tried code from

    https://villavu.com/forum/showthread...45#post1370245 with minor modification. It always just writes how it attempts to find, but never clicks or write "found bank" while standing in draynor's bank. This code was used in attempt to try "working code", but maybe it's a problem with the reflection include itself?


    Simba Code:
    program new;
    {$DEFINE SMART8}
    {$i reflection/Reflection.simba}

    procedure OpenBank();
    var
      Bank: TReflectObject;
    begin
        writeLn('trying to find bank');
        if bank.Find(objGame, 'Bank booth', 10) then
        begin
          Reflect.Mouse.Move(bank.GetMSPoint, 10, 10);
          writeLn('found bank');
        end;
    end;
    begin
    OpenBank();
    end.

  2. #2
    Join Date
    Apr 2016
    Location
    New Zealand
    Posts
    76
    Mentioned
    0 Post(s)
    Quoted
    32 Post(s)

    Default

    You haven't initiated reflection. Have a look at some reflection scripts setup procedures.

  3. #3
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    You need to setup the reflection include

  4. #4
    Join Date
    Jan 2012
    Location
    Sydney, Australia
    Posts
    877
    Mentioned
    12 Post(s)
    Quoted
    368 Post(s)

    Default

    Formatted the script and edited it a little for you. See if this works:

    Simba Code:
    program Netfishing;
    {$DEFINE SMART8}
    {$i reflection/Reflection.simba}

    var
      Fspot: TReflectObject;
      MyPlayer: TReflectLocalPlayer;

    begin
      Reflect.Setup;
      MyPlayer.Username := '';
      MyPlayer.Password := '';
      MyPlayer.Active := True;
      WriteLn('start');
      WriteLn(MyPlayer.IsAnimating);
      if MyPlayer.IsAnimating then
      begin
        WriteLn('We are animating.');
        WriteLn(Fspot.Find(objGame, 'Net Fishing spot', 10));
        WriteLn('on spot');
        if Fspot.Find(objGame, 'Net Fishing spot', 10) then
        begin
          Reflect.Mouse.Move(Fspot.GetMSPoint, 10, 10);
          Reflect.Mouse.Click(Mouse_Left);
          WriteLn('start fishing');
          wait(50);
          WriteLn('after start fishing command');
          WriteLn(MyPlayer.IsAnimating);
        end else
        begin
          wait(50);
          WriteLn('already busy');
        end;
      end;
    end;

  5. #5
    Join Date
    Feb 2017
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    Thanks guys for mentioning that script and Dan The Man for simpler "if" syntax and clean up.

    Ended up breaking script into procedures before running with suggested fix, but after that couple changes and reasoning. After I included "Reflect.Setup;", it insisted to have "{$DEFINE SMART}" instead of SMART8 being defined. Also ended up including "MyPlayer.Create;" to avoid "[Reflection] [Error] Avoided using null'd pointer at: TReflectActor.GetAnimation" error. After that IsAnimating correctly states true/false instead of appearently always true.

    Just can't wrap my head around why it still returns false on fishing spot (and net fishing spot) and due to that original problem continues :S

    Debug line process and my train of thoughts. It gets past reflect settings (tried MyPlayer.Login with incorrect name/pass and it crashed), identifies correctly that player isn't animating, states it with msg and returns false on both spot searches
    "start script
    [02:01:08:091] [Reflection] [Status] Paired with SMART client 204.
    [02:01:08:098] [Reflection] [Status] Successfully setup!
    start
    False
    not animated
    False
    False
    nothing to fish"

    Simba Code:
    program Netfishing;
    {$DEFINE SMART}
    {$i Reflection/Reflection.simba}

    var
    MyPlayer: TReflectLocalPlayer;
    Fspot: TReflectObject;

    procedure MyOwnReflectsettings;
    Begin
    Reflect.Setup;
    MyPlayer.Create;
    MyPlayer.Username := '';
    MyPlayer.Password := '';
    MyPlayer.Active := True;
    End;

    procedure FindAndFish;
    Begin
        if not MyPlayer.IsAnimating then
        begin
      WriteLn('not animated');
      WriteLn(Fspot.Find(objGame, 'Fishing spot', 10));
      WriteLn(Fspot.Find(objGame, 'Net Fishing spot', 10));
            if Fspot.Find(objGame, 'Fishing spot', 10) then
                begin
                    Reflect.Mouse.Move(Fspot.GetMSPoint, 10, 10);
                    Reflect.Mouse.Click(Mouse_Left);
            WriteLn('start fishing');
        wait(50);
        WriteLn('after start fishing command', MyPlayer.IsAnimating);
                end else
          begin
        wait(50);
            WriteLn('nothing to fish');
          end;
      End;
    End;


    begin
    WriteLn('start script');
    MyOwnReflectsettings;
           WriteLn('start');
        WriteLn(MyPlayer.IsAnimating);
    FindAndFish;
    end;

  6. #6
    Join Date
    Jun 2007
    Posts
    106
    Mentioned
    1 Post(s)
    Quoted
    33 Post(s)

    Default

    I don't remember for certain but I think fish spots might be NPCs not game objects.

  7. #7
    Join Date
    Feb 2017
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    anoobis, Thank you, that's what I was missing. It identified and clicked all fine after the change.

  8. #8
    Join Date
    Apr 2013
    Posts
    680
    Mentioned
    13 Post(s)
    Quoted
    341 Post(s)

    Default

    you dont need to guess - https://villavu.com/forum/showthread.php?t=112438

    run the debug next too the fish spot and see exactly what it is.. you may need to try Id numbers

    <------------------>



  9. #9
    Join Date
    Feb 2017
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    11 Post(s)

    Default

    AFools, previously read amount rune essence miner and there was advice against using static ID's to find those portals. Reasoning was that ID's changed there (so figured to always to use strings if possible) and correct me if I'm wrong, but that script doesn't seem to tell the type of object, which was causing problem in this case.

  10. #10
    Join Date
    Jun 2016
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by mellower View Post
    AFools, previously read amount rune essence miner and there was advice against using static ID's to find those portals. Reasoning was that ID's changed there (so figured to always to use strings if possible) and correct me if I'm wrong, but that script doesn't seem to tell the type of object, which was causing problem in this case.
    I had a quick look and it appears to use colour coding when it displays the ID's on the screen. Anything yellow is an NPC.

    On topic. This fishing spot thing was annoying me so much when trying to make my tutorial island bot. I assumed that they were like doors and couldn't be found. (Unless someone knows how to find doors hsing reflection, that would be amazing.)

    Didn't even consider that the fishing spots might be NPC's.

  11. #11
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by Rangerxmage View Post
    I had a quick look and it appears to use colour coding when it displays the ID's on the screen. Anything yellow is an NPC.

    On topic. This fishing spot thing was annoying me so much when trying to make my tutorial island bot. I assumed that they were like doors and couldn't be found. (Unless someone knows how to find doors hsing reflection, that would be amazing.)

    Didn't even consider that the fishing spots might be NPC's.
    You can, doors are TReflectObjects of the type objBoundary

  12. #12
    Join Date
    Jun 2016
    Posts
    17
    Mentioned
    0 Post(s)
    Quoted
    4 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    You can, doors are TReflectObjects of the type objBoundary
    Are you sure? I have tried to find them on numerous occasions and they just don't seem to be there. I will have to try again later. I can't imagine I am doing it wrong though. Anyway, this is derailing the topic.

  13. #13
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by Rangerxmage View Post
    Are you sure? I have tried to find them on numerous occasions and they just don't seem to be there. I will have to try again later. I can't imagine I am doing it wrong though. Anyway, this is derailing the topic.
    worked on the hill giant door

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
  •