Results 1 to 6 of 6

Thread: Boolean problems...

  1. #1
    Join Date
    Oct 2006
    Location
    H0M3
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Boolean problems...

    SCAR Code:
    Procedure HarpoonCheck;

    var
    x,y,BHarpoon:integer;
    EquipmentPresent:Boolean;

    begin
      EquipmentPresent := false;
      BHarpoon := DTMFromString('78DA63F46262603060644006D17E76601A26C' +
           'A180254A38AAA06260B57630B546343404D38508D260135A14035' +
           '1AA86A0A0B3351D5F803D5E8A1AA49F4374751030073AC0621');

      GameTab(5);
      if FindDtm(BHarpoon,x,y,MIX1,MIY1,MIX2,MIY2) then
      begin
        Writeln('Barb-tail Harpoon Detected');
        EquipmentPresent := True;
        FreeDtm(BHarpoon);
      end else
      Begin
        GameTab(4);
        MMouseItem(1);
        if IsUpText('poon')then
        begin
          WriteLn('Normal Harpoon Detected');
          EquipmentPresent := True;
        end else
        if (EquipmentPresent = False) then
        WriteLn('Harpoon Not Found');
      end;
    if EquipmentPresent then
    begin
    writeln('Equipment found');
    end else  writeln('Equipment Not found');
    end;

    Procedure LobsterPotCheck;

    var
    LobsterPot:Integer;

    Begin
      EquipmentPresent := false;
      LobsterPot := DTMFromString('78DA637461626078CA8002525D79197880342' +
                  '310FF0702463BA09A1B0C6880118904D2BE4035B709A8F102AA79' +
                  '4B408D2350CD47026ACC816A5E1050630154738F0837BF22A0C60' +
                  'AA8E63D0135A030BC895F0D00F5611073');
      GameTab(4);
      if FindDtm(LobsterPot,x,y,MIX1,MIY1,MIX2,MIY2) then
      begin
        Writeln('Lobster Pot Detected');
        EquipmentPresent := True;
        FreeDtm(LobsterPot);
      end else
        begin
          Writeln('Lobster Pot Not Found');
          EquipmentPresent := false;
        end;
    end;

    Procedure EquipmentCheck;
    begin
      if (FishingFor = 'Sharks') then
      begin
        HarpoonCheck;
      end else
          if (FishingFor = 'Lobsters') then
        begin
          LobsterPotcheck;
        end;
       if (EquipmentPresent = false) then
      begin
        Writeln('No Fishing Equipment Detected');
        Writeln('Either that or You spelt Your fish wrong.');
        Writeln('Logging Out');
        Logout;
        Writeln('Terminating Script');
        terminatescript;
      end;
    end;


    whats wrong with this?

  2. #2
    Join Date
    Dec 2008
    Location
    In a galaxy far, far away...
    Posts
    584
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    What error do you get..?

  3. #3
    Join Date
    Oct 2006
    Location
    ithurtsithurtsithurtsithurts
    Posts
    2,930
    Mentioned
    7 Post(s)
    Quoted
    135 Post(s)

    Default

    I think I can see your problem. Or at least a problem. You have EquipmentPresent declared as a local variable in the HarpoonCheck procedure, rather than as a global variable. As such, your other procedures can't touch it.

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

    Default

    senrath is right.

    FishingFor hasn't been declared there; that would cause an error unless you declared it above the code you posted (which I'm assuming you did).

  5. #5
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    SCAR Code:
    program Test;
    {.include SRL/SRL/Misc/Smart.scar}
    {.include SRL/SRL.scar}
    var
      EquipmentPresent:Boolean;
      x,y:integer;

    Procedure HarpoonCheck;
    var
    BHarpoon:integer;
    begin
      EquipmentPresent := false;
      BHarpoon := DTMFromString('78DA63F46262603060644006D17E76601A26C' +
           'A180254A38AAA06260B57630B546343404D38508D260135A14035' +
           '1AA86A0A0B3351D5F803D5E8A1AA49F4374751030073AC0621');

      GameTab(5);
      if FindDtm(BHarpoon,x,y,MIX1,MIY1,MIX2,MIY2) then
      begin
        Writeln('Barb-tail Harpoon Detected');
        EquipmentPresent := True;
        FreeDtm(BHarpoon);
      end else
      Begin
        GameTab(4);
        MMouseItem(1);
        if IsUpText('poon')then
        begin
          WriteLn('Normal Harpoon Detected');
          EquipmentPresent := True;
        end else
        if (EquipmentPresent = False) then
        WriteLn('Harpoon Not Found');
      end;
      if EquipmentPresent then
      begin
        writeln('Equipment found');
      end else
      writeln('Equipment Not found');
    end;

    Procedure LobsterPotCheck;

    var
    LobsterPot:Integer;
    Begin
      EquipmentPresent := false;
      LobsterPot := DTMFromString('78DA637461626078CA8002525D79197880342' +
                  '310FF0702463BA09A1B0C6880118904D2BE4035B709A8F102AA79' +
                  '4B408D2350CD47026ACC816A5E1050630154738F0837BF22A0C60' +
                  'AA8E63D0135A030BC895F0D00F5611073');
      GameTab(4);
      if FindDtm(LobsterPot,x,y,MIX1,MIY1,MIX2,MIY2) then
      begin
        Writeln('Lobster Pot Detected');
        EquipmentPresent := True;
        FreeDtm(LobsterPot);
      end else
        begin
          Writeln('Lobster Pot Not Found');
          EquipmentPresent := false;
        end;
    end;

    Procedure EquipmentCheck;
    begin
      if (FishingFor = 'Sharks') then
      begin
        HarpoonCheck;
      end else
          if (FishingFor = 'Lobsters') then
        begin
          LobsterPotcheck;
        end;
       if (EquipmentPresent = false) then
      begin
        Writeln('No Fishing Equipment Detected');
        Writeln('Either that or You spelt Your fish wrong.');
        Writeln('Logging Out');
        Logout;
        Writeln('Terminating Script');
        terminatescript;
      end;
    end;

    Fixed. You just declared your Vars in the procedure not globaly.

    and also

    FishingFor:string; aswell you need to add.

  6. #6
    Join Date
    Oct 2006
    Location
    H0M3
    Posts
    142
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    amn all that hassel just for one simple mis position. thank you every one.

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
  •