Results 1 to 9 of 9

Thread: DeclarePlayers and Howmanykills; help.

  1. #1
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default DeclarePlayers and Howmanykills; help.

    Every time i use declare players it moves to random points on the screen(rs) and keeps repeating. Whys this?

    And my how many kills const doesn't work i keeps going past its set number. My integers are setup fine. I dunno whats wrong.

    And findnormalrandoms; keeps saying out of range in line 876 or in those numbers. Now my script has no antirandoms!

    Script-
    Code:
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    ///////////////////////////////////////////////////////////////////
    //                            JUNK's LRK
    //bitmap eating procedure           infight to keep fighting if not done
    //antirandoms                       cooked meat eater(sorry)
    //failsafes                         small const, big result
    //////////////////////////////V1.00////////////////////////////////
    
    
    program LRK;
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}
    
    Var
    x,y,foodbmp,kill :integer;
    /////////////////////fill this in/////////////////////////////////////////////
    const
    mousecolor= 4013378;// your mouse color
    eat= true; //Cooked meat can only be eaten thanks to jad(boolean)
             //cook raw beef from a cow and get Cook it to get cooked meat
    howmanykills= 10; //how many do you want to kill
    //////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////dont touch the rest
    procedure EatFood;    // thanks to marpis
    begin
        foodbmp := BitmapFromString(13, 12, 'beNpzMpoV7zEpyqU/0rnWV' +
           '2BAENBqZERdZbhUEmkaJagn3KkxwGZqjCseK7pCHer8rEs9zBal+A' +
           'AjAqvi9mB7oDkQZSsz/Zek+cIVQyIOiIDmAJW1BNlV+1hmAwB9+ZV' +
           'I');
           if(hppercent<20)then //thanks to marpis again
           begin
           if(eat=true)then
           begin
           Writeln('said yes to eat.');
         GameTab(tab_Inv);
        wait(100+random(20));
       if (FindBitmapToleranceIn(foodbmp, x, y, MIX1, MIY1, MIX2, MIY2, 20)) then
      begin
        Mouse(x, y, 2, 2, true);
        freebitmap(foodbmp);
         writeln('Ate food successfully!');
          wait(1500+random(200));
          end
           else
         if not(FindBitmapToleranceIn(foodbmp, x, y, MIX1, MIY1, MIX2, MIY2, 20))then
        writeln('Could not find food');
        end
       else
       if (eat = false )then
       begin
       Writeln('Said no to eat');
       end;
      end;
     end;
    
    
    Procedure clickkiller;
     begin
      makecompass('e')
      if FindObj(x, y, 'ttack', mousecolor, 35) then
       begin
       writeln('found the fight');
      mouse(x,y,3,3,false);
       Chooseoption('ttack');
        boredhuman;
         randommovement;
        sleepandmovemouse(5000+random(1000))
       if(infight)then
      begin
     repeat
     writeln('Not done with fight, repeating until its done');
      boredhuman;
        randommovement;
         sleepandmovemouse(5000+random(1000));
        until not(infight)
        if not (infight) then
        writeln('done with fight');
        kill:=kill+1
      end;
     end;
    end;
    
    
    procedure proggy;
    begin
    writeln('Killed aprroximitely ' + inttostr(kill));
    writeln('ran for '+ (timerunning));
    writeln('Junkjs Lumbridge Rat Killer');
    writeln('end of the script');
    end;
    
    procedure death;
    begin
    if(finddead)then
    logout;
    proggy;
    Writeln('you died')
    terminatescript;
    end;
    
    begin;
    setupsrl;
    cleardebug;
    activateclient;
    repeat
    clickkiller;
    EatFood;
    finddead;
    until(kill=howmanykills)
    if(kill=howmanykills)then
    logout;
    proggy;
    terminatescript;
    end.

  2. #2
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't know what you are talking about with declareplayers? You aren't even using it in your script.

    In ClickKiller, once you have it click to attack the monster, it does like over 10 seconds of anti ban, then it checks if in fight. If you had already killed the monster by this time, you wouldn't be in a fight, and it would never increment kills (which is why the script doesn't stop after 10).

    I don't see where you called FindNormalRandoms either =/

    But a few notes:

    -Make sure that you put a begin end after an if/then if you are doing more than one statement. You are very inconsistent with this throughout your script.

    -In the main loop, you have until(kill = howmanykills); it should be until(kills >= howmanykills) just to be safe. This will insure that the script does not go too far over the amount of kills the user wanted to do if it skipped this or something.

    -under that, you have

    SCAR Code:
    if(kill=howmanykills)then
      begin
        logout;
        proggy;
        terminatescript;
      end;

    kill is already going to = howmanykills because that was the only way it would have broken out of the loop above that. all that's needed there is

    SCAR Code:
    logout;
        proggy;
        terminatescript;

    No if then because it will always be true here. Notice though that if you did need the if then, I put a begin end there (because you were doing more than one statement, you were doing 3).

    Your antiban stuff should also never be in the same place every time like that or else it becomes unhuman. Try a procedure like:

    SCAR Code:
    procedure AntiBanz;
    begin
      case random(10) of
        0: BoredHuman;
        1: SleepAndMoveMouse(5000+random(1000));
        2: RandomRClick;
      end;
    end;

    If you don't know cases you should read about them in a tutorial.

    I fixed some begin/ends in the script (like in the death procedure) and fixed your standards up a bit. Learning proper indentation would make it much easier for people to read through your code and help you out next time:

    SCAR Code:
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    ///////////////////////////////////////////////////////////////////
    //                            JUNK's LRK
    //bitmap eating procedure           infight to keep fighting if not done
    //antirandoms                       cooked meat eater(sorry)
    //failsafes                         small const, big result
    //////////////////////////////V1.00////////////////////////////////


    program LRK;
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}

    Var
    x,y,foodbmp,kill :integer;
    /////////////////////fill this in/////////////////////////////////////////////
    const
    mousecolor= 4013378;// your mouse color
    eat= true; //Cooked meat can only be eaten thanks to jad(boolean)
             //cook raw beef from a cow and get Cook it to get cooked meat
    howmanykills= 10; //how many do you want to kill
    //////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////dont touch the rest
    procedure EatFood;    // thanks to marpis
    begin
      foodbmp := BitmapFromString(13, 12, 'beNpzMpoV7zEpyqU/0rnWV' +
           '2BAENBqZERdZbhUEmkaJagn3KkxwGZqjCseK7pCHer8rEs9zBal+A' +
           'AjAqvi9mB7oDkQZSsz/Zek+cIVQyIOiIDmAJW1BNlV+1hmAwB9+ZV' +
           'I');
      if(hppercent<20)then //thanks to marpis again
      begin
        if(eat=true)then
        begin
          Writeln('said yes to eat.');
          GameTab(tab_Inv);
          wait(100+random(20));
          if (FindBitmapToleranceIn(foodbmp, x, y, MIX1, MIY1, MIX2, MIY2, 20)) then
          begin
            Mouse(x, y, 2, 2, true);
            freebitmap(foodbmp);
            writeln('Ate food successfully!');
            wait(1500+random(200));
          end else
           if not(FindBitmapToleranceIn(foodbmp, x, y, MIX1, MIY1, MIX2, MIY2, 20))then
             writeln('Could not find food');
        end else
          if (eat = false )then
            Writeln('Said no to eat');
      end;
    end;


    Procedure clickkiller;
    begin
      makecompass('e')
      if FindObj(x, y, 'ttack', mousecolor, 35) then
      begin
        writeln('found the fight');
        mouse(x,y,3,3,false);
        Chooseoption('ttack');
        boredhuman;
        randommovement;
        sleepandmovemouse(5000+random(1000))
        if(infight)then
        begin
          repeat
            writeln('Not done with fight, repeating until its done');
            boredhuman;
            randommovement;
            sleepandmovemouse(5000+random(1000));
          until not(infight)
          if not (infight) then
          writeln('done with fight');
          kill:=kill+1
        end;
      end;
    end;


    procedure proggy;
    begin
      writeln('Killed aprroximitely ' + inttostr(kill));
      writeln('ran for '+ (timerunning));
      writeln('Junkjs Lumbridge Rat Killer');
      writeln('end of the script');
    end;

    procedure death;
    begin
      if(finddead)then
      begin //need begin end here
        logout;
        proggy;
        Writeln('you died')
        terminatescript;
      end;
    end;

    begin;
      setupsrl;
      cleardebug;
      activateclient;
      repeat
        clickkiller;
        EatFood;
        finddead;
      until(kill=howmanykills)
      if(kill=howmanykills)then
      begin
        logout;
        proggy;
        terminatescript;
      end;
    end.

    Proper indentation is for the most part:
    -2 spaces for all code after a begin or repeat
    -untils and ends go backwards 2 spaces as well as everything that follows.


    Sorry for this post being so long. It's good to see you trying to learn to script though! If you need any more help I'm on msn a lot:

    runescapemacro@hotmail.com

  3. #3
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    It does compile with both in the script. But doesn't work when its running.
    And it was the wrong script, that was 1.0 this is 2.0

    Script-
    Code:
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    //JUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRKJUNKJ LRK
    ///////////////////////////////////////////////////////////////////
    //                            JUNK's LRK
    //bitmap eating procedure           infight to keep fighting if not done
    //antirandoms                       cooked meat eater(sorry)
    //failsafes                         small const, big result
    //////////////////////////////V1.00////////////////////////////////
    
    
    program LRK;
    {.include SRL\SRL\misc\SMART.SCAR}
    {.include srl/srl.scar}
    {.include srl/srl/skill/fighting.scar}
    
    Var
    x,y,foodbmp,kill :integer;
    /////////////////////fill this in/////////////////////////////////////////////
    const
    mousecolor= 4013378;// your mouse color
    eat= true; //Cooked meat can only be eaten thanks to jad(boolean)
             //cook raw beef from a cow and get Cook it to get cooked meat
    howmanykills= 10; //how many do you want to kill
    
    procedure DeclarePlayers;
    begin
      HowManyPlayers:= 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name    := 'farflafa';
      Players[0].Pass    := 'moochie1';
      Players[0].Nick    := 'arfl';
      Players[0].Active  := True;
    end;
    //////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////dont touch the rest
    procedure EatFood;    // thanks to marpis
    begin
        foodbmp := BitmapFromString(13, 12, 'beNpzMpoV7zEpyqU/0rnWV' +
           '2BAENBqZERdZbhUEmkaJagn3KkxwGZqjCseK7pCHer8rEs9zBal+A' +
           'AjAqvi9mB7oDkQZSsz/Zek+cIVQyIOiIDmAJW1BNlV+1hmAwB9+ZV' +
           'I');
           if(hppercent<20)then //thanks to marpis again
           begin
           if(eat=true)then
           begin
           Writeln('said yes to eat.');
         GameTab(tab_Inv);
        wait(100+random(20));
       if (FindBitmapToleranceIn(foodbmp, x, y, MIX1, MIY1, MIX2, MIY2, 20)) then
      begin
        Mouse(x, y, 2, 2, true);
        freebitmap(foodbmp);
         writeln('Ate food successfully!');
          wait(1500+random(200));
          end
           else
         if not(FindBitmapToleranceIn(foodbmp, x, y, MIX1, MIY1, MIX2, MIY2, 20))then
        writeln('Could not find food');
        end
       else
       if (eat = false )then
       begin
       Writeln('Said no to eat');
       exit;
       end;
      end;
     end;
    
    
    Procedure clickkiller;
     begin
      makecompass('e')
      if FindObj(x, y, 'ttack', mousecolor, 35) then
       begin
       writeln('found the fight');
      mouse(x,y,3,3,false);
       Chooseoption('ttack');
        boredhuman;
         randommovement;
        sleepandmovemouse(5000+random(1000))
       if(infight)then
      begin
     repeat
     writeln('Not done with fight, repeating until its done');
      boredhuman;
        randommovement;
         sleepandmovemouse(5000+random(1000));
        until not(infight)
        if not (infight) then
        writeln('done with fight');
        kill:=kill+1
      end;
     end;
    end;
    
    
    procedure proggy;
    begin
     writeln('Killed aprroximitely ' + inttostr(kill));
      writeln('ran for '+ (timerunning));
      writeln('Junkjs Lumbridge Rat Killer');
     writeln('end of the script');
    end;
    
    procedure death;
    begin
     if(finddead)then
     begin;
      logout;
       proggy;
      Writeln('you died')
      terminatescript;
     end;
    end;
    
    begin;
      setupsrl;
      DeclarePlayers;
      cleardebug;
      activateclient;
       repeat
      Findnormalrandoms;
      clickkiller;
      EatFood;
      finddead;
       until(kill=howmanykills)
       if(kill=howmanykills)then
      logout;
      proggy;
     terminatescript;
    end.

  4. #4
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You left the password in the script, changed and pmed.

    ~Sandstorm

  5. #5
    Join Date
    May 2008
    Location
    Oregon, USA
    Posts
    154
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    for how many kills change it from something like if (kills=HowManyKills) then
    to If (Kills > HowManyKills) then

  6. #6
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    I prefer If(Kills>= HowManyKills) then, but doesn't matter. As for DeclarePlayers help, do you mean, how do you add it? I just copy mine from each script to the next, since it's pretty much always the same, just how many players you put in scripts is different, all you gotta do is delete or add how many you want there to be. Here's an example of one with 5 players:

    Code:
      HowManyPlayers := 5;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
    
      Players[0].Name :='Username';  //RS account name
      Players[0].Pass :='Password';   //Rs Password
      Players[0].Nick :='sern';          //3-4 LETTERS from name without spaces/capitals
      Players[0].Active := True;
      
      Players[1].Name :='';
      Players[1].Pass :='';
      Players[1].Nick :='';
      Players[1].Active := True;
      
      Players[2].Name :='';
      Players[2].Pass :='';
      Players[2].Nick :='';
      Players[2].Active := True;
      
      Players[3].Name :='';
      Players[3].Pass :='';
      Players[3].Nick :='';
      Players[3].Active := True;
      
      Players[4].Name :='';
      Players[4].Pass :='';
      Players[4].Nick :='';
      Players[4].Active := True;

    to add players just copy the four lines that says Players[4] and past it below it, and switch the fours to fives, and change HowManyPlayers to the highest Players number -1.

    to take out players just delete however many and change HowManyPlayers accordingly, not sure if you still needed this help, I breezed through thread quickly, but here's the help whether you need it or not.


    EDIT:
    *** IMPORTANT ***

    you free your food bitmap too soon, after you free it, you have, if(not(FindBitmapToleranceIn....

    and also, you only free it if you find it... put it in a better spot, like in the mainloop right after EatFood, or in a procedure named ScriptTerminate, since that is called whenever a script ends.
    Last edited by Baked0420; 08-16-2009 at 02:10 PM.

  7. #7
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    When i ran the script i get our range in line 876 with findnormalrandoms; and declareplayers never logged in went to points on the screen and kept repeating.

  8. #8
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    I should use:

    SCAR Code:
    procedure MainLoop;
    begin
      repeat
        Findnormalrandoms;
        clickkiller;
        EatFood;
        finddead;
      until(kill >= howmanykills)
    end;

    SCAR Code:
    begin;
      cleardebug;
      setupsrl;
      DeclarePlayers;
      activateclient;
      if(not(LoggedIn))then
        LoginPlayer;    //Couldn't find a loginplayer in your script
      MainLoop;
      logout;
      proggy;
      terminatescript;
    end.
    Last edited by masterBB; 08-16-2009 at 11:30 PM.

  9. #9
    Join Date
    Jan 2007
    Posts
    834
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks master, worked fine, so did findnormalrandoms;.

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
  •