Results 1 to 7 of 7

Thread: How to add something from one script to another?

  1. #1
    Join Date
    May 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to add something from one script to another?

    How do I add the combat pot drinking from this script:

    Code:
    program BPotter;
    {$DEFINE SRL5}
    {$i srl/srl/misc/Smart.simba}
    {$i srl/srl.simba}
    
    var
    T1, T2, T3, T4: Integer; // Timing for renewals/shutdown
    HouseTab, Renewal4, Renewal3, Renewal2, Renewal1: Integer;
    Pray1, Pray2, Pray3, Pray4: Integer;
    Combat1, Combat2, Combat3, Combat4: Integer;
    xpp, ypp: Integer;
    xrw, yrw: Integer;
    xcp, ycp: Integer;
    
    const
    TimeToRun=(5);
    Skill=('strength');
    
    procedure DeclarePlayers;
    begin
    
     HowManyPlayers := 1;
     NumberOfPlayers(HowManyPlayers);
     CurrentPlayer := 0;
    
     Players[0].Name := '';
     Players[0].Pass :='';
     Players[0].Nick := '';
     Players[0].Active := True;
    
    end;
    
    
    
    procedure LoadDTMs;
    begin
    
      HouseTab := DTMFromString('mlwAAAHicY2dgYDjIxMBwAohPM0HY24F4GxAfAuI9jAwMW4D4MBAfg9K7gHgjEK9ctJAhOMCfISIkhCE0KIghJiICTPt4ejLwA83FhRnxYCgAAHtBErI=');
    
      Renewal4 := DTMFromString('mlwAAAHicY2dgYNjPBMFHgPgoEO8C4t1AfACIZzMyMExghNALgHghEM8C4iVAXCghwBAXn8TgwcfFECDADeaXSggy5IjxM/ADzcWFGfFgKAAABBsOWQ==');
    
      Renewal3 := DTMFromString('mbQAAAHicY2VgYMhhguBCKJ0CxPMZGRimA/ECIF4KxAuBOFOMnyEsLIohSJCHIRvIzhPnZ+AH6kfHjFgwGAAAgXgIwQ==');
    
      Renewal2 := DTMFromString('mggAAAHicY2NgYJjKBMEzgHgOEE8B4n4gXsAIFAfiWUC8EIiXAvEiIM4Q5WNITc1k8PMLYnDj42LIEeNnyAZifqBZ2DAjDgwBACRyC9w=');
    
      Renewal1 := DTMFromString('mbQAAAHicY2VgYHBkgmAPKG0DxAsYGRimAvFCIF4KpSdkZjFkZuUxFPt4MxSICzBMzS9g4AfqR8eMWDAYAADBrQqB');
    
      Pray4 := DTMFromString('mggAAAHicY2NgYJjGBMGzgHguEE8H4glAbMTIwKABxAZAbAbEFlDaakcXg93RyQyazUkMGnVxYL79yWkM/ECzsGFGHBgCAEfHDW8=');
    
      Pray3 := DTMFromString('mggAAAHicY2NgYMhhguACIC6GstOA+BAjA8NOID4AxMeA+AQQHwViq13dDPHxyQyGc0oZNJuTGKz39jLYHZnMwA80CxtmxIEhAAD8Nw+e');
    
      Pray2 := DTMFromString('mbQAAAHicY2VgYJjGBMGzgXgqEPcD8WFGBoZdQHwUiI8D8TEgttjUyhATk8Cg3ZPJYL27h8HmwAQGfqB+dMyIBYMBAMc1DdQ=');
    
      Pray1 := DTMFromString('mggAAAHicY2NgYHBigmBPIHYDYgcgtgXiGkYGhiJGCN0IxXVAXLhqBkNUdDxDQEcpg3ZPJoP13l6Gyo0LGPiBZmHDjDgwBAAAEnMNdg==');
    
      Combat4 := DTMFromString('mggAAAHicY2NgYDjIxMBwHIj3A/EhIN4NxZWMDAx1QFwExA1AXA/EFUCcvyCaIbDUiaFhVyaYXb0phaFuWzoDP9AsbJgRB4YAAG5QEIM=');
    
      Combat3 := DTMFromString('mlwAAAHicY2dgYHBigmB3IPYAYmcgtgViGyCuZGRgKGCE0HVA3AjE9VB+4ZIYhpycQobwOneGiHoPML9iXRJD+epEBn6gubgwIx4MBQBbyA8m');
    
      Combat2 := DTMFromString('mlwAAAHicY2dgYMhmYmDIAeJ8IC6CslOBOAOIaxkZGAqBuBKI64C4gREiBuIXLYtlyMrOZ2iYUs0QXO7CULgkhqF8dSLD4r3zGPiB5uLCjHgwFAAAM2wRIQ==');
    
      Combat1 := DTMFromString('mrAAAAHic42BgYHBigmA3IPaE0o5AbA3EtkBcw8jAUADEFUBcC8SNUFwHFZu3bSZDXl4xg7e3H0PtlDKGmFYfhop1SQzL9y1iKC6uYOAH2oEPMxLAMAAAV+oSTQ==');
    
    end;
    
    procedure FreeDTMs2;
    begin
      FreeDTM(HouseTab);
      FreeDTM(Renewal4);
      FreeDTM(Renewal3);
      FreeDTM(Renewal2);
      FreeDTM(Renewal1);
      FreeDTM(Pray4);
      FreeDTM(Pray3);
      FreeDTM(Pray2);
      FreeDTM(Pray1);
      FreeDTM(Combat4);
      FreeDTM(Combat3);
      FreeDTM(Combat2);
      FreeDTM(Combat1);
    end;
    
    procedure Home;
    var
    x, y: Integer;
    begin
      if LoggedIn then
      begin
      Writeln('Teleporting home')
          if not(GetCurrentTab= 25) then
            begin
            GameTab(25);
            Wait(500+(Random(500)));
            end;
    
      if(FindDTM(HouseTab, x, y, MIX1, MIY1, MIX2, MIY2))then
          begin Mouse(x, y, 3, 3, 1);
                Writeln('Terminating script');
          end
      else begin
       Writeln('NO HOUSE TAB, mayday mayday!!!');
           end;
       Terminatescript;
       end;
    end;
    
    Function FindRenewal: Boolean;
    var
    RenewalDTM : Array [0..3] of Integer;
    i2 :Integer;
    begin
      RenewalDTM[0]:=Renewal1;
      RenewalDTM[1]:=Renewal2;
      RenewalDTM[2]:=Renewal3;
      RenewalDTM[3]:=Renewal4;
    
      For i2:=0 to 3 do
      begin
      if FindDTM(RenewalDTM[i2], xrw, yrw, MIX1, MIY1, MIX2, MIY2)then;
      result:= true;
      end;
    end;
    procedure DrinkRenewal;
    
    begin
     If FindNormalRandoms Then
        If Not LoggedIn Then
          Exit;
    
    if LoggedIn then
    
        if (TimeFromMark(T1) > 5*60*1000) then   // fiksaa
        begin
            Writeln('Renewal');
    
            if not(GetCurrentTab= 25) then
                begin
                GameTab(25);
                Wait(500+(Random(500)));
                end;
    
            if FindRenewal then
                begin
                    Mouse(xrw, yrw, 5, 5, 1);
                    Writeln('found renewal');
                    MarkTime(T1);
                    Exit;
                end;
                                          Writeln('no renewal found');
    
        end;
    end;
    
    Function FindCombatPot: Boolean;
    var
    CombatDTM : Array [0..3] of Integer;
    i3 :Integer;
    begin
      CombatDTM[0]:=Combat1;
      CombatDTM[1]:=Combat2;
      CombatDTM[2]:=Combat3;
      CombatDTM[3]:=Combat4;
    
      For i3:=0 to 3 do
          begin
          if FindDTM(CombatDTM[i3], xcp, ycp, MIX1, MIY1, MIX2, MIY2)then;
          result:= true;
          end;
    end;
    
    procedure DrinkCombatPot;
    
    begin
    
        if (TimeFromMark(T4) > 6*60*1000) then
        begin
             Writeln('combat pot');
            if not(GetCurrentTab= 25) then
                begin
                GameTab(25);
                Wait(500+(Random(500)));
                end;
    
            if FindCombatPot then
                begin
                    Mouse(xcp, ycp, 5, 5, 1);
                    Writeln('found combat pot');
                    MarkTime(T4);
                    Exit;
                end;
                Writeln('no combat pot found');
    
        end;
    end;
    
    
    Function PrayerLeft: Integer;
    var
    PrayPoints: String;
    
    begin
      Result:= GetMMLevels('pray', PrayPoints);
    end;
    
    Function FindPrayPot: Boolean;
    var
    PrayDTM: Array [0..3] of Integer;
    i1: Integer;
    
    begin
     PrayDTM[0]:=Pray1;
     PrayDTM[1]:=Pray2;
     PrayDTM[2]:=Pray3;
     PrayDTM[3]:=Pray4;
    
        For i1:= 0 to 3 do
        begin
        if FindDTM(PrayDTM[i1], xpp, ypp, MIX1, MIY1, MIX2, MIY2) then;
        result:= true;
        end;
    
     end;
    
    
    procedure PotPray;
    
    
    begin
    
    
    Writeln(IntToStr(PrayerLeft));
    
            if ((PrayerLeft) <450) then
                  begin
                  if not(GetCurrentTab= 25) then
                            begin
                              GameTab(25);
                              Wait(500+(Random(500)));
                            end;
    
                      begin
                      if FindPrayPot then
                                      begin
                                      Mouse(xpp, ypp, 5, 5, 1);
                                       Writeln('found praypot');
                                       Exit;
                                      end;
                    Writeln('no praypot found');
                    Home;
                    end;
                  end;
    end;
    
    procedure DoRandomMovement;
    begin
    if (TimeFromMark(T2) > 60*1000) then
        begin
        RandomMovement;
        MarkTime(T2)
        end;
    end;
    
    
    
    procedure AntiBan;
    begin
    if(RBoolEx(10))then HoverSkill(Skill, False);
    
    end;
    
    begin
     Smart_Server := 5;
     Smart_Members := True;
     Smart_Signed := True;
     Smart_SuperDetail := False;
     SetupSRL();
     DeclarePlayers;
     LoginPlayer;
     MouseSpeed:=26;
     LoadDTMs;
     AddOnTerminate('FreeDTMs2');
     if not(GetCurrentTab = 25) then begin GameTab(tab_inv); end;
     MarkTime(T1);
     MarkTime(T2);
     MarkTime(T3);
     MarkTime(T4);
    
    Repeat
      FindNormalRandoms;
      PotPray;
      Wait(500+(Random(500)));
      DrinkRenewal;
      Wait(500+(Random(500)));
      DrinkCombatPot;
      Wait(500+(Random(500)));
      DoRandomMovement
      Wait(500+(Random(500)));
      AntiBan;
    Until(TimeFromMark(T3)> TimeToRun*60*60*1000);
    Writeln('Time To Run reached');
    Home;
    end.
    To this script:

    Code:
    program R4StayLoggedIn;
    {$i srl/srl/misc/smart.simba}
    {$i srl/srl.simba}
    //{$i SRL/SRL/misc/paintsmart.simba}
    
    var
    //CStatus: String;
    x, y :Integer;
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0; // This is the player to start with
      Players[0].Name := ''; // Username
      Players[0].Pass := ''; // Password
      Players[0].Nick := ''; // 3-4 lowercase letters from username;
      Players[0].Active := True; // Set to true if you want to use Player 0
      Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
    end;
    
    {Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
      var
        mx, my, Pic, I, B, H, TPH, Numb: Integer;
        TTP: TPointArray;
        Canvas: TCanvas;
      begin
        SmartSetDebug(True);
        GetClientDimensions(mx, my);
        Pic := BitmapFromString(mx, my, '');
        TPH := High(TP);
        for I := 0 to TPH do
        begin
          TTP := LoadTextTPA(TP[i], SmallChars, H);
          for B := 0 to High(TTP) do
          begin
            Numb := ((I + 1) * 13);
            FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
            FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
          end;
        end;
        Canvas := TCANVAS.Create;
        Canvas.Handle := SmartGetDebugDC;
        DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
        FreeBitmap(Pic);
      end;  }
    
      {function GetRandomFact: string;
    //This function returns a random fact from
    //  the website 'http://randomfactgenerator.net/'
    // Author: kanah
    //  Special thanks to Euphemism for the idea
    var
      SearchString0, SearchString1, Text: string;
    begin
      //Search strings are used to mark the begining and end of useful info
      SearchString0 := '<div id="facts">';
      SearchString1 := '<br/><br/>';
    
      //Text is loaded with the raw html text from the website
      Text := GetPage('http://randomfactgenerator.net/');
    
      //Text is now broken down from the entire html page into the random fact
      Text := Between(SearchString0,SearchString1,Text);
    
      //Now trim to remove spaces and get rid of the "<div>" text
      Trim(Text);
      delete(Text,1,pos('>',Text));
      Result := Text;
      Wait(randomrange(5000, 10000));
    end;
    
    
      Procedure Painting;
      begin
        PrintOnSmart(['R4_StayLoggedIn','-----------', 'Status:', CStatus,
        '-----------', 'Fact:', GetRandomFact], Point(40, 50),16777215);
      end; }
    
    
    procedure Antiban;
    begin
      case Random(60) of
        10: RandomRClick;
        20: HoverSkill(SKILL_ATTACK + Random(SKILL_DUNGEONEERING + 1), False);
        30: PickUpMouse;
        40: RandomMovement;
        50: BoredHuman;
        59: ExamineInv;
      end;
    end;
    
    {procedure RandomComments;
    begin
    case Random(60) of
        10: CStatus := 'Randomly Moving';
        20: CStatus := 'So so bored';
        30: CStatus := 'Lifting the mouse';
        40: CStatus := 'Randomly moving...';
        50: CStatus := 'I bored.';
        59: CStatus := 'Staying logged in...';
      end;
      Painting;
    end;    }
    Procedure Loop();
    begin
    repeat
      Antiban;
      {RandomComments;}
      FindNormalRandoms;
      Wait(1000+Random(1000));
    until false;
    end;
    
    
    begin
    {
      case Random(60) of
        10: CStatus := 'Randomly Moving';
        20: CStatus := 'So so bored';
        30: CStatus := 'Lifting the mouse';
        40: CStatus := 'Randomly moving...';
        50: CStatus := 'I bored.';
        59: CStatus := 'Staying logged in...';
      end; }
      Smart_Server := 5;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      SetupSRL;
      DeclarePlayers;
      LoginPlayer;
      {Painting; }
      Loop;
    end.
    I tried copying and pasting the DrinkCombat Pot procedure and then adding it after "FindNormalRandoms;" at the bottom but that didn't work. It said unknown identifier T4. I think I need to declare the variables but I'm not sure exactly what to do. Any help is appreciated.

  2. #2
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    1,199
    Mentioned
    0 Post(s)
    Quoted
    26 Post(s)

    Default

    I guess I don't understand why you are adding DrinkCombatPot to the FindNormalRandoms. DrinkCombatPot should be called when GetSkillLevel<GetSkillLevel+5 or something like that.

  3. #3
    Join Date
    May 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I didn't mean specifically add it to that. Basically what I mean is I really don't know what I'm doing. I know a little coding but I'm not sure what to do here. I just thought you could add it there. I'm just asking where/how that would be added.

  4. #4
    Join Date
    Mar 2012
    Location
    127.0.0.1
    Posts
    1,199
    Mentioned
    0 Post(s)
    Quoted
    26 Post(s)

    Default

    Personally I would try adding something like,
    Simba Code:
    procedure Mainloop;
    begin
    FindNormalRandoms;
    If GetSkillLevel<GetSkillLevel+5 then
         begin
            DrinkCombatPotion;
         end;
    Rest of your procedures;
    end;

  5. #5
    Join Date
    May 2012
    Posts
    28
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    "
    [Error] (98:22): Unknown identifier 'T4' at line 97
    Compiling failed."

    That's still what I get. :/

  6. #6
    Join Date
    Apr 2012
    Location
    Australia
    Posts
    1,252
    Mentioned
    1 Post(s)
    Quoted
    22 Post(s)

    Default

    at the top of the script, underneath the includes where it has:
    Simba Code:
    var
    //CStatus: String;
    x, y :Integer;

    add this line:
    Simba Code:
    T4: integer;

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

    Default

    U simply combine all the procedures in both scripts into one, then call them in ur mainloop.
    eg.
    Script 1:
    Simba Code:
    program Script1;
    var
      x:integer;
    procedure abc;
    begin
      action1;
    end;

    begin
      abc;
    end.
    Script 2:
    Simba Code:
    program Script2;
    var
      y:integer;
    procedure def;
    begin
      action2;
    end;

    begin
      action2;
    end.

    Combined:
    Simba Code:
    program CombinedScript;
    var
      x,y:integer;
    procedure abc;
    begin
      action1;
    end;

    procedure def;
    begin
      action2;
    end;

    begin
      abc;
      def;
    end.

    You would have to take note of how to combine the loops, declare the variables used in both scripts etc.
    I'd really suggest u read through the beginner&intermediate scripting tutorials to truly understand what u are doing.

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
  •