psickle (12-22-2017)
See if the console gives you any error + check if the code is well alligned with the statement blocks etc... Mostly my problems when it comes to running on CMD is because of code allignment and spaces between certain parts of the code. CMD is delicate xDD
- - - Updated - - -
In my opinion you shouldn't translate because who did the ahk script might code different/think then you, and then you could not understand something.
But if you want to translate then go ahead! To build it yourself, remember you gotta make the script pull the mouse down, then think of how and build around that.
Make your imports so you can use some expressions, create your functions and if statements so when you press LMB you want the recoil to start working. Use mouse_event to ensure compability with the game, and test your code when you chage/try to implement something new!
5 days ago I did not knew nothing about pyton. Not even how to print something. Today I've got my no recoil script working for 5 different weapons supporting "Basic Sights","X2 Scope",X4 Scope" recoils. I've learned other programming languages before and never got too advanced only basic / medium, but that for sure helped me getting the logics done and the code built in python, still with effort and a bunch of hours I made it. If I can with effort you can too! Good Luck!
Last edited by asserio; 12-21-2017 at 07:26 PM.
psickle (12-22-2017)
You can just do
if crouchJ:
instead of
if crouchJ == 1:
Similarly, instead of
if keyboard.is_pressed('tab') is True:
just do
if keyboard.is_pressed('tab'):
it reads more like english and isn't as redundant.
Lastly, ads_down() has unnecessary recursion. You can accomplish the same thing in a while loop (while True:...)
Last edited by Chels; 12-21-2017 at 10:25 PM.
i can't install NameOfPackage, can you help me?
Still UD with that method? @dustyroo
If I want to make it spacebar to crouch+jump. Do I need to comment out any line? and Do I just change crouch_jump_keybind = 'shift+alt' to 'space' ?from time import sleep
from random import randint
import keyboard
#How much we want to successfully crouch jump from 1-100%, 100% will always crouch jump.
#example 80 = 80% chance of successfully doing a crouch jump
success_rate = 100#%
#You can change the key to whatever you want.
#example. '/' = / or keypad devide, '*' = numpad mult or shift+8
crouch_jump_act_deact = 'f6'
panic_quit_act_deact = 'f7'
#What key/'s to push to make you crouch jump
#If you want it to be when you press shift and space do 'shift+space' add a '#' to line 35 just like in like 36 if you dont know what to do.
#you can make it control space do 'ctrl+space' or any other comb of keys. uncomment line 36.
#If you want just one key make it look like 'alt' and uncomment like 36. do not make it 'c' space needs to come first
crouch_jump_keybind = 'shift+alt'
crouchJ = 0
def stop_now():
print('STOPPED!')
keyboard.unhook_all()
sleep(43232)
stop_now()
def crouch_jump():
if crouchJ == 1:
success_chance = randint(1, 100)
if success_chance <= success_rate:
#keyboard.send('shift')
keyboard.send('space')
keyboard.send('c')
#print('done succ')
keyboard.wait(crouch_jump_keybind)
sleep(0.3)
crouch_jump()
else:
keyboard.send('c')
keyboard.send('space')
#print('dont succ')
keyboard.wait(crouch_jump_keybind)
sleep(0.3)
crouch_jump()
else:
#print('waiting')
keyboard.wait(crouch_jump_keybind)
sleep(0.3)
crouch_jump()
def start_cj():
global crouchJ
if crouchJ == 0:
crouchJ = 1
print('Crouch Jump is Activated')
elif crouchJ == 1:
crouchJ = 0
print('Crouch Jump is Deactivated')
else:
return
keyboard.add_hotkey(crouch_jump_act_deact, start_cj, trigger_on_release=True)
keyboard.add_hotkey(panic_quit_act_deact, stop_now)
crouch_jump()