Jump to content
ti.teg.tnod.I

Minecraft Key Holder (Hate holding crouch?)

Recommended Posts

This is a script to hold crouch / w / a / s / d. Simply hold control and press the desired key, release the key, release control. The key will then be held. The key will release if you press "t" or the held key.

 

program HoldMCKeys;

var KeyState : integer;
   DoCrouch, DoW, DoA, DoS, DoD : boolean;

procedure FreeKeys;
begin
 IsKeyDown('w');
 IsKeyDown('a');
 IsKeyDown('s');
 IsKeyDown('d');
end;

//Created by: ti.teg.tnod.I
//Description: Toggles crouch (If crouch is shift)
//Used Like: Crouch(True);
procedure Crouch(Hold: boolean);
begin
 if Hold then KeyDown(16) else KeyUp(16);
end;

begin
 ActivateClient;
 repeat
   if IsFunctionKeyDown(1) then
   begin
     if (KeyState = 0) then
     begin
       if IsFunctionKeyDown(0) then
       begin
         DoCrouch := True;
         KeyState := 1;
       end else if IsKeyDown('w') then
       begin
         DoW := True;
         KeyState := 1;
       end else if IsKeyDown('a') then
       begin
         DoA := True;
         KeyState := 1;
       end else if IsKeyDown('s') then
       begin
         DoS := True
         KeyState := 1;
       end else if IsKeyDown('d') then
       begin
         DoD := True;
         KeyState := 1;
       end;
     end else if (KeyState = 3) then
       KeyState := 0;
   end else if IsKeyDown('t') and (KeyState = 3) then
   begin
     Crouch(False);
     KeyUp(87);
     KeyUp(65);
     KeyUp(83);
     KeyUp(68);
     KeyState := 0;
   end else if (KeyState = 1) then
   begin
     if DoCrouch then
     begin
       Crouch(DoCrouch);
       DoCrouch := False;
     end else if DoW then
     begin
       KeyDown(87);
       DoW := False;
     end else if DoA then
     begin
       KeyDown(65);
       DoA := False;
     end else if DoS then
     begin
       KeyDown(83);
       DoS := False;
     end else if DoD then
     begin
       KeyDown(68);
       DoD := False;
     end;
     KeyState := 3;
   end;
   FreeKeys;
   Wait(100);
 until(False);
end.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...