Results 1 to 5 of 5

Thread: Find Gas

  1. #1
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Find Gas

    Hey,

    Firstly, if I use this, will it look for gas and then run away form the gas then run back? (I added the run back and away thing):

    SCAR Code:
    function GasFound(fx, fy : Integer) : Boolean;
    var
       Color : array [1..2] of integer;
       CountData : array of Integer;
       i, Gx, Gy, count, n, FindTimes : Integer;
    begin
     Color[1] := 8296866;
     Color[2] := 8951705;
     Gx := fx;
     Gy := fy;
     FindTimes := 3;
     for i := 1 to 2 do
     begin
      if (FindColorSpiralTolerance(Gx, Gy, Color[i], fx - 30, fy - 30,
      fx + 30, fy + 30, 20)) then
      begin
        SetArrayLength(CountData, FindTimes);
          while (n < FindTimes) do
          begin
            CountData[n] := CountColorTolerance(Color[i], Gx - 20, Gy - 20, Gx + 20, Gy + 20, 20);
            n := n + 1;
            if (n = FindTimes) then Break; // No need to Wait(100) again...
            Wait(100);
          end;
          BubbleSort(CountData);
          Count := iAbs(CountData[Length(CountData)-1] - CountData[0]);
          if (Count > 40) then
          begin
             Result := FindGas(gx, gy);
             if (Result) then
             Writeln('** Found Gas ** Pixel Count Change is [' + inttostr(Count) + ']' );
          end;
          Gx := fx;
          Gy := fy;
      end;
     end;
    end;

    procedure RunAwayFromGas;

    begin

    if  GasFound  then
    RunAwayDirection(RunDirection);
    wait(10000 + random(2000))
    Runback;

    end;

    Will that work?

    Second, what does this do? does it look for gas then run away if it finds it?

    SCAR Code:
    procedure LookGas;

    begin

      If  (GasCheck(WhereGasFoundX, WhereGasFoundY))  then
        WriteLn('Gas was found');
        RunAwayDirection(RunDirection);
        wait(10000 + random(2000))
        RunBack;

    end;

    All help is appreciated.

    Thanks

    ~Lacky

    http://scarscripters.proboards102.com
    Click Here to Make SRL a Better Place!




    You were outsexed, my friend.
    Quote Originally Posted by Hobbit View Post
    I love lacky b/c i need a lacky :P
    Quote Originally Posted by Julza View Post
    my age is 99 =] look me up in hiscores im first!

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    OK. I have my answer (I received it in a PM).

    How would I put a procedure call on (LookForGas; ) in the mining part of my script so that it checks for gas (and runs away if it finds it) just before I start mining. Like, if it finds gas then it'll do what it does if it finds gas, otherwise it'll continue mining? Also, how do I make it as well that I can look for gas while mining, and if it finds it it'll do whatever otherwise it'll keep on mining? The same thing for after finished mining that one ore?

    All help is appreciated.

    http://scarscripters.proboards102.com
    Click Here to Make SRL a Better Place!




    You were outsexed, my friend.
    Quote Originally Posted by Hobbit View Post
    I love lacky b/c i need a lacky :P
    Quote Originally Posted by Julza View Post
    my age is 99 =] look me up in hiscores im first!

  3. #3
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    600
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Everything is sorted.

    Someone Lock this please?

    http://scarscripters.proboards102.com
    Click Here to Make SRL a Better Place!




    You were outsexed, my friend.
    Quote Originally Posted by Hobbit View Post
    I love lacky b/c i need a lacky :P
    Quote Originally Posted by Julza View Post
    my age is 99 =] look me up in hiscores im first!

  4. #4
    Join Date
    May 2007
    Location
    Ontario
    Posts
    361
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Whoa, talk about triple posting. Please edit your posts...

    Also I'm not sure how to help you but it looks like you have solved it yourself...Your issue in your script is different though you called GasCheck when it's called somewhere else (Duplicate Identifier) and because it's there twice it's oging to cause problems unless you modify your script accordingly.

  5. #5
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure LookGas;
     
    begin
     
      If  (GasCheck(WhereGasFoundX, WhereGasFoundY))  then
        WriteLn('Gas was found');
        RunAwayDirection(RunDirection);
        wait(10000 + random(2000))
        RunBack;
     
    end;

    You're missing a begin and an end. Lets say your script found the gas. You want it to run away. What you have right now is: If the script finds gas, is will just do a writeln. It will run away no matter what. begins and ends are crucial.

    -Knives

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Can't Find DTM
    By Macho Man67 in forum OSR Help
    Replies: 5
    Last Post: 09-04-2008, 07:19 PM
  2. how did i ever find this...?
    By legendaryhero90 in forum Music, Movies and TV
    Replies: 9
    Last Post: 02-03-2008, 12:53 AM
  3. have to find out
    By the scar noob in forum OSR Help
    Replies: 5
    Last Post: 01-13-2007, 10:19 PM

Posting Permissions

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