• Log in or sign up for an account here: https://www.sythe.org/login

Help Fixing a script!?

  • Thread starter Thread starter dracody
  • Start date Start date
D

dracody

Guest
I need help fixing a script that was made by metagen, I already did some updates, but the walk hallway isnt working very well,
Would be awsome if any skilled scripter fixes it so it works how it should:p

Code:
program New;
{.include SRL/SRL/Misc/Smart.scar}
{.include srl/srl.scar}
{.include srl\srl\misc\users.scar}
var
x, y, i, misscount, xpcount, Mark, Mark2 : integer;
RoomDTM : integer;
angle : extended;
PickupColors: array of integer;
PickupNames: array of string;

const
DoorX = 238;
DoorY = 157;
text = 'ickety door';
World = 67;
yourSRLID='';
yourSRLPW='';
UseSmart = false;
PickupTol = 3;
Pickup = false;


procedure DeclarePlayers;
begin
  SRLPLayerForm(true, [], ['Food Color', 'Eat Hp', 'Fight Style (1-4)'], ['Food Name', 'Skill To Proggy'], []);
//Custom Pickup
  PickupColors := []; //edit here
  PickupNames  := ['']; //edit here

  { Example:
  PickupColors = [2130543,1035462,4641275]
  PickupNames  = ['rimy','ranarr','rune','oin','rrow','ones']
  }
end;

procedure LoadDTM;
begin
  {RoomDTM := DTMFromString('78DA634C6562600862C00A1861740C504D00A' +
       'ADCF757DF184490D5A400D5C41250530054134C404D16508D277E' +
       '3500A6060F5B');
         RoomDTM := DTMFromString('78DA634C656260B060C00A18617420116ACA8' +
       '06A5409A84903AA8920A0A68D08BB92806A7209A8990954634740' +
       'CD7422CC292342CD2CA09A10026AD2816A94F0AB0100A769086E');}
           RoomDTM := DTMFromString('78DA636C656260F060C0003A8C0C0C40C4F01' +
       'F0818C3806ADC51E523345918E418206A4080311AA8C691809A4C' +
       'A01A57749B18199891D57403D5A81350331FA82688809A7AA09A3' +
       '84C7F21AB010043460ACF');
end;

function EatCheck : boolean;

Var
  color: string;

begin
  if (GetMMLevels('hp', Color) < Players[CurrentPlayer].Integers[1]) then
  begin
    writeln('Eating!!! hehe');
    gametab(4);
    if findcolortolerance(x,y, Players[CurrentPlayer].Integers[0], 552, 209, 729, 460, 5) then
    begin
      MMouse(x,y,0,0);
      wait(150+random(21));
      if isuptext(Players[CurrentPlayer].Strings[0]) then
      begin
        Mouse(x, y, 0, 0, true);
      end else
      begin
        Result := False;
        Exit;
      end;
    end else
    begin
      result := False;
      exit;
    end;
  end;
  result := True;
end;

procedure RoomLogout;
begin
        MakeCompass('S');
        MakeCompass('N');
        SetAngle(True);
        mouse(593,119, 4, 4, true);
        wait(2000);
        mouse(593,119, 4, 4, true);
        wait(random(3000));
        Players[CurrentPlayer].loc := 'Out of food';
        logout;
        exit;
end;


procedure randoms;
begin
  findNormalRandoms;
  findInventoryRandoms;
  findNonInventoryRandoms;
end;


function ScanName(name : string; var cx, cy: integer; Startx, Starty : integer; Down : Boolean) : boolean;  // by me
var
PointX, PointY, PointY2 : integer;
begin
  for PointX:= StartX to StartX + 100 do
  begin
    PointX := PointX + 5;
    for PointY:= StartY to StartY + 60 do
    begin
      PointY := PointY + 20;
      if down = false then
      begin
        PointY2 := 2 * StartY - PointY
      end else
      begin
        PointY2 := PointY - 60
      end;
      mmouse(PointX, PointY2, 0, 0);
      wait(100);
      if(IsUpText(name)) then
      begin
      result := true;
        cx := PointX;
        cy := PointY2;
        exit;
      end;
    end;
  end;
  result := False;
end;


function SecondDoorOpen : boolean;
var
rx : integer;
begin
  mouse(616, 47, 4, 4, true); //walk to door
  fflag(0);
  if ScanName(text, x, y, Doorx, Doory, true) then
  begin
    for i := 1 to 5 do
    begin
      rx := random(10);
      mmouse(x+5+rx, y+5+rx, 0, 0);
      if isuptext(text) then
      begin
        for i := 1 to 60 do
        begin
          if not isuptext(text) then
          begin
            result := true;
            Players[CurrentPlayer].loc := 'Passed second door';
            WriteLn(Players[CurrentPlayer].loc);
            exit;
          end else
          begin
          mouse(x+5+rx, y+5+rx, 0, 0, true);
          wait(2000+random(300));
          end;
        end;
      end;
    end;
  end;
  result := false;
