Results 1 to 15 of 15

Thread: How can i write this shorter?

  1. #1
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default How can i write this shorter?

    Hello everybody,

    At the moment i'm pretty stuck. I made this procedure:

    Simba Code:
    procedure FightGuards;
    var x, y, Guard1, Guard2, Guard3, Guard4, Guard5, Guard6, Guard7, Guard8, Guard9: Integer;
        TPA: TPointArray;
    begin
      Writeln('Looking for a Guard');
      Guard1 := DTMFromString('mlwAAAHicY2dgYHgPxF+B+A0UvwPiT0D8AYhnA/ECIJ4PxDOAeDKSmL6qFIO9sQyDp5sbw4S8QIY6XXWGyLBQBid7ewZ+oDwuzIgHQwEADDEQ+g==');
      Guard2 := DTMFromString('mrAAAAHic42BgYPgKxH+B+BeU/RGI3wPxFyD+DsSOUOwKxO5A7ALE9kBsDcS2QFxWWMjgbinPEB0RzuBkb8/g6ebGEOSkyhDgoMtgpafAwA9Ugw8zEsAwAAAPcRDS');
      Guard3 := DTMFromString('mrAAAAHic42BgYMhmZGBIAeIMIM4B4mQoOx+Ii4CYC4iFgFgYiAWBmAeI2YCYFYg5gThPXYnB3NSUIchJFYxtbJQY7I2VGaq01RjcLTUY+IF24MOMBDAMAAA6aQm0');
      Guard4 := DTMFromString('mwQAAAHic42RgYLBnZGAwA2JrIHYAYjcoGyTuAsROQLwLqG4PEO+H4n1AvB2INwPxVgaIvLudBkOAhwpDXnYmg7uLC4O3ixKDlbECg7eTFkNGvBtDhqkCAz9QHSHMSASGAwAEJBCd');
      Guard5 := DTMFromString('mrAAAAHic42BgYLBnZGCwAGIbIHYEYhcgtgZiWyB2AuIZQDVzgXgeEM8B4plAPBWIJ0JpJyNZBk8LcYbQwECGgpxshsiwUAZPcwWGTlkRhkhnDQZ+oBp8mJEAhgEA3WkNzw==');
      Guard6 := DTMFromString('mlwAAAHicY2dgYGBkBBEMDKxQzALE/4FC/4A4FIi9gNgHiAOBOByII4A4CIijI8IZwp3UGYLsVBn8rJUZcjIyGKLdZBg8zRUY+IHyuDAjHgwFANJSCoo=');
      Guard7 := DTMFromString('m6wAAAHic42ZgYDgExCeB+BQQHwbiPUC8G4j3QTFI/igUVwJxORDXAnEdFFcAcTEQ5wFxDhDnA3EZEAf4+jIEeaky6GuJMpgYGzHoqAsz+LkpM5joyTK422kw1DmoMwS46zKs6k9g4AeqJxYzkoCRAABMPBZj');
      Guard8 := DTMFromString('mwQAAAHicjcqxCkAAAIThM5qMlA0pUooNJaOUvAEDipS8jGRA8qBukJWrr1t+EUArACU1VFFPE43UUU07u40uOp8/aKWZFop9HUViwHNdaKoEx7aRRwqyQEYaWhhMDRK7L8IP726ruw8Y');
      Guard9 := DTMFromString('m1gAAAHic42JgYMhjZGDIBOJsIC4E4hIorgDiYkaIPEjOAohtgNgBim2hYqZArA/ExlC2vakyg5GBPoOJsRFDgIsKg5O9PUODowaDn5MOQ56FEoOLpRqDn7cXAz/QbmIwI5EYAQDu9w5/');

      If FindDTM(Guard1, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard2, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard3, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard4, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard5, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard6, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard7, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard8, x, y, MSX1, MSY1, MSX2, MSY2) then
       begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end else If FindDTM(Guard9, x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)
      end;
      FreeDTM(Guard1);
      FreeDTM(Guard2);
      FreeDTM(Guard3);
      FreeDTM(Guard4);
      FreeDTM(Guard5);
      FreeDTM(Guard6);
      FreeDTM(Guard7);
      FreeDTM(Guard8);
      FreeDTM(Guard9);
    end;

    So as you can see this a really long code. Now what i want to do is replace this piece of code:

    Simba Code:
    Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
            end;
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn)

    Now i know i have to do something with functions, but i haven't been scripting for a while and i don't know how to shorten this. I would really appreciate the help!

    Greetz
    07Scripter
    I mostly write private scripts

  2. #2
    Join Date
    Sep 2007
    Location
    British Columbia, Canada
    Posts
    4,047
    Mentioned
    1 Post(s)
    Quoted
    2 Post(s)

    Default

    If this is for runescape, you can just use color finding instead of DTM

    Skim through
    This thread
    http://villavu.com/forum/showthread.php?t=21786
    and this thread (Read from TPAtoATPAEx, you will be confused at first, and then it will come to life to you how easy this is)
    http://villavu.com/forum/showthread.php?t=49067

  3. #3
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    multiple similar variables should be put into an array (:
    Would you like me to just edit it or do you wanna? DTM's i suggest making into an array so you can do "for i:= 0 to high(DTMs) do freeDTM(DTMs[i]);" (no quotes)
    quite a few other ways to shorten everything. But that's up to you.

    I wouldn't use DTM's at all but rather TPA's and ATPA's and splitting n splicing (:

  4. #4
    Join Date
    Oct 2006
    Location
    finland, helsinki
    Posts
    2,501
    Mentioned
    3 Post(s)
    Quoted
    2 Post(s)

    Default

    Simba Code:
    Guard[0] := DTMFROMSTRING('asdasdasdad')
    Guard[1] := DTMFROMSTRING('asdasdasdad')
    Guard[2] := DTMFROMSTRING('asdasdasdad')
    Guard[3] := DTMFROMSTRING('asdasdasdad')
    Guard[4] := DTMFROMSTRING('asdasdasdad')
    Guard[5] := DTMFROMSTRING('asdasdasdad')
    Guard[6] := DTMFROMSTRING('asdasdasdad')

    for i:= 0 to 6 do
    begin
      if finddtm( Guard[i]{important part i increases + 1 every time}, blablabla)then
      begin
        //here just fight enemy remember to "BREAK;" when you have found enemy and clicked
      end;
      //last do this
      for i:= 0 to 6 do
        FreeDTM(Guard[1]);

    Guard is a "array of Integer" or "array [0..6] of Integer;"

    Guard[0]

    you can loop throught them and store valuable information

    Code:
    • Narcle: I recall Jukka releasing a bunch of scripts like this before... Its how he rolls I think. rofl
    • Solarwind: Dude, you are like... t3h s3x.
    • Hy71194: JuKKa you're a machine! You released 3 scripts in 10 minutes! :O
    • benjaa: woah.... Jukka is the man Guildminer pwns all
    • NaumanAkhlaQ: And JuKKa Is my Her0!

  5. #5
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    multiple similar variables should be put into an array (:
    Would you like me to just edit it or do you wanna? DTM's i suggest making into an array so you can do "for i:= 0 to high(DTMs) do freeDTM(DTMs[i]);" (no quotes)
    quite a few other ways to shorten everything. But that's up to you.

    I wouldn't use DTM's at all but rather TPA's and ATPA's and splitting n splicing (:
    Thanks for the fast respons!

    Quote Originally Posted by JuKKa View Post
    Simba Code:
    Guard[0] := DTMFROMSTRING('asdasdasdad')
    Guard[1] := DTMFROMSTRING('asdasdasdad')
    Guard[2] := DTMFROMSTRING('asdasdasdad')
    Guard[3] := DTMFROMSTRING('asdasdasdad')
    Guard[4] := DTMFROMSTRING('asdasdasdad')
    Guard[5] := DTMFROMSTRING('asdasdasdad')
    Guard[6] := DTMFROMSTRING('asdasdasdad')

    for i:= 0 to 6 do
    begin
      if finddtm( Guard[i]{important part i increases + 1 every time}, blablabla)then
      begin
        //here just fight enemy remember to "BREAK;" when you have found enemy and clicked
      end;
      //last do this
      for i:= 0 to 6 do
        FreeDTM(Guard[1]);

    Guard is a "array of Integer" or "array [0..6] of Integer;"

    Guard[0]

    you can loop throught them and store valuable information
    Thanks for the fast response and help! You helped me out a lot here
    07Scripter
    I mostly write private scripts

  6. #6
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    I'm not sure your logic for your loops is right but... I didn't want to change it so I simply edited what you had to this:
    Simba Code:
    function FindGuard(var x, y: integer): boolean;
    var
      GuardDTM: TStringArray;
      GuardDTMS: TIntegerArray;
      i, xs, xy: integer;
    begin
      GuardDTM := ['mlwAAAHicY2dgYHgPxF+B+A0UvwPiT0D8AYhnA/ECIJ4PxDOAeDKSmL6qFIO9sQyDp5sbw4S8QIY6XXWGyLBQBid7ewZ+oDwuzIgHQwEADDEQ+g==',
        'mrAAAAHic42BgYPgKxH+B+BeU/RGI3wPxFyD+DsSOUOwKxO5A7ALE9kBsDcS2QFxWWMjgbinPEB0RzuBkb8/g6ebGEOSkyhDgoMtgpafAwA9Ugw8zEsAwAAAPcRDS',
        'mrAAAAHic42BgYMhmZGBIAeIMIM4B4mQoOx+Ii4CYC4iFgFgYiAWBmAeI2YCYFYg5gThPXYnB3NSUIchJFYxtbJQY7I2VGaq01RjcLTUY+IF24MOMBDAMAAA6aQm0',
        'mwQAAAHic42RgYLBnZGAwA2JrIHYAYjcoGyTuAsROQLwLqG4PEO+H4n1AvB2INwPxVgaIvLudBkOAhwpDXnYmg7uLC4O3ixKDlbECg7eTFkNGvBtDhqkCAz9QHSHMSASGAwAEJBCd',
        'mrAAAAHic42BgYLBnZGCwAGIbIHYEYhcgtgZiWyB2AuIZQDVzgXgeEM8B4plAPBWIJ0JpJyNZBk8LcYbQwECGgpxshsiwUAZPcwWGTlkRhkhnDQZ+oBp8mJEAhgEA3WkNzw==',
        'mlwAAAHicY2dgYGBkBBEMDKxQzALE/4FC/4A4FIi9gNgHiAOBOByII4A4CIijI8IZwp3UGYLsVBn8rJUZcjIyGKLdZBg8zRUY+IHyuDAjHgwFANJSCoo=',
        'm6wAAAHic42ZgYDgExCeB+BQQHwbiPUC8G4j3QTFI/igUVwJxORDXAnEdFFcAcTEQ5wFxDhDnA3EZEAf4+jIEeaky6GuJMpgYGzHoqAsz+LkpM5joyTK422kw1DmoMwS46zKs6k9g4AeqJxYzkoCRAABMPBZj',
        'mwQAAAHicjcqxCkAAAIThM5qMlA0pUooNJaOUvAEDipS8jGRA8qBukJWrr1t+EUArACU1VFFPE43UUU07u40uOp8/aKWZFop9HUViwHNdaKoEx7aRRwqyQEYaWhhMDRK7L8IP726ruw8Y',
        'm1gAAAHic42JgYMhjZGDIBOJsIC4E4hIorgDiYkaIPEjOAohtgNgBim2hYqZArA/ExlC2vakyg5GBPoOJsRFDgIsKg5O9PUODowaDn5MOQ56FEoOLpRqDn7cXAz/QbmIwI5EYAQDu9w5/'];
      for i := 0 to high(GuardDTM) do GuardDTMS[i] := DTMFromString(GuardDTM[i]);

      for i := 0 to high(GuardDTMS) do
      begin
        if FindDTM(GuardDTMS[i], x, y, MSX1, MSY1, MSX2, MSY2) then break;
      end;
      result := (x <> 0) and (y <> 0);
      for i := 0 to high(GuardDTMS) do FreeDTM(GuardDTMS[i]);
    end;

    procedure FightGuards;
    var
      x, y: integer;
    begin
      Writeln('Looking for a Guard');
      if FindGuard(x, y) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
            0: begin Mouse(x,y,0,0,false); WaitOption('ttac', 300); end;
            1: Mouse(x,y,0,0,true);
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn);
      end else
      begin
        Writeln('No Guards :(');
      end;
    end;

    Should work and is 75% shorter
    IMO i think it's better then Jukka's
    Last edited by footballjds; 02-16-2012 at 11:13 PM.

  7. #7
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    I'm not sure your logic for your loops is right but... I didn't want to change it so I simply edited what you had to this:
    Simba Code:
    function FindGuard(var x, y: integer): boolean;
    var
      GuardDTM: TStringArray;
      GuardDTMS: TIntegerArray;
      i, xs, xy: integer;
    begin
      GuardDTM := ['mlwAAAHicY2dgYHgPxF+B+A0UvwPiT0D8AYhnA/ECIJ4PxDOAeDKSmL6qFIO9sQyDp5sbw4S8QIY6XXWGyLBQBid7ewZ+oDwuzIgHQwEADDEQ+g==',
        'mrAAAAHic42BgYPgKxH+B+BeU/RGI3wPxFyD+DsSOUOwKxO5A7ALE9kBsDcS2QFxWWMjgbinPEB0RzuBkb8/g6ebGEOSkyhDgoMtgpafAwA9Ugw8zEsAwAAAPcRDS',
        'mrAAAAHic42BgYMhmZGBIAeIMIM4B4mQoOx+Ii4CYC4iFgFgYiAWBmAeI2YCYFYg5gThPXYnB3NSUIchJFYxtbJQY7I2VGaq01RjcLTUY+IF24MOMBDAMAAA6aQm0',
        'mwQAAAHic42RgYLBnZGAwA2JrIHYAYjcoGyTuAsROQLwLqG4PEO+H4n1AvB2INwPxVgaIvLudBkOAhwpDXnYmg7uLC4O3ixKDlbECg7eTFkNGvBtDhqkCAz9QHSHMSASGAwAEJBCd',
        'mrAAAAHic42BgYLBnZGCwAGIbIHYEYhcgtgZiWyB2AuIZQDVzgXgeEM8B4plAPBWIJ0JpJyNZBk8LcYbQwECGgpxshsiwUAZPcwWGTlkRhkhnDQZ+oBp8mJEAhgEA3WkNzw==',
        'mlwAAAHicY2dgYGBkBBEMDKxQzALE/4FC/4A4FIi9gNgHiAOBOByII4A4CIijI8IZwp3UGYLsVBn8rJUZcjIyGKLdZBg8zRUY+IHyuDAjHgwFANJSCoo=',
        'm6wAAAHic42ZgYDgExCeB+BQQHwbiPUC8G4j3QTFI/igUVwJxORDXAnEdFFcAcTEQ5wFxDhDnA3EZEAf4+jIEeaky6GuJMpgYGzHoqAsz+LkpM5joyTK422kw1DmoMwS46zKs6k9g4AeqJxYzkoCRAABMPBZj',
        'mwQAAAHicjcqxCkAAAIThM5qMlA0pUooNJaOUvAEDipS8jGRA8qBukJWrr1t+EUArACU1VFFPE43UUU07u40uOp8/aKWZFop9HUViwHNdaKoEx7aRRwqyQEYaWhhMDRK7L8IP726ruw8Y',
        'm1gAAAHic42JgYMhjZGDIBOJsIC4E4hIorgDiYkaIPEjOAohtgNgBim2hYqZArA/ExlC2vakyg5GBPoOJsRFDgIsKg5O9PUODowaDn5MOQ56FEoOLpRqDn7cXAz/QbmIwI5EYAQDu9w5/'];
      for i := 0 to high(GuardDTM) do GuardDTMS[i] := DTMFromString(GuardDTM[i]);

      for i := 0 to high(GuardDTMS) do
      begin
        if FindDTM(GuardDTMS[i], x, y, MSX1, MSY1, MSX2, MSY2) then break;
      end;
      result := (x <> 0) and (y <> 0);
      for i := 0 to high(GuardDTMS) do FreeDTM(GuardDTMS[i]);
    end;

    procedure FightGuards;
    var
      x, y: integer;
    begin
      Writeln('Looking for a Guard');
      if FindGuard(x, y) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
            0: begin Mouse(x,y,0,0,false); WaitOption('ttac', 300); end;
            1: Mouse(x,y,0,0,true);
          end;
        until (not InFight) or (not OthersInFight) or (not LoggedIn);
      end else
      begin
        Writeln('No Guards :(');
      end;
    end;

    Should work and is 75% shorter
    IMO i think it's better then Jukka's
    Hmmm seems interesting too Well as i sais before i'm not a really experienced scripter right now and also didn't script for like a month, because i couldn't really find any motivation Also i made this structure in 10 minutes so ofcourse it could use some improvement The code that is use at the moment is:

    Simba Code:
    procedure FightGuards;
    var x, y, i: Integer;
        TPA: TPointArray;
        Guard: Array [0..8] of Integer;
    begin
      Writeln('Looking for a Guard');
      Guard[0] := DTMFromString('mlwAAAHicY2dgYHgPxF+B+A0UvwPiT0D8AYhnA/ECIJ4PxDOAeDKSmL6qFIO9sQyDp5sbw4S8QIY6XXWGyLBQBid7ewZ+oDwuzIgHQwEADDEQ+g==');
      Guard[1] := DTMFromString('mrAAAAHic42BgYPgKxH+B+BeU/RGI3wPxFyD+DsSOUOwKxO5A7ALE9kBsDcS2QFxWWMjgbinPEB0RzuBkb8/g6ebGEOSkyhDgoMtgpafAwA9Ugw8zEsAwAAAPcRDS');
      Guard[2] := DTMFromString('mrAAAAHic42BgYMhmZGBIAeIMIM4B4mQoOx+Ii4CYC4iFgFgYiAWBmAeI2YCYFYg5gThPXYnB3NSUIchJFYxtbJQY7I2VGaq01RjcLTUY+IF24MOMBDAMAAA6aQm0');
      Guard[3] := DTMFromString('mwQAAAHic42RgYLBnZGAwA2JrIHYAYjcoGyTuAsROQLwLqG4PEO+H4n1AvB2INwPxVgaIvLudBkOAhwpDXnYmg7uLC4O3ixKDlbECg7eTFkNGvBtDhqkCAz9QHSHMSASGAwAEJBCd');
      Guard[4] := DTMFromString('mrAAAAHic42BgYLBnZGCwAGIbIHYEYhcgtgZiWyB2AuIZQDVzgXgeEM8B4plAPBWIJ0JpJyNZBk8LcYbQwECGgpxshsiwUAZPcwWGTlkRhkhnDQZ+oBp8mJEAhgEA3WkNzw==');
      Guard[5] := DTMFromString('mlwAAAHicY2dgYGBkBBEMDKxQzALE/4FC/4A4FIi9gNgHiAOBOByII4A4CIijI8IZwp3UGYLsVBn8rJUZcjIyGKLdZBg8zRUY+IHyuDAjHgwFANJSCoo=');
      Guard[6] := DTMFromString('m6wAAAHic42ZgYDgExCeB+BQQHwbiPUC8G4j3QTFI/igUVwJxORDXAnEdFFcAcTEQ5wFxDhDnA3EZEAf4+jIEeaky6GuJMpgYGzHoqAsz+LkpM5joyTK422kw1DmoMwS46zKs6k9g4AeqJxYzkoCRAABMPBZj');
      Guard[7] := DTMFromString('mwQAAAHicjcqxCkAAAIThM5qMlA0pUooNJaOUvAEDipS8jGRA8qBukJWrr1t+EUArACU1VFFPE43UUU07u40uOp8/aKWZFop9HUViwHNdaKoEx7aRRwqyQEYaWhhMDRK7L8IP726ruw8Y');
      Guard[8] := DTMFromString('m1gAAAHic42JgYMhjZGDIBOJsIC4E4hIorgDiYkaIPEjOAohtgNgBim2hYqZArA/ExlC2vakyg5GBPoOJsRFDgIsKg5O9PUODowaDn5MOQ56FEoOLpRqDn7cXAz/QbmIwI5EYAQDu9w5/');

      for i:= 0 to 6 do
      If FindDTM(Guard[i], x, y, MSX1, MSY1, MSX2, MSY2) then
      begin
        Writeln('Guard found KILL IT!');
        MMouse(x,y,0,0);
        Wait(50 + (random(50)));
        repeat
          Wait(50 + random(50));
          case Random(2) of
          0:
            begin
              Mouse(x,y,0,0,false);
              ChooseOption('ttac');
              Writeln('Derpin it like a baws');
              Wait(5000 + Random(1000));
            end;
          1:
            Begin
              Mouse(x,y,0,0,true);
              Writeln('Derpin it like a baws');
              Wait(5000 + Random(1000));
            end;
          end;
        until (InFight) or (not OthersInFight) or (not LoggedIn)
      end;
      FreeDTM(Guard[0]);
      FreeDTM(Guard[1]);
      FreeDTM(Guard[2]);
      FreeDTM(Guard[3]);
      FreeDTM(Guard[4]);
      FreeDTM(Guard[5]);
      FreeDTM(Guard[6]);
      FreeDTM(Guard[7]);
      FreeDTM(Guard[8]);
    end;

    This works pretty good, but i will seriously consider your edited part
    Thanks!
    07Scripter
    I mostly write private scripts

  8. #8
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    loop through freeing you dtms so its one line instead of 9!!!!

    also, i'm glad you found the logic error and removed the not before InFight haha

  9. #9
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    loop through freeing you dtms so its one line instead of 9!!!!

    also, i'm glad you found the logic error and removed the not before InFight haha
    Do you mean that i should use this?

    Simba Code:
    FreeDTM(Guard[i]);

    And yeah was a stupid mistake :P
    07Scripter
    I mostly write private scripts

  10. #10
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by okokokok View Post
    Do you mean that i should use this?

    Simba Code:
    FreeDTM(Guard[i]);

    And yeah was a stupid mistake :P
    yes, you should do: "For i := 0 to High(Guard) do FreeDTM(Guard[i]);"

  11. #11
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by footballjds View Post
    yes, you should do: "For i := 0 to High(Guard) do FreeDTM(Guard[i]);"
    Thank you very much
    07Scripter
    I mostly write private scripts

  12. #12
    Join Date
    Dec 2011
    Location
    New York, USA
    Posts
    1,242
    Mentioned
    12 Post(s)
    Quoted
    193 Post(s)

    Default

    This script would NEVER work. There are lots of reasons why but The main reason is that a standard DTM can't be used to effectively find something like a guard. The guard would have to be in the EXACT same position as it was when you made the dtm, which is very unlikely.

  13. #13
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    This script would NEVER work. There are lots of reasons why but The main reason is that a standard DTM can't be used to effectively find something like a guard. The guard would have to be in the EXACT same position as it was when you made the dtm, which is very unlikely.
    this is incorrect if the dtm is properly made, let him live.

  14. #14
    Join Date
    Dec 2011
    Location
    Holland
    Posts
    455
    Mentioned
    0 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by Nebula View Post
    This script would NEVER work. There are lots of reasons why but The main reason is that a standard DTM can't be used to effectively find something like a guard. The guard would have to be in the EXACT same position as it was when you made the dtm, which is very unlikely.
    That is why i have 9 different DTM's of the guards. When i have finished my script into the beta stage, i'll make DTM of 16 sides of the guards. This way eventhough they keep walking all the time there will still be one side visible making it possible to detect them pretty fast.
    07Scripter
    I mostly write private scripts

  15. #15
    Join Date
    Feb 2007
    Location
    PA, USA
    Posts
    5,240
    Mentioned
    36 Post(s)
    Quoted
    496 Post(s)

    Default

    Quote Originally Posted by okokokok View Post
    That is why i have 9 different DTM's of the guards. When i have finished my script into the beta stage, i'll make DTM of 16 sides of the guards. This way eventhough they keep walking all the time there will still be one side visible making it possible to detect them pretty fast.
    I really suggest you learning what TPA's can do (:

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
  •