Results 1 to 11 of 11

Thread: Need help with my script

  1. #1
    Join Date
    May 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default Need help with my script

    Hello firstly, I'm a real big noob. Im no coder, I know very little.

    I used PowerFlop by Aaron126 and ripped it to make this.

    All I want it to do is use Mithril bolts (unf) with Feathers. As simple as that

    When I try to run I get this error:
    [Error] C:\Simba\Scripts\Myattempt.simba(381:4): Identifier expected at line 380
    Compiling failed.

    BY THE WAY - Line 380 is last line in this script. The 'end.'


    SCRIPT:

    Program MithBoltFletcher;
    {$define SMART8}
    {$I SRL-OSR/SRL.Simba}
    {$I SRL-OSR/SRL/Misc/SmartGraphics.Simba}

    var
    WarningInfo: string;
    BoltsX, BoltsY, FeathersX, FeathersY, RepeatCount:Integer;
    DebugOverride:Boolean;

    const
    BoltsSlot = 1; // Inventory slot that your Bolts are in (1 through 28)
    FeathersSlot = 2; // Inventory slot that your axe is in, 0 if wielding your axe (1 through 28)

    Procedure DeclarePlayer;
    begin
    HowManyPlayers := 1;
    NumberOfPlayers(HowManyPlayers);
    CurrentPlayer := 0;
    Players[0].Name := ''; //Username goes here
    Players[0].Pass := ''; //Password goes here
    Players[0].Nick := ''; //Character name (excluding first letter)
    Players[0].Active := True;
    end;
    (************************************************* *****************************)
    (* END OF COFIGURATION *)
    (************************************************* *****************************)


    Function ContainsText(CheckText: String; Text: TStringArray): Boolean;
    Var
    TheText: String;
    i, n: Integer;
    Begin
    TheText := CheckText;
    n := High(Text);
    For i := 0 to n do
    If (Pos(Text[i], TheText) > 0) then
    Begin
    Result := True;
    Exit;
    End;
    End;

    Procedure randomMouseClick(mx,my: Integer);
    begin
    case random(200) of
    1..160: Mouse(RandomRange(mx - 7, mx + 7), RandomRange(my - 7, my + 7), 2, 2, true);
    161..190: Mouse(RandomRange(mx - 9, mx + 9), RandomRange(my - 9, my + 9), 2, 2, true);
    191..200: Mouse(RandomRange(mx - 12, mx + 12), RandomRange(my - 12, my + 12), 2, 2, true);
    end;
    end;

    Procedure GetFeathersCoords;
    begin
    FeathersX := 0;
    FeathersY := 0;

    case (FeathersSlot) of
    1:
    begin
    FeathersX := 575;
    FeathersY := 230;
    end;
    2:
    begin
    FeathersX := 620;
    FeathersY := 230;
    end;
    3:
    begin
    FeathersX := 665;
    FeathersY := 230;
    end;
    4:
    begin
    FeathersX := 710;
    FeathersY := 230;
    end;
    5:
    begin
    FeathersX := 575;
    FeathersY := 265;
    end;
    6:
    begin
    FeathersX := 620;
    FeathersY := 265;
    end;
    7:
    begin
    FeathersX := 665;
    FeathersY := 265;
    end;
    8:
    begin
    FeathersX := 710;
    FeathersY := 265;
    end;
    9:
    begin
    FeathersX := 575;
    FeathersY := 300;
    end;
    10:
    begin
    FeathersX := 620;
    FeathersY := 300;
    end;
    11:
    begin
    FeathersX := 665;
    FeathersY := 300;
    end;
    12:
    begin
    FeathersX := 710;
    FeathersY := 300;
    end;
    13:
    begin
    FeathersX := 575;
    FeathersY := 335;
    end;
    14:
    begin
    FeathersX := 620;
    FeathersY := 335;
    end;
    15:
    begin
    FeathersX := 665;
    FeathersY := 335;
    end;
    16:
    begin
    FeathersX := 710;
    FeathersY := 335;
    end;
    17:
    begin
    FeathersX := 575;
    FeathersY := 370;
    end;
    18:
    begin
    FeathersX := 620;
    FeathersY := 370;
    end;
    19:
    begin
    FeathersX := 665;
    FeathersY := 370;
    end;
    20:
    begin
    FeathersX := 710;
    FeathersY := 370;
    end;
    21:
    begin
    FeathersX := 575;
    FeathersY := 405;
    end;
    22:
    begin
    FeathersX := 620;
    FeathersY := 405;
    end;
    23:
    begin
    FeathersX := 665;
    FeathersY := 405;
    end;
    24:
    begin
    FeathersX := 710;
    FeathersY := 405;
    end;
    25:
    begin
    FeathersX := 575;
    FeathersY := 440;
    end;
    26:
    begin
    FeathersX := 620;
    FeathersY := 440;
    end;
    27:
    begin
    FeathersX := 665;
    FeathersY := 440;
    end;
    28:
    begin
    FeathersX := 710;
    FeathersY := 440;
    end;
    end;

    if (BoltsSlot > 28) then
    begin
    writeln(' FATAL! Invalid Feathers slot specified, must be between 0 and 28!');
    TerminateScript;
    end;
    end;

    Procedure GetBoltsCoords;
    begin
    BoltsX := 0;
    BoltsY := 0;

    case (BoltsSlot) of
    1:
    begin
    BoltsX := 575;
    BoltsY := 230;
    end;
    2:
    begin
    BoltsX := 620;
    BoltsY := 230;
    end;
    3:
    begin
    BoltsX := 665;
    BoltsY := 230;
    end;
    4:
    begin
    BoltsX := 710;
    BoltsY := 230;
    end;
    5:
    begin
    BoltsX := 575;
    BoltsY := 265;
    end;
    6:
    begin
    BoltsX := 620;
    BoltsY := 265;
    end;
    7:
    begin
    BoltsX := 665;
    BoltsY := 265;
    end;
    8:
    begin
    BoltsX := 710;
    BoltsY := 265;
    end;
    9:
    begin
    BoltsX := 575;
    BoltsY := 300;
    end;
    10:
    begin
    BoltsX := 620;
    BoltsY := 300;
    end;
    11:
    begin
    BoltsX := 665;
    BoltsY := 300;
    end;
    12:
    begin
    BoltsX := 710;
    BoltsY := 300;
    end;
    13:
    begin
    BoltsX := 575;
    BoltsY := 335;
    end;
    14:
    begin
    BoltsX := 620;
    BoltsY := 335;
    end;
    15:
    begin
    BoltsX := 665;
    BoltsY := 335;
    end;
    16:
    begin
    BoltsX := 710;
    BoltsY := 335;
    end;
    17:
    begin
    BoltsX := 575;
    BoltsY := 370;
    end;
    18:
    begin
    BoltsX := 620;
    BoltsY := 370;
    end;
    19:
    begin
    BoltsX := 665;
    BoltsY := 370;
    end;
    20:
    begin
    BoltsX := 710;
    BoltsY := 370;
    end;
    21:
    begin
    BoltsX := 575;
    BoltsY := 405;
    end;
    22:
    begin
    BoltsX := 620;
    BoltsY := 405;
    end;
    23:
    begin
    BoltsX := 665;
    BoltsY := 405;
    end;
    24:
    begin
    BoltsX := 710;
    BoltsY := 405;
    end;
    25:
    begin
    BoltsX := 575;
    BoltsY := 440;
    end;
    26:
    begin
    BoltsX := 620;
    BoltsY := 440;
    end;
    27:
    begin
    BoltsX := 665;
    BoltsY := 440;
    end;
    28:
    begin
    BoltsX := 710;
    BoltsY := 440;
    end;
    end;

    if (BoltsSlot > 28) then
    begin
    writeln(' FATAL! Invalid Bolt slot specified, must be between 0 and 28!');
    TerminateScript;
    end;
    end;

    Procedure Fletch;
    begin
    GameTab(Tab_Inv);
    mmouse(BoltsX, BoltsY, 5, 5);
    Clickmouse2(mouse_left);
    repeat
    mmouse(FeathersX, FeathersY, 5, 5);
    Clickmouse2(mouse_left);

    Begin
    DeclarePlayer;
    SetupSRL;
    GetBoltsCoords;
    GetFeathersCoords;
    SetBrightness(4);
    ClearDebug;
    end.



    Its properly all wrong anyway

  2. #2
    Join Date
    Sep 2012
    Location
    Australia.
    Posts
    839
    Mentioned
    16 Post(s)
    Quoted
    225 Post(s)

    Default

    At line 372, you need to add an until as you need to cut off your repeat loop and on line 373 you need an end;!

    Always remember, for every if you need a then, for every repeat you need an until and for every begin you need an end! Improving your standards (script formatting) will help you debug your script if you're getting errors!

  3. #3
    Join Date
    May 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by Chris! View Post
    At line 372, you need to add an until as you need to cut off your repeat loop and on line 373 you need an end;!

    Always remember, for every if you need a then, for every repeat you need an until and for every begin you need an end! Improving your standards (script formatting) will help you debug your script if you're getting errors!
    Lol you make it sound so easy, thank you very much for your help ^^

  4. #4
    Join Date
    May 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Still getting errors

    Procedure Fletch;
    begin
    GameTab(Tab_Inv);
    mmouse(BoltsX, BoltsY, 5, 5);
    Clickmouse2(mouse_left);
    repeat
    mmouse(FeathersX, FeathersY, 5, 5);
    Clickmouse2(mouse_left);
    until
    end; (LINE 373)
    Begin
    DeclarePlayer;
    SetupSRL;
    GetBoltsCoords;
    GetFeathersCoords;
    SetBrightness(4);
    ClearDebug;
    end.

    [Error] C:\Simba\Scripts\Myattempt.simba(374:1): Syntax error at line 373
    Compiling failed.


    Also sorry for asking for so much but, is this procedure correct?
    Procedure Fletch;
    begin
    GameTab(Tab_Inv);
    mmouse(BoltsX, BoltsY, 5, 5);
    Clickmouse2(mouse_left);
    repeat
    mmouse(FeathersX, FeathersY, 5, 5);
    Clickmouse2(mouse_left);
    until
    end;

    Will that make the BoltsX&BoltsY use on the FeathersX&FeathersY?

  5. #5
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    There's nothing behind your until. Script won't know when to end the repeat statement.

  6. #6
    Join Date
    Apr 2013
    Location
    England
    Posts
    223
    Mentioned
    2 Post(s)
    Quoted
    106 Post(s)

    Default

    ok so here's your problem:

    Simba Code:
    Procedure Fletch;
    begin
      GameTab(Tab_Inv);
      mmouse(BoltsX, BoltsY, 5, 5);
      Clickmouse2(mouse_left);

      repeat
        mmouse(FeathersX, FeathersY, 5, 5);
        Clickmouse2(mouse_left);
      until    // until what here?????
    end;

    Begin
      DeclarePlayer;
      SetupSRL;
      GetBoltsCoords;
      GetFeathersCoords;
      SetBrightness(4);
      ClearDebug;
    end.

    you see your until where i have commented next to? you have to use unti like this:

    Code:
    repeat
      // do something
    until(false)
    in the brackets can be any boolean statement, the repeat continues whilst the boolean statement is false, once it becomes true the repeat finished and the script moves on.

    and as for it being correct, what is the repeat for? i am unfamiliar with fletching but maybe it should besomething like this:

    Simba Code:
    Procedure Fletch;
    begin
      GameTab(Tab_Inv);
      mmouse(BoltsX, BoltsY, 5, 5);
      Clickmouse2(mouse_left);

      mmouse(FeathersX, FeathersY, 5, 5);
      Clickmouse2(mouse_left);
    end;

    so you are justing clicking on bolts, then clicking on feathers. to repeat this procedure you can call it within a loop in a different procedure/function. for example:

    Simba Code:
    procedure mainLoop;
    begin
      // blah blah blah

      while((getBolts) and (getFeathers)) do
      begin
        Fletch;
      end;

      // blah blah blah
    end;

    i hope thats what you were after and it helped a little
    Last edited by EngageTheRage; 05-30-2013 at 10:41 AM.

  7. #7
    Join Date
    May 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Yh I see the problem, I just took out repeat & until and the problem was solved. It now logs me in

  8. #8
    Join Date
    May 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    Quote Originally Posted by EngageTheRage View Post
    ok so here's your problem:

    Simba Code:
    Procedure Fletch;
    begin
      GameTab(Tab_Inv);
      mmouse(BoltsX, BoltsY, 5, 5);
      Clickmouse2(mouse_left);

      repeat
        mmouse(FeathersX, FeathersY, 5, 5);
        Clickmouse2(mouse_left);
      until    // until what here?????
    end;

    Begin
      DeclarePlayer;
      SetupSRL;
      GetBoltsCoords;
      GetFeathersCoords;
      SetBrightness(4);
      ClearDebug;
    end.

    you see your until where i have commented next to? you have to use unti like this:

    Code:
    repeat
      // do something
    until(false)
    in the brackets can be any boolean statement, the repeat continues whilst the boolean statement is false, once it becomes true the repeat finished and the script moves on.

    and as for it being correct, what is the repeat for? i am unfamiliar with fletching but maybe it should besomething like this:

    Simba Code:
    Procedure Fletch;
    begin
      GameTab(Tab_Inv);
      mmouse(BoltsX, BoltsY, 5, 5);
      Clickmouse2(mouse_left);

      mmouse(FeathersX, FeathersY, 5, 5);
      Clickmouse2(mouse_left);
    end;

    so you are justing clicking on bolts, then clicking on feathers. to repeat this procedure you can call it within a loop in a different procedure/function. for example:

    Simba Code:
    procedure mainLoop;
    begin
      // blah blah blah

      while((getBolts) and (getFeathers)) do
      begin
        Fletch;
      end;

      // blah blah blah
    end;

    i hope thats what you were after and it helped a little
    Ok that makes loads more sence...
    But the main loop, I'l put that in. But how does the script know when to start the mainLoop? Do I put it in with startup procedure?

  9. #9
    Join Date
    Apr 2013
    Location
    England
    Posts
    223
    Mentioned
    2 Post(s)
    Quoted
    106 Post(s)

    Default

    the only part the script automatically executes is what is contained on the "begin-end;" that you have at the end. within here you can create a repeat-until(false) so that a set of operations/procedures are continuously carried out.

    an example:
    Simba Code:
    program Exmaple;
    {$DEFINE SMART8}
    {$i SRL-OSR/Srl.simba}

    var
      boltsX, boltsY, feathersX, feathersY: Integer;

    // here will have all your setupSRL, declare players etc.

    function FindBolts: Boolean;
    var
      xc, yc: integer;
    begin
      Result := False;
      // here you do you stuff to find the bolts ie.
      if(findobject/DTM/Color/ etc) then
      begin
        boltsX := xc;
        boltsY := yc;
        Result := True;
      end;
    end;

    function FindFeathers: Boolean;
    var
      xc, yc: integer;
    begin
      Result := False;
      // here you do you stuff to find the Feathers ie.
      if(findobject/DTM/Color/ etc) then
      begin
        feathersX := xc;
        feathersY := yc;
        Result := True;
      end;
    end;

    Procedure Fletch;
    begin
      mmouse(BoltsX, BoltsY, 5, 5);
      Clickmouse2(mouse_left);

      mmouse(FeathersX, FeathersY, 5, 5);
      Clickmouse2(mouse_left);
    end;

    begin                                      // this is the part executed when script starts

      // here you will call setupSrl, declare players etc ...

      GameTab(Tab_Inv);
      while((FindBolts) & (FindFeathers)) do   // so this while loop will go on
      begin                                    // as long as bolts & feathers are
        Fletch;                                // found.
        wait(RandomRange(50, 250));
      end;
    end;

  10. #10
    Join Date
    May 2013
    Posts
    27
    Mentioned
    0 Post(s)
    Quoted
    10 Post(s)

    Default

    I'm clearly not knowledgeable enough to do this lol :/

    Would anyone do the finishing touches to this?
    It would be a very good script, because this is like 400k a hour fleching exp apparently with no loss in gp.
    http://up.ht/149HuEi

    You can release it as well, as long as I get to use it

    I did go further than I expected with this lol, I thought I was going to stop on the first error I'm pleased with myself
    Last edited by 0r4nge ownz; 05-30-2013 at 11:02 AM.

  11. #11
    Join Date
    May 2007
    Location
    England
    Posts
    4,140
    Mentioned
    11 Post(s)
    Quoted
    266 Post(s)

    Default

    [QUOTE=0r4nge ownz;1244195You can release it as well, as long as I get to use it [/QUOTE]You'll want to ask Aarson126 before releasing anything, since it'd based off his script.
    <3

    Quote Originally Posted by Eminem
    I don't care if you're black, white, straight, bisexual, gay, lesbian, short, tall, fat, skinny, rich or poor. If you're nice to me, I'll be nice to you. Simple as that.

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
  •