end;

procedure AttemptRecovery;
begin
    makeCompass('W');
    mouse(649,22,0,0,true);
    wait(3000+random(1000));
    SecondDoorOpen;
    makeCompass('E');
end;

procedure WalkHall;
var
  tpa:tpointarray;
begin
  If not loggedin then exit;
  Players[CurrentPlayer].loc := 'Walking Hallway';
  WriteLn(Players[CurrentPlayer].loc);
  radialWalkex(tpa,643, 83, 15199724, 30, 270, 400, 30);
  mouse(x,y,0,0,true);
  wait(200);
  if flagpresent then
  begin
    FindNonInventoryRandoms;
    fflag(0);
    EatCheck;

    radialWalkex(tpa, 643, 83, 15199724, 30, 270, 400, 65);
    mouse(TPA[0].x,TPA[0].y,0,0,true);
    FindNonInventoryRandoms;
    fflag(0);
    EatCheck;

    radialWalkex(tpa,643, 83, 15199724, 30, 210, 150, 60);
    mouse(TPA[0].x,TPA[0].y,0,0,true);
    FindNonInventoryRandoms;
    fflag(0);
    EatCheck;

    radialWalkex(tpa,643, 83, 15199724, 30, 210, 150, 60);
    mouse(TPA[0].x,TPA[0].y,0,0,true);
    FindNonInventoryRandoms;
    fflag(0);

    mouse(325, 464, 4, 4, true); //this is basically a failsafe
    //due to the confined space even if radialwalk misses this will click
    //in the area on the other side of the door and walk u to it.
    wait(1000+random(450));
    
    MakeCompass('N');
        MakeCompass('E');
  end else if i < 3 then
  begin
    i := i + 1;
    SecondDoorOpen;
    WalkHall;
  end;
end;


function FirstDoorOpen : boolean;
var
   rx : integer;
begin
  if ScanName(text, x, y, Doorx, Doory, false) then
  begin
    for i := 1 to 5 do
    begin
      rx := random(10);
      mmouse(x+5+rx, y, 0, 0);
      wait(200+random(100));
      if isuptext(text) then
      begin
        mouse((x+5+rx), y, 0, 0, true);
        result := true;
        wait(3000+random(234));
        exit;
      end;
    end;
  end;
  result := false;
  wait(3000+random(234));
end;



procedure ToFirstDoor;
var
tpa:tpointarray;
begin
  MakeCompass('S');
  MakeCompass('N');
  SetAngle(True);
  mouse(651, 78, 4, 4, true);
  fflag(0);
  makecompass('W');
  radialWalkex(tpa,643, 83, 15199724, 30, 270, 400, 50);
  mouse(TPA[0].x,TPA[0].y,0,0,true);
  fflag(0);
end;


procedure RunDownHall;
begin
  If not loggedin then exit;
  writeln('Walking Down Hall');
  SetRun(true);
  i := 0;
  repeat
    i := i + 1;
    ToFirstDoor;
    Players[CurrentPlayer].loc := 'At First Door';
    wait(500+random(200));
    if i = 3 then
    begin
      writeln('Error, Could not locate first door.');
      logout;
    end;
  Until FirstDoorOpen
  if not EatCheck then
  begin
    Logout;
    Exit;
  end;
  wait(500+random(200));
  if not SecondDoorOpen then //this will most likely NEVER happen.
  begin
    writeln('Second Door Opening Failed');
    AttemptRecovery;
    Exit;
  end;
  Players[CurrentPlayer].loc := 'Start of hallway';
  WriteLn(Players[CurrentPlayer].loc);
  i:= 0;
  WalkHall;
  Players[CurrentPlayer].loc := 'Start of hallway';
  WriteLn(Players[CurrentPlayer].loc);
  FirstDoorOpen;
  Players[CurrentPlayer].loc := 'In between the doors';
  WriteLn(Players[CurrentPlayer].loc);
  Randoms;
  wait(3000+random(500));
  if not EatCheck then
  begin
    Logout;
    Exit;
  end;
  SecondDoorOpen;
  mouse(630, 68, 2, 2, true);
  wait(1000);
  if not flagpresent then
  begin
    SecondDoorOpen;
    mouse(630, 68, 2, 2, true);
    if not flagpresent then
    begin
      SecondDoorOpen;
      mouse(630, 68, 2, 2, true);
      if not flagpresent then logout;
    end;
  end;
  Players[CurrentPlayer].loc := 'In the room';
  WriteLn(Players[CurrentPlayer].loc);
  fflag(0);
