Results 1 to 6 of 6

Thread: Reflection Help please?

  1. #1
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Reflection Help please?

    Ok, So I need help. My script finds the rocks and mouses over them, but it refuses to click. I think it has something to do with my "oreExcists" porcedure, although I thought it worked/should work. Any feedback is appreciated.

    SCAR Code:
    function GetMyAnimation: Integer;
    var
      Player: Integer;
    begin
       Player := SmartGetFieldObject(0, MyPlayer);
       Result := SmartGetFieldInt(Player, CharAnim);
       SmartFreeObject(Player);
    end;

    procedure LoadOre;
    begin
      case LowerCase(Players[CurrentPlayer].Strings[0]) of
        'copper': UpIDs := [37307, 37308, 37309];
        'tin':    UpIDs := [11937, 11936, 11938];
        'iron':   UpIDs := [11933, 11934, 11935];
      end;
    end;

    function OreExists(Tile : TPoint): Boolean;
    var
      O: UID;
    begin
      begin
      Result := False;
      O := GetObjectAt(Tile.x, Tile.y);
      if InIntArray(UpIDs, O.ObjType) then
        Result := True;
      end;
    end;

    function WhileMining: Boolean;
    var
      T: Integer;
    begin
      Result := (GetMe.Animation= GetMyAnimation);
      repeat
        MarkTime(T);
        Wait(50);
      until (TimeFromMark(T) = 2000) or not Result;
      while OreExists(P) do
      begin
        FindRandoms;
        AntiBan;
      end;
    end;

    function MineRock: Boolean;
    var
      I:Integer;
    begin
      Status('Mining Ore');
      try
        for I := 0 To High(UpIDs) do
        begin
          Result := FindObject(P, UpIDs[I]);
          if Result then Break;
        end;
        if Result then
          P := TileToMS(P, 0);
        MMouse(P.x, P.y, 4, 4);
        Wait(100+random(150));
        if IsUpText('ine') and OreExists(P) then
          Mouse(P.x, P.y, 0, 0, True);
        finally
        begin
          FFlag(0);
          WhileMining;
        end;
      except End;
    end;

    Btw, I use OreExcists as my gas avoider, as it will stop mining the rock if the id changes. Aso, could someone tell me if my getanimation procedure would work?
    “Ignorance, the root and the stem of every evil.”

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    i know this isn't a fix but it will shorten your code
    SCAR Code:
    function OreExists(Tile : TPoint): Boolean;
    var
      O: UID;
    begin
      begin
      Result := False;
      O := GetObjectAt(Tile.x, Tile.y);
      Result := InIntArray(UpIDs, O.ObjType);
      end;
    end;
    i think that is right... btw, why do you have two begins and two ends... you could just use one.

  3. #3
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i have to begins and ends kuz im a stupid idiot thats really tired right now thanks for shortening the code, but theres no point shortening something that doesnt work in the first place, well i guess it should work but maybe it doesnt who knows. Thanks for the feeback though, I appreciate it.
    “Ignorance, the root and the stem of every evil.”

  4. #4
    Join Date
    Sep 2008
    Location
    Chicago
    Posts
    224
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OreExists(P) won't work because you did P := TileToMS(P, 0) before it.

  5. #5
    Join Date
    Sep 2007
    Location
    Michigan
    Posts
    3,862
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Here did some rework:
    SCAR Code:
    function GetMyAnimation: Integer;
    var
      Player: Integer;
    begin
       Player := SmartGetFieldObject(0, MyPlayer);
       Result := SmartGetFieldInt(Player, CharAnim);
       SmartFreeObject(Player);
    end;

    procedure LoadOre;
    begin
      case LowerCase(Players[CurrentPlayer].Strings[0]) of
        'copper': UpIDs := [37307, 37308, 37309];
        'tin':    UpIDs := [11937, 11936, 11938];
        'iron':   UpIDs := [11933, 11934, 11935];
      end;
    end;

    function OreExists(Tile : TPoint): Boolean;//Shortened
    var
      O: UID;
    begin
      O := GetObjectAt(Tile.x, Tile.y);
      Result := InIntArray(UpIDs, O.ObjType);
    end;

    function WhileMining: Boolean;
    var
      T: Integer;
    begin
      Result := (GetMe.Animation= GetMyAnimation);
      repeat
        MarkTime(T);
        Wait(50);
      until (TimeFromMark(T) = 2000) or not Result;
      while OreExists(P) do
      begin
        FindRandoms;
        AntiBan;
      end;
    end;

    function MineRock: Boolean;//major redo
    var
      I:Integer;
      T:TPoint;
    begin
      Status('Mining Ore');
      for I := 0 To High(UpIDs) do
      if FindObject(P, UpIDs[i]) then
       if OreExists(P) then
        Result := true;
      if Result then
      begin
        T := TileToMS(P, 0);
        MMouse(T.x, T.y, 4, 4);
        Wait(100+random(150));
        if IsUpText('ine') then
        begin
          Mouse(T.x, T.y, 0, 0, True);
          FFlag(0);
          WhileMining;
        end;
      end;
    end;
    (Scripts outdated until I update for new SRL changes)
    AK Smelter & Crafter [SRL-Stats] - Fast Fighter [TUT] [SRL-Stats]
    If you PM me with a stupid question or one listed in FAQ I will NOT respond. -Narcle
    Summer = me busy, won't be around much.

  6. #6
    Join Date
    Feb 2007
    Location
    Alberta,Canada
    Posts
    2,358
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Heysus View Post
    OreExists(P) won't work because you did P := TileToMS(P, 0) before it.
    Quote Originally Posted by Narcle View Post
    Here did some rework:
    SCAR Code:
    function GetMyAnimation: Integer;
    var
      Player: Integer;
    begin
       Player := SmartGetFieldObject(0, MyPlayer);
       Result := SmartGetFieldInt(Player, CharAnim);
       SmartFreeObject(Player);
    end;

    procedure LoadOre;
    begin
      case LowerCase(Players[CurrentPlayer].Strings[0]) of
        'copper': UpIDs := [37307, 37308, 37309];
        'tin':    UpIDs := [11937, 11936, 11938];
        'iron':   UpIDs := [11933, 11934, 11935];
      end;
    end;

    function OreExists(Tile : TPoint): Boolean;//Shortened
    var
      O: UID;
    begin
      O := GetObjectAt(Tile.x, Tile.y);
      Result := InIntArray(UpIDs, O.ObjType);
    end;

    function WhileMining: Boolean;
    var
      T: Integer;
    begin
      Result := (GetMe.Animation= GetMyAnimation);
      repeat
        MarkTime(T);
        Wait(50);
      until (TimeFromMark(T) = 2000) or not Result;
      while OreExists(P) do
      begin
        FindRandoms;
        AntiBan;
      end;
    end;

    function MineRock: Boolean;//major redo
    var
      I:Integer;
      T:TPoint;
    begin
      Status('Mining Ore');
      for I := 0 To High(UpIDs) do
      if FindObject(P, UpIDs[i]) then
       if OreExists(P) then
        Result := true;
      if Result then
      begin
        T := TileToMS(P, 0);
        MMouse(T.x, T.y, 4, 4);
        Wait(100+random(150));
        if IsUpText('ine') then
        begin
          Mouse(T.x, T.y, 0, 0, True);
          FFlag(0);
          WhileMining;
        end;
      end;
    end;
    Thank you both, for the help.
    “Ignorance, the root and the stem of every evil.”

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. reflection and non reflection scripts?
    By randy marsh in forum SRL Site Discussion
    Replies: 8
    Last Post: 01-08-2009, 04:05 PM
  2. reflection
    By m4sterdr4g0n in forum SRL Site Discussion
    Replies: 6
    Last Post: 12-06-2008, 06:58 PM
  3. Reflection
    By The! in forum OSR Help
    Replies: 6
    Last Post: 08-08-2008, 07:04 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
  •