Results 1 to 17 of 17

Thread: My first script, whats up with this?

  1. #1
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default My first script, whats up with this?

    SCAR Code:
    program MonkFighter;
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}
    Const
      MonkColor = 12172221;           //color of the monks robes
      Betweentime = 5;               //Time between finding monks (in seconds)
      MouseSpeed = 8+Random(3);      //speed of the mouse (no lower than 5) THIS IS LINE SEVEN<<<<<<<<<
      FoodColor = 1598653           //color of the food you are using
    Var x1,y1:Integer;

    function FindMonk: Boolean;
    begin
    if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
     Result:= True;
    else
     Result:= False;
    Begin
    SetupSRL;
    ActivateClient;
    repeat
    Begin FindColor;
    wait((Betweentime * 1000) + random(300)) if(FindMonk) then if (IsUpText('Attack Monk') then
    Mouse(x, y, 10, 10, True);
    until (not(LoggedIn))
    end.
    Procedure EatFood
    if(FindColorSpiral(x,y,FoodColor,652,329,650,326)) then
     Result:= True;
    else
     Result:= False;

    I try to compile and it says this:

    SCAR Code:
    Line 7: [Error] (15889:1): Duplicate identifier '' in script C:\Documents and Settings\Owner\Desktop\fighter part(1).scar

    Also, is there any simpler ways to eat food then my way?

  2. #2
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    You've got mousespeed in const in your script, thats already in SRL, Use this in const:
    PHP Code:
    Const
      
    MonkColor 12172221;           //color of the monks robes
      
    Betweentime 5;               //Time between finding monks (in seconds)
      
    MSpeed =8;      //speed of the mouse (no lower than 5) THIS IS LINE SEVEN<<<<<<<<<
      
    FoodColor 1598653;           //color of the food you are using 
    And after SetUpSRL in your main loop use this:
    PHP Code:
    begin
    SetUpSRL
    ;
    MouseSpeed(MSpeed
    //And your stuff here....

    end

  3. #3
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program MonkFighter;
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}
    Const
      MonkColor = 12172221;           //color of the monks robes
      Betweentime = 5;               //Time between finding monks (in seconds)
      MSpeed =8;           //speed of the mouse (no lower than 5)
      FoodColor = 1598653;           //color of the food you are using
    Var x1,y1:Integer;

    function FindMonk: Boolean;
    begin
    if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
     Result:= True;
    else   //LINE 15 <<<<
     Result:= False;
    Begin
    SetUpSRL;
    MouseSpeed(MSpeed)
    ActivateClient;
    repeat
    Begin FindColor;
    wait((Betweentime * 1000) + random(300)) if(FindMonk) then if (IsUpText('Attack Monk') then
    Mouse(x, y, 10, 10, True);
    until (not(LoggedIn))
    end;
    Procedure EatFood
    if(FindColorSpiral(x,y,FoodColor,652,329,650,326)) then
     Result:= True;
    else
     Result:= False;

    New Error:

    SCAR Code:
    Line 15: [Error] (15897:1): Identifier expected in script C:\Documents and Settings\Owner\Desktop\fighter part(1).scar

    Is the rest okay?

  4. #4
    Join Date
    Nov 2006
    Posts
    20
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    program MonkFighter;
    
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}
    
    const MissedColor           = 16728128;
    const HitColor              = 192;
    
    //////SETUP///////////////////////////////////////////////////////////////////////
    Const                                                                           //
      MonkColor = 12172221;           //color of the monks robes                    //
      Betweentime = 5000;               //Time between finding monks (in millisecs) //
      FoodColor = 1598653;           //color of the food you are using              //
      tokill = 20;                                                                  //                                                              //
    //////////////////////////////////////////////////////////////////////////////////
    
    Var killed:Integer;
    
    function FindMonk: Boolean;
    begin
     if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
      Result:= True;
    end;
    
    Function InFightAt(x, y: Integer):Boolean;
    var
      dx, dy: Integer;
    begin
     if ( FindColor(dx, dy, GreenStatusColor, x - 20, y - 10, x + 20, y + 10) or
        FindColor(dx, dy, RedStatusColor, x - 20, y - 10, x + 20, y + 10)   or
        FindColor(dx, dy, MissedColor, x - 20, y - 10, x + 20, y + 10)   or
        FindColor(dx, dy, HitColor, x - 20, y - 10, x + 20, y + 10) ) then
        Result:=True;
    end;
    
    
    Begin
    SetUpSRL;
    ActivateClient;
    MouseSpeed := 8;
    
    repeat
    if(findmonk) then
    begin
     if(not infightat(x,y)) then
     begin
      mouse(x,y,2,2,True);
      killed := killed + 1;
     end;
    end;
    
    flag;
    
    wait(100);
    
    repeat
    wait(random(100));
    until(not infight)
    
    until (killed >= tokill)
    
    end.
    hope this helps ive got to go now but ill explain the changes later.

  5. #5
    Join Date
    Jun 2006
    Location
    USA
    Posts
    1,828
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    PHP Code:
    function FindMonkBoolean;
    begin
    if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
     Result
    := True
    else   //LINE 15 <<<<
     
    Result:= False

  6. #6
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    433
    Mentioned
    1 Post(s)
    Quoted
    8 Post(s)

    Default

    Like the simpliest way

    RealEatIfNeeded(Foodcolor,EatHp,False) ;

    and add foodcolor and eathp in youre const, it checks youre Hp, if its lower than EatHp set in const, it will eat. Easy 'n' effective.

  7. #7
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    One tip for you...

    Code:
    function FindMonk: Boolean;
    begin
     if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
      Result:= True;
    end;
    You aren't actually searching from the center of the screen with that procedure. If you want to search from the center, you need to set x and y before the search. Since you didn't set x and y, they are probably just 0,0, which means you are searching from the top-left just like a normal FindColor does. Also, I don't think you want to search your inventory or the minimap for monk colors, so you should restrict your search to the Mainscreen. To do this you can use the constants already set up in SRL.

    MSCX and MSCY are the Main-Screen-Center points for x and y respectively. The corner points for the Main-Screen are MSX1,MSY1,MSX2, MSY2, so you can do it like this...

    Code:
    function FindMonk: Boolean;
    begin
     x:=MSCX;  
     y:=MSCY;  
     if(FindColorSpiral(x,y,MonkColor,MSX1,MSY1,MSX2,MSY2)) then
      Result:= True;
    end;

  8. #8
    Join Date
    Mar 2006
    Posts
    3,051
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    One tip for you...

    Code:
    function FindMonk: Boolean;
    begin
     if(FindColorSpiral(x,y,MonkColor,5,5,760,495)) then
      Result:= True;
    end;
    You aren't actually searching from the center of the screen with that procedure. If you want to search from the center, you need to set x and y before the search. Also, I don't think you want to search your inventory or the minimap for monk colors, so you should restrict your search to the Mainscreen. To do this you can use the constants already set up in SRL.

    MSCX and MSCY are the Main-Screen-Center points for x and y respectively. The corner points for the Main-Screen are MSX1,MSY1,MSX2, MSY2, so you can do it like this...

    Code:
    function FindMonk: Boolean;
    begin
     x:=MSCX;  
     y:=MSCY;  
     if(FindColorSpiral(x,y,MonkColor,MSX1,MSY1,MSX2,MSY2)) then
      Result:= True;
    end;
    Also here you need to add a flag command in this section..

    Code:
    if(findmonk) then
    begin
     if(not infightat(x,y)) then
     begin
      mouse(x,y,2,2,True);
      killed := killed + 1;
      FFlag(0); //wait until you reach the monk to attack it
     end;
    end;
    After you click the mouse, you need to wait until you get over to where the monk is, so you should use a flag command, like FFlag(0). If you just click and then immediately start checking to see if you are in combat or not, you will exit your combat waiting loop before you ever reach the monk to attack it.

  9. #9
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  10. #10
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok, I have this part of the script:
    SCAR Code:
    function FindMonk: Boolean;
    begin
     x:=MSCX;
     y:=MSCY;
     if (FindObj(x,y,MonkColor,MSX1,MSY1,MSX2,MSY2)) or (FindObj(x,y,MonkColor2,MSX1,MSY1,MSX2,MSY2)) then
      Result:= True;
      else
      Result:= False;
    end;

    and it has this error:
    SCAR Code:
    Failed when compiling
    Line 43: [Error] (15925:47): Invalid number of parameters in script C:\Documents and Settings\Owner\Desktop\MonkFighter.scar

    But I believe its the correct amount of parameters?

  11. #11
    Join Date
    Jul 2006
    Location
    NY
    Posts
    371
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    This is how its supposed to be setup.
    SCAR Code:
    function FindMonk: Boolean;
    begin
     x:=MSCX;
     y:=MSCY;
     if (FindObj(x,y,'onk',MonkColor,15)) or (FindObj(x,y,'onk',MonkColor2,15)) then
      Result:= True;
      else
      Result:= False;
    end;

  12. #12
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Failed when compiling
    Line 45: [Error] (15927:1): Identifier expected in script C:\Documents and Settings\Owner\Desktop\MonkFighter

    and line 45 is the "else"

  13. #13
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Junior helped me on msn, but I still have errors, and this is the latest:
    SCAR Code:
    Failed when compiling
    Line 88: [Error] (15970:1): period ('.') expected in script C:\Documents and Settings\Owner\Desktop\MonkFighter (Latest2).scar

    this is the script:
    SCAR Code:
    end;
    end

    Procedure AntiBan1; //THIS IS THE ERROR LINE.
    begin
      RandomChatEvery(10 + Random(5));
      RotateEvery(10 + Random(10));
      LeaveScreenEvery(1);
      HoverEvery(8 + Random(5), 'random');
      PickUpMouseEvery(5 + Random(10))
        RandomRClickEvery(15 + random(5))
        if (KillScriptTime > 0) then
        KillScript(KillScriptTime);

  14. #14
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I believe thatd because you missing an end :P.

  15. #15
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

  16. #16
    Join Date
    Sep 2006
    Posts
    916
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    after killscript thing i believe.

  17. #17
    Join Date
    Oct 2006
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. whats wrong with my script !?!?!?!!?
    By stampede10343 in forum OSR Help
    Replies: 7
    Last Post: 02-25-2008, 02:37 AM
  2. whats wrong with this script
    By psychojamesd in forum OSR Help
    Replies: 3
    Last Post: 08-02-2007, 01:59 AM
  3. Script, whats wrong
    By Camaro' in forum OSR Help
    Replies: 10
    Last Post: 06-01-2007, 01:15 AM
  4. Whats wrong in my script?
    By Intef i i i in forum OSR Help
    Replies: 2
    Last Post: 04-10-2007, 03:29 PM
  5. whats wrong with this script?
    By fugate in forum OSR Help
    Replies: 14
    Last Post: 01-16-2007, 04:44 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
  •