end;

procedure RandomTab;
begin
  if random(15) = 1 then
  begin
    gametab(random(random(14))); //causes unevenness in tabs
    if random(9) = 1 then
    begin
      wait(300+random(432));
      gametab(random(random(14))); //causes unevenness in tabs
      wait(random(500));
      gametab(random(random(14))); //causes unevenness in tabs
    end;
    wait2(3000, false);
  end;
end;

procedure Proggy;
var
  i : integer;
begin
writeln(' ');
writeln('<== Fleshy Pounding Carnage Report ==>');
writeln('Total Time: '+TimeRunning);
for i:=0 to getarraylength(players)-1 do
  writeln(Players[i].Name + ': ' + inttostr(Players[i].Integers[4] / 1000 / 60)   + ' Minutes and ' + inttostr((Players[i].Integers[4] / 1000)-((Players[i].Integers[4] / 1000 / 60)*60))+' Seconds -- Location: ' + Players[i].Loc + ' -- XP Gained: ' + inttostr( Players[i].Integers[6] - Players[i].Integers[5]));
writeln('<== End of Report ==>');
writeln(' ');
end;

procedure RoomMiddle;
var
  RoomMark : integer;
begin
  makecompass('N');
  ToFirstDoor;
  mouse(661, 105, 3, 2, true);
  wait(500);
  if not FlagPresent then
  begin
  MarkTime(RoomMark);
    repeat
      if  (TimeFromMark(RoomMark) > 60000) then
      begin
        Roomlogout;
        exit;
      end;
      MakeCompass('E');
      SecondDoorOpen;
      mouse(661, 105, 3, 3, true);
    until (flagpresent)
  end;
  fflag(0);
end;

procedure FindRoomDTM;
begin
  Randoms;
  MakeCompass('N');
  if not FindDtmRotated(RoomDTM, x, y, MMX1, MMY1, MMX2, MMY2, -1, 1, 0.01, angle) then
  begin
    SendArrowwait(1, 100+random(21));
    SendArrowwait(3, 100+random(21));
    MakeCompass('N');
    if not FindDtmRotated(RoomDTM, x, y, MMX1, MMY1, MMX2, MMY2, -1, 1, 0.01, angle) then
    begin
      RoomMiddle;
      Exit;
    end;
  end;
end;

procedure RoomMiddleDTM;
var
  RoomMark : integer;
begin
 if not loggedin then exit;
 FindRoomDTM;
 Mouse(x,y, 1, 1, true);
 If not flagpresent then
 begin
   MarkTime(RoomMark);
   repeat
    if  (TimeFromMark(RoomMark) > 60000) then
    begin
      Roomlogout;
      exit;
    end;
    MakeCompass('E');
    SecondDoorOpen;
    MakeCompass('N');
    FindRoomDTM;
    Mouse(x,y, 1, 1, true);
   until FlagPresent
 end;
end;

function CustomPickup:boolean;
var
 i,x,y,L, x1, y1, x2, y2, LeftCorner, RightCorner:integer;
begin
  for i := 0 to (GetArrayLength(PickupColors)-1) do
  begin
    x:=MSCX;
    y:=MSCY;
    LeftCorner := BitmapFromString(4, 4, 'z78DA33753135313137C5' +
     '411A600064715CEA914500CACE13F0');
    RightCorner := BitmapFromString(4, 4, 'z78DA33753135313137' +
     'C5200D30002E35F8C501C9C013F0');
    if (FindColorSpiralTolerance(x, y, PickupColors[i], MSX1, MSY1, MSX2, MSY2, PickupTol)) then
    begin
      MMouse(x,y,3,3);
      Wait(200+random(50));
      if IsUpText('ake') then
      begin
        Mouse(x, y, 0, 0, False);
        wait(25+random(25));
        L := GetArrayLength(PickupNames)-1;
        for i := 0 to L do
        begin
          if (FindBitmap(LeftCorner, x1, y1)) and (FindBitmap(RightCorner, x2, y2)) then
          begin
            if (FindText(x, y, PickupNames[i], upchars, x1, y1, x2, 502)) then
            begin
              Wait(10);//All because of this...
              Mouse(x + 5, y + 3, Length(PickupNames[i]) * 6, 4, True);
              Result := True;
              Status('Picking up item...');
              WriteLn('Picking up item');
              randoms;
              Flag;
            end;
          end;
        end;
      end;
    end;
  end;
  FreeBitmap(LeftCorner);
  FreeBitmap(RightCorner);
