• Log in or sign up for an account here: https://www.sythe.org/login

End Else Mistake

Go L Den

Member

Banned
Joined
May 1, 2007
Sythe Gold
0
Messages
84
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
 
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.
 
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
 
Runescape Gamblingrunescape gambling
Back
Top