Minecraft: Opening inventory doesn't work

Ask gaming related questions (AHK v1.1 and older)
danielmacros
Posts: 5
Joined: 08 Apr 2024, 17:10
Contact:

Minecraft: Opening inventory doesn't work

09 Apr 2024, 04:45

need help i made a script for minecraft potionpvp but the problem is that when i press "E" to open up minecrafts inventory it doesnt work
because im using ''E'' in my ahk script to reload it. is there any ways to make ''E'' key work in minecraft and in ahk at the same time ?
btw i joined a day ago and dont know how to post here my script, it works but it has some issues, maybe i did something wrong in script and that slows it down.


[Mod edit: Moved from AHK v2 help since it is a v1 question. See below.]
gregster
Posts: 9073
Joined: 30 Sep 2013, 06:48

Re: Minecraft: Opening inventory doesn't work

09 Apr 2024, 05:21

I have split your post from an unrelated topic. Please create your own topics for your questions, going forward.
dont know how to post here my script
If it is not huge, just copy and paste it into a new post and apply code tags.

ctags.png
ctags.png (14.18 KiB) Viewed 265 times

So far, it is unclear to me, why you would want to use the same key for reloading your script and opening the game's inventory.

If you are looking for context-sensitive hotkeys, I would look into #HotIf. See also https://www.autohotkey.com/docs/v2/Hotkeys.htm#Context
To not block a key's native function, you could use the ~ modifier.
danielmacros
Posts: 5
Joined: 08 Apr 2024, 17:10
Contact:

please help im a beginner

09 Apr 2024, 13:11

i use this script in minecraft potionpvp, if you are not familiar with it you can look it up, it works but the problem is that its not fast enought and when all potions are used in my minecraft hotbar i need to click ''E'' (which opens up my inventory) and drag stuff from my inventory to my hotbar, but at the same time ''E'' key must reload my script. i tried to add (

Code: Select all

E::Reload
) in my script and it works but
then the ''E'' key doesnt work in minecraft. the same happent to ''ctrl'' it is used in minecraft to make my character sprint
but everytime i hold down ''ctrl'' the script doesnot work at all. i tried disabling ''ctrl'' in ahk but then it doesnt work in minecraft
it is very confusing but long story short i want to use keys in ahk and in minecraft at the same time. the script works fine but its
not very accurate maybe needs some changes? sorry for bothehring

Code: Select all

i:=!i ; initiate counter
q::
if ( i = 1 ) {
  send, 3

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 2 ) {
  send, 4

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 3 ) {
  send, 5

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 4 ) {
  send, 6

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 5 ) {
  send, 7

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 6 ) {
  send, 8

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 7 ) {
  send, 9

sleep, 1

Click, Right

sleep, 1

send, 1 
  ; replace with action
  i:=!!i ; initiate counter
}

return
Last edited by gregster on 09 Apr 2024, 13:24, edited 1 time in total.
Reason: Merged topics. Moved from AHK v2 help since this is v1 code.
User avatar
boiler
Posts: 17146
Joined: 21 Dec 2014, 02:44

Re: Minecraft: Opening inventory doesn't work

09 Apr 2024, 13:59

@danielmacros -- Did you try what was suggested below?
gregster wrote: To not block a key's native function, you could use the ~ modifier.
danielmacros
Posts: 5
Joined: 08 Apr 2024, 17:10
Contact:

~Lctrl ~Rctrl woesnt work

09 Apr 2024, 15:15

after using (~) this modifier Lctrl and Rctrl is still blcked

and is it possible to make my script faster and more accurate?

Code: Select all

i:=!i ; initiate counter
~q::

if ( i = 1 ) {
  send, 3

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 2 ) {
  send, 4

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 3 ) {
  send, 5

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 4 ) {
  send, 6

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 5 ) {
  send, 7

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 6 ) {
  send, 8

sleep, 1

Click, Right

sleep, 1

send, 1 ; replace with action
  i++ ; count increment
}
else if ( i = 7 ) {
  send, 9

sleep, 1

Click, Right

sleep, 1

send, 1 
  ; replace with action
  i:=!!i ; initiate counter
}

return 

~e::reload

~LCtrl::
return

~RCtrl::
return
User avatar
boiler
Posts: 17146
Joined: 21 Dec 2014, 02:44

Re: Minecraft: Opening inventory doesn't work

09 Apr 2024, 18:51

Do you really mean the Ctrl doesn't work? Or do you mean that when you hold Ctrl, then pressing q doesn't launch your hotkey routine? Those are two very different things. The reason for the latter would be that your hotkey isn't Ctrl+q, it's just q. If you want it to fire even when you're holding Ctrl, then make it ~*q::.
danielmacros
Posts: 5
Joined: 08 Apr 2024, 17:10
Contact:

script not fast enought

10 Apr 2024, 13:55

finally fixed it. boiler i really appreciate it. btw is it possible to make my script faster? the sleep time is on 1 but still it isnt fast enough.
i tried to remove sleep, 1 (code) but then it messes up the commands.
User avatar
boiler
Posts: 17146
Joined: 21 Dec 2014, 02:44

Re: Minecraft: Opening inventory doesn't work

10 Apr 2024, 14:20

If removing the Sleep causes it to have problems, then you really don't want to speed it up. You need it to have some delays for it to work (for Minecraft to handle it), apparently. Btw, it doesn't sleep for 1 ms. When you ask it to do that, it's actually sleeping for either 10 ms or 15.6 ms, depending on your machine.
danielmacros
Posts: 5
Joined: 08 Apr 2024, 17:10
Contact:

reload script without ::reload

10 Apr 2024, 15:25

last question; is it possible to reload my script (make it start from the beginning) without (::reload) command?
the problem with it is that everytime my script reloads, then it resets and starts again it doesnt start fast enough for example
when all the commands are fired and need to reset it all, it doesnt reset fast enough and has slight delay. i want to make a (key)
and everytime i press it, the script starts from the beginning instantly.

sorry for bothering
User avatar
boiler
Posts: 17146
Joined: 21 Dec 2014, 02:44

Re: Minecraft: Opening inventory doesn't work

10 Apr 2024, 15:33

I don't know a way of making it stop whatever it's doing and start from the beginning as if nothing was already running without Reload or equivalent. Maybe someone else will have an idea.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 33 guests