end;

procedure AggressiveCheck;
begin
  setangle(true);
  if findfight then
  begin
    xpcount := 0;
  end else
  begin
    if (Pickup) then CustomPickup;
    xpcount := xpcount + 1;
  end;
  if xpcount = 1 then
    RoomMiddleDTM;
  if xpcount > 3 then
  begin
    Proggy;
    RunDownHall;
    wait(random(2000));
    xpcount := 0;
  end;
end;

procedure StartScript;
begin
  SetupSrl;
  ScriptID:='362';
  if not(yourSRLID = '') then SRLID := yourSRLID;
  if not(yourSRLPW = '') then SRLPassword := yourSRLPW;
  SrlRandomsReport;
  DeclarePlayers;
  if (UseSmart) then
   begin
    WriteLn('Loading S.M.A.R.T ...');
    {(world, high/low detail? , signed?}
    SmartSetupEx(World, False, False);
    while not SmartReady do wait(100);
    SetTargetDC(SmartGetDC);
    Status('Smart loaded.');
    WriteLn('S.M.A.R.T LOADED AND READY TO AUTO!');
   end;
  ActivateClient;
  LoadDTM;
end;

procedure LoginTasks;
begin
  LoginPlayer;
  MarkTime(Mark);
  MarkTime(Mark2);
  SetAngle(True);
  Players[CurrentPlayer].Integers[5] := GetXp(Players[CurrentPlayer].Strings[1]);
  if not SetFightMode(Players[CurrentPlayer].Integers[2]) then logout;
  RoomMiddleDTM;
  Players[CurrentPlayer].loc := 'In the room';
end;

procedure MainLoop;
begin
  Wait2(500+random(500), false);
  i := random(8);
  case I of
       2: Randoms;
       3: RandomTab;
       4: if random(1) = 2 then RoomMiddleDTM;
       5: Players[CurrentPlayer].Integers[6] := GetXp(Players[CurrentPlayer].Strings[1]);
  end;
  AggressiveCheck;
  FindNonInventoryRandoms;
  if (Pickup) then CustomPickup;
  if not EatCheck then RoomLogout;
  Wait2(5000+random(100)*random(100), false);
  if TimeFromMark(Mark2) > 300000 then
  begin
    Players[CurrentPlayer].Integers[6] := GetXp(Players[CurrentPlayer].Strings[1]);
    proggy;
    MarkTime(Mark2);
  end;
end;

Procedure LogoutTasks;
begin
  MissCount := 0;
  i := 0;
  Players[CurrentPlayer].Integers[4] := timefrommark(Mark);
  Proggy;
  NextPlayer(False);
end;

//Main Program
begin
  StartScript;
  For i:= 0 to (GetArrayLength(Players)-1) do
  begin
    LoginTasks;
    repeat
      MainLoop;
    until LoggedIn = False
    LogoutTasks;
  end;
  freeDTM(RoomDTM);
end.
 
You cant use radialWalkex(tpa,643, 83, 15199724, 30, 270, 400, 30);. Because its finding the one colour you need a auto colour
 
Hmm , idk man , somehow it used to work with that colour , well it kind of still works , but not as well as it did before, and I think it also works with colors since it finds the color in the minimap, not necessarily autocolours , anyways would like be the same since both are colours.

I know you are telling me to use like

radialWalkex(tpa,643, 83, findVarrockRoadColor, 30, 270, 400, 30);

and well since there is no like, SecurityStrongholdRoad , then the guy who made the script tried to find a colour which i think that are the white separations in the hall, and then click there but it sometimes gets lost , so I need a really skilled scripter to help me make that script wonderful cuz Im not very experienced scripter.
 
You cant use radialWalkex(tpa,643, 83, 15199724, 30, 270, 400, 30);. Because its finding the one colour you need a auto colour
Autocoloring isnt an obligation while walking. Thats why in RadialWalkEx and LinearWalkEx you can set a tolerance, to walk without autocoloring.

@Dracody: Hey what happened to SRL-Forums :p? on topic: try changing the start radial and the end radial.
 
Yeah that might work , hehe :p

To SRL-Forums I dont know dude , haha I really need it back , I hope it gets back on soon , IP-Downer said that somebod forgot to pay some bills maybe Dankness :p, That may be why , So well I hope they pay bills soon:D
 
Runescape Gamblingrunescape gambling
Back
Top