End Else Mistake

Discussion in 'Scar/Simba Help' started by Go L Den, Aug 21, 2008.

End Else Mistake
  1. Unread #1 - Aug 21, 2008 at 11:37 PM
  2. Go L Den
    Joined:
    May 1, 2007
    Posts:
    84
    Referrals:
    0
    Sythe Gold:
    0

    Go L Den Member
    Banned

    End Else Mistake

    Hey guys, I am an extreme noob at scripting, I just created a simpel script to look for an adamant axe, if it does not find it, it right clicks on a bank booth and clicks "use bank." If it finds the axe, I intend it to simply say "I have found the adamant axe." in the debug box, and cease working;however, if the axe is present on the screen, it states that the axe has been found, but it also right clicks on the bank booth and selects use. Here is the script that I wrote:


    program AxeBanker;
    var
    x,y: Integer;

    const
    AxeColor= 4017213;
    begin
    if(FindColor(x,y,AxeColor,0,0,600,600)) then
    begin
    Writeln('I Found The Adamant Axe!'+chr(13))
    end else
    MoveMouseSmooth(347,285);
    Wait(1000)
    ClickMouse(347,285,false)
    Wait(1000)
    MoveMouseSmooth(338,316)
    Wait(1000)
    ClickMouse(338,317,true)

    end.

    ____________

    I am thinking that this has something to do with the "end else" that I have in there, but I am not sure, could someone tell me what I am doing wrong and present me with what the script should look like so that it does not access the bank even if it has found the axe?

    Thanks,

    Go L Den
     
  3. Unread #2 - Aug 22, 2008 at 11:39 AM
  4. Runescapian321
    Joined:
    Sep 19, 2007
    Posts:
    179
    Referrals:
    0
    Sythe Gold:
    0

    Runescapian321 Active Member

    End Else Mistake

    Code:
    program AxeBanker;
    var
      x,y: Integer;
    
    const
      AxeColor= 4017213;
    
    begin
      if(FindColor(x,y,AxeColor,0,0,600,600)) then
      begin
        Writeln('I Found The Adamant Axe!'+chr(13))
      end else
      begin //Needed begin here
        MoveMouseSmooth(347,285);
        Wait(1000)
        ClickMouse(347,285,false)
        Wait(1000)
        MoveMouseSmooth(338,316)
        Wait(1000)
        ClickMouse(338,317,true)
      end; //End here
     end.
    You need a begin after you put else, otherwise it'll execute everything after the else whether it's supposed to or not.

    1. Don't use SCAR functions (MoveMouse, ClickMouse, etc.) - They = almost insta-ban. Use SRL. And when downloading SRL, use Subversion, not just the File > Download SRL thing. Here's my guide - http://www.srl-forums.com/forum/ss15-your-full-t31202.html?t=31202

    2. Are you using Scar 3.15b?

    3. After you get SRL, I suggest learning stuff like DTMs or Bitmaps, because just colorfinding won't get you far.
     
  5. Unread #3 - Aug 22, 2008 at 8:54 PM
  6. Go L Den
    Joined:
    May 1, 2007
    Posts:
    84
    Referrals:
    0
    Sythe Gold:
    0

    Go L Den Member
    Banned

    End Else Mistake

    Thanks for the help, I'll download SRL, I'm glad that you were able to fix my script and didn't overlook it just because it's very very nooby. I appreciate your help.

    Go L Den
     
< plz help me with scar | {.include ...} HELP! >

Users viewing this thread
1 guest


 
 
Adblock breaks this site