Results 1 to 3 of 3

Thread: Doesnt do the if function?

  1. #1
    Join Date
    Oct 2006
    Posts
    206
    Mentioned
    2 Post(s)
    Quoted
    45 Post(s)

    Default Doesnt do the if function?

    SCAR Code:
    program BanditsAfker;
    {.include SRL\SRL.scar}
    var
      Antibans :integer;
      GuthanSet: Boolean;


    const
      HpTillBeep = 50; // Hp till guthan  when fighting
      Hptillnormal = 80; // hp till equiping normal

    procedure Guthan1;
    begin

      MouseItem(1,true);
        wait(100);
        MouseItem(2,true);
        wait(100);
        MouseItem(3,true);
        wait(100);
        MouseItem(4,true);
    end;

    procedure normalset;
    begin

      MouseItem(1,true);
        wait(100);
        MouseItem(2,true);
        wait(100);
        MouseItem(3,true);
        wait(100);
        MouseItem(4,true);
        wait(100);
        MouseItem(5,true);
    end;

    procedure mainloop;
    var
      Red:string;
      S:string;
      Green:string;
    begin
      repeat
      if GetMMLevels('hitpoints',Red) < HpTillBeep then
      begin
         if not Guthanset then
         begin
           Guthan1;
           guthanset := true;
         end;


      if GetMMLevels('hitpoints',Green) > HpTillNormal then
      begin
      if guthanset then
      begin
        normalset;
        guthanset := false;
      end;
     end;
    end;
    until(false)
    end;


    begin
      SetupSRL;
      mainloop;
    end.

    strange, huh it looks like if the hp is greater then 80 it reequiped my normal set, but it doesnt do anything?
    it does equip guthan.

  2. #2
    Join Date
    Nov 2007
    Posts
    437
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Because you just declared the Boolean Guthanset but you never set it equal to anything, therefore SCAr makes it false. and then you say if guthan set then, well guthanset is false so nothing happens.

  3. #3
    Join Date
    Jun 2007
    Location
    Wednesday
    Posts
    2,446
    Mentioned
    3 Post(s)
    Quoted
    1 Post(s)

    Default

    Try fixing up the standards a bit - may help with the problem:
    SCAR Code:
    procedure mainloop;
    var
      Red:string;
      S:string;
      Green:string;
    begin
      repeat
        if GetMMLevels('hitpoints',Red) < HpTillBeep then
        begin
          if not Guthanset then
          begin
            Guthan1;
            guthanset := true;
          end;

          if GetMMLevels('hitpoints',Green) > HpTillNormal then
          begin
            if guthanset then
            begin
              normalset;
              guthanset := false;
            end;
          end;
        end;
      until(false)
    end;

    You placed an end in the wrong place, thus causing it to run not as intended, so instead try using:

    SCAR Code:
    procedure mainloop;
    var
      Red:string;
      S:string;
      Green:string;
    begin
      repeat
        if GetMMLevels('hitpoints',Red) < HpTillBeep then
        begin
          if not Guthanset then
          begin
            Guthan1;
            guthanset := true;
          end;
        end;

        if GetMMLevels('hitpoints',Green) > HpTillNormal then
        begin
          if guthanset then
          begin
            normalset;
            guthanset := false;
          end;
        end;
      until(false)
    end;
    By reading this signature you agree that mixster is superior to you in each and every way except the bad ways but including the really bad ways.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Why doesnt this walk?
    By Torrent of Flame in forum OSR Help
    Replies: 6
    Last Post: 01-18-2009, 07:13 PM
  2. doesnt compile
    By ShowerThoughts in forum OSR Help
    Replies: 3
    Last Post: 09-09-2007, 09:30 PM
  3. A function doesnt work in new version of scar
    By fastler in forum OSR Help
    Replies: 3
    Last Post: 04-27-2007, 03:02 PM
  4. Why doesnt it work
    By 3Garrett3 in forum OSR Help
    Replies: 1
    Last Post: 03-12-2007, 10:55 PM

Posting Permissions

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