Results 1 to 5 of 5

Thread: Help with my first script

  1. #1
    Join Date
    Mar 2012
    Location
    Singapore
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Red face Help with my first script

    Hey there and this is my first day scripting!

    After looking through tutorials here, I thought about making one and this is what I got so far.


    What I want the script to do is to walks from Yanille Bank to the Bar, open the door and walk back to bank and deposit the whole inventory. Kinda Pointless but it helps me to learn.


    Code:
    program YanilleWalker;
      {$DEFINE SMART}
      {$DEFINE SMART8}
      {$i srl/srl.simba}
      {$i sps/sps.simba}
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      with Players[0] do
      begin
        Name   := ''; // Character Name
        Pass   := ''; // Character Pass
        Pin    := ''; // Character Pin
        Nick   := ''; // Character Nickname
        Active := True; // Use player in script?
        Member := True; // Member?
      end;
    end;
    
    procedure WriteInDebugBox;
      begin
      Writeln('GodGenesis First Script');
    end;
    
    Var
      myPath:TPointArray;
    
    procedure WalkToBartender;
    begin;
      SetupSRL;
      SPS_Setup(RUNESCAPE_SURFACE,['5_10']);
    
      myPath := [Point(2284, 4297), Point(2250, 4283), Point(2227, 4277),
      Point(2208, 4279), Point(2174, 4279), Point(2156, 4293), Point(2137, 4306),
      Point(2108, 4311), Point(2068, 4310), Point(2057, 4329), Point(2046, 4334),
      Point(2051, 4347)];
      SPS_WalkPath(myPath);
    end;
    
    function OpenDoor(var fx, fy: Integer): Boolean;
      var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.03, 0.78);
    
      if not(FindColorsTolerance(arP, 1327963, MSX1, MSY1, MSX2, MSY2, 16)) then
      begin
        Writeln('Failed to find the color, no object found.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    end;
    
    procedure WalkToBank;
    begin;
      SetupSRL;
      SPS_Setup(RUNESCAPE_SURFACE,['5_10']);
    
      myPath := [Point(2046, 4337), Point(2062, 4321), Point(2107, 4306),
      Point(2130, 4310), Point(2143, 4305), Point(2160, 4290), Point(2176, 4280),
      Point(2202, 4278), Point(2243, 4283), Point(2257, 4285), Point(2279, 4297),
      Point(2285, 4299)];
      SPS_WalkPath(myPath);
    end;
    
     procedure OpenBankAll;
    
    begin;
    Openbank('ynb', True,True);
    Deposit(1 , 28, True);
    end;
    
    
     begin
      ClearDebug;
      WriteInDebugBox;
      WalkToBartender;
      OpenDoor;
      WalkToBank;
      OpenBankAll;
    end.
    However, I do not understand this error that I get when running the script

    "Identifier expected at line 65"
    Line 65 is the procedure "WalkToBank"

    Also any comments to improving this script would be so great!
    Last edited by GodGenesis; 11-17-2012 at 02:52 PM.

  2. #2
    Join Date
    Jun 2012
    Posts
    2,182
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You are missing an end in function open door.
    Thx Euphemism and Vinyl for the awesome siggy and avatar!

  3. #3
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    You missed an end; before that line.
    Your OpenDoor at main program has no argument when the function specify a parameter.
    Simba Code:
    procedure WriteInDebugBox;
      begin
      Writeln('GodGenesis First Script');
    end;
    1 liner procedure, not very meaningful?
    Call the writeln directly.

    Simba Code:
    function OpenDoor(var fx, fy: Integer): Boolean;
      var
      arP, arAP: TPointArray;
      arC, arUC: TIntegerArray;
      ararP: T2DPointArray;
      tmpCTS, i, j, arL, arL2: Integer;
      P: TPoint;
      X, Y, Z: Extended;
    begin
      tmpCTS := GetColorToleranceSpeed;
      ColorToleranceSpeed(2);
      SetColorSpeed2Modifiers(0.03, 0.78);

      if not(FindColorsTolerance(arP, 1327963, MSX1, MSY1, MSX2, MSY2, 16)) then
      begin
        Writeln('Failed to find the color, no object found.');
        ColorToleranceSpeed(tmpCTS);
        SetColorSpeed2Modifiers(0.2, 0.2);
        Exit;
      end;
    end;
    So you are not planning to do anything if the color is found?

  4. #4
    Join Date
    Mar 2012
    Location
    Singapore
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Footy View Post
    You are missing an end in function open door.
    Ah thanks! Missed that out. :S

  5. #5
    Join Date
    Mar 2012
    Location
    Singapore
    Posts
    32
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by riwu View Post
    So you are not planning to do anything if the color is found?
    Of course I want to open the door. Just needa search how to do it with the mouse thing. Haven't got there yet.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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