Noki

HD2 Keybaord March 2025

Mar 24th, 2025
966
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 33.13 KB | None | 0 0
  1. print("\n\n ---:::### Starting Noki Keyboard ###:::---\n\n")
  2.  
  3. import usb_hid
  4. import time
  5. import board
  6. import keypad
  7. import random
  8. from adafruit_hid.keyboard import Keyboard
  9. from adafruit_hid.keycode import Keycode
  10. from collections import deque
  11.  
  12. kp = keypad.KeyMatrix(
  13.     row_pins=(board.GP27, board.GP28, board.GP29),
  14.     column_pins=(board.GP0 ,board.GP1, board.GP2, board.GP3, board.GP4, board.GP5, board.GP6),
  15. )
  16.  
  17. kbd = Keyboard(usb_hid.devices)
  18.  
  19. max_time = 18          # 19
  20. key_press_time = 0.033  # 0.035
  21. key_gap_time = 0.08    # 0.08
  22.  
  23. # Action Class
  24.  
  25. class ActionInProgress:
  26.     def __init__(self):
  27.         self.flag = False
  28.  
  29.     def __enter__(self):
  30.         self.flag = True
  31.         return self
  32.  
  33.     def __exit__(self, exc_type, exc_val, exc_tb):
  34.         self.flag = False
  35.  
  36. # Button Press Functions
  37.  
  38. def p_up(time_in, wait =True):
  39.     kbd.press(Keycode.UP_ARROW)
  40.     time.sleep(key_press_time+time_in)
  41.     kbd.release(Keycode.UP_ARROW)
  42.     if wait:
  43.         time.sleep(key_gap_time+time_in)
  44.  
  45. def p_down(time_in, wait =True):
  46.     kbd.press(Keycode.DOWN_ARROW)
  47.     time.sleep(key_press_time+time_in)
  48.     kbd.release(Keycode.DOWN_ARROW)
  49.     if wait:
  50.         time.sleep(key_gap_time+time_in)
  51.  
  52. def p_left(time_in, wait =True):
  53.     kbd.press(Keycode.LEFT_ARROW)
  54.     time.sleep(key_press_time+time_in)
  55.     kbd.release(Keycode.LEFT_ARROW)
  56.     if wait:
  57.         time.sleep(key_gap_time+time_in)
  58.  
  59. def p_right(time_in, wait =True):
  60.     kbd.press(Keycode.RIGHT_ARROW)
  61.     time.sleep(key_press_time+time_in)
  62.     kbd.release(Keycode.RIGHT_ARROW)
  63.     if wait:
  64.         time.sleep(key_gap_time+time_in)
  65.  
  66. def strat_key_press(time_in):
  67.     kbd.press(Keycode.LEFT_CONTROL)
  68.     time.sleep(0.055+time_in)
  69.  
  70. def strat_key_release():
  71.     kbd.release(Keycode.LEFT_CONTROL)
  72.  
  73. # Key Binds
  74.  
  75. # Example
  76.  
  77. def YA_BASIC():
  78.     with ActionInProgress() as action:
  79.         strat_key_press(random.randrange(1, max_time)/1000)
  80.         p_down(random.randrange(1, max_time)/1000)
  81.         p_right(random.randrange(1, max_time)/1000)
  82.         p_left(random.randrange(1, max_time)/1000)
  83.         p_up(random.randrange(1, max_time)/1000, False)
  84.         strat_key_release()
  85.  
  86. # Base
  87.  
  88. def base_renforce():
  89.     with ActionInProgress() as action:
  90.         strat_key_press(random.randrange(1, max_time)/1000)
  91.         p_up(random.randrange(1, max_time)/1000)
  92.         p_down(random.randrange(1, max_time)/1000)
  93.         p_right(random.randrange(1, max_time)/1000)
  94.         p_left(random.randrange(1, max_time)/1000)
  95.         p_up(random.randrange(1, max_time)/1000, False)
  96.         strat_key_release()
  97.  
  98. def base_resupply():
  99.     with ActionInProgress() as action:
  100.         strat_key_press(random.randrange(1, max_time)/1000)
  101.         p_down(random.randrange(1, max_time)/1000)
  102.         p_down(random.randrange(1, max_time)/1000)
  103.         p_up(random.randrange(1, max_time)/1000)
  104.         p_right(random.randrange(1, max_time)/1000, False)
  105.         strat_key_release()
  106.  
  107. def base_seaf_art():
  108.     with ActionInProgress() as action:
  109.         strat_key_press(random.randrange(1, max_time)/1000)
  110.         p_right(random.randrange(1, max_time)/1000)
  111.         p_up(random.randrange(1, max_time)/1000)
  112.         p_up(random.randrange(1, max_time)/1000)
  113.         p_down(random.randrange(1, max_time)/1000, False)
  114.         strat_key_release()
  115.  
  116. def base_sos():
  117.     with ActionInProgress() as action:
  118.         strat_key_press(random.randrange(1, max_time)/1000)
  119.         p_up(random.randrange(1, max_time)/1000)
  120.         p_down(random.randrange(1, max_time)/1000)
  121.         p_right(random.randrange(1, max_time)/1000)
  122.         p_up(random.randrange(1, max_time)/1000, False)
  123.         strat_key_release()
  124.  
  125. def base_eagle_rearm():
  126.     with ActionInProgress() as action:
  127.         strat_key_press(random.randrange(1, max_time)/1000)
  128.         p_up(random.randrange(1, max_time)/1000)
  129.         p_up(random.randrange(1, max_time)/1000)
  130.         p_left(random.randrange(1, max_time)/1000)
  131.         p_up(random.randrange(1, max_time)/1000)
  132.         p_right(random.randrange(1, max_time)/1000, False)
  133.         strat_key_release()
  134.  
  135. # Orbitals
  136.  
  137. def orb_precision_strike():
  138.     with ActionInProgress() as action:
  139.         strat_key_press(random.randrange(1, max_time)/1000)
  140.         p_right(random.randrange(1, max_time)/1000)
  141.         p_right(random.randrange(1, max_time)/1000)
  142.         p_up(random.randrange(1, max_time)/1000, False)
  143.         strat_key_release()
  144.  
  145. def orb_laser():
  146.     with ActionInProgress() as action:
  147.         strat_key_press(random.randrange(1, max_time)/1000)
  148.         p_right(random.randrange(1, max_time)/1000)
  149.         p_down(random.randrange(1, max_time)/1000)
  150.         p_up(random.randrange(1, max_time)/1000)
  151.         p_right(random.randrange(1, max_time)/1000)
  152.         p_down(random.randrange(1, max_time)/1000, False)
  153.         strat_key_release()
  154.  
  155. def orb_gas_strike():
  156.     with ActionInProgress() as action:
  157.         strat_key_press(random.randrange(1, max_time)/1000)
  158.         p_right(random.randrange(1, max_time)/1000)
  159.         p_right(random.randrange(1, max_time)/1000)
  160.         p_down(random.randrange(1, max_time)/1000)
  161.         p_right(random.randrange(1, max_time)/1000, False)
  162.         strat_key_release()
  163.  
  164. def orb_smoke_strike():
  165.     with ActionInProgress() as action:
  166.         strat_key_press(random.randrange(1, max_time)/1000)
  167.         p_right(random.randrange(1, max_time)/1000)
  168.         p_right(random.randrange(1, max_time)/1000)
  169.         p_down(random.randrange(1, max_time)/1000)
  170.         p_up(random.randrange(1, max_time)/1000, False)
  171.         strat_key_release()
  172.  
  173. def orb_railcannon_strike():
  174.     with ActionInProgress() as action:
  175.         strat_key_press(random.randrange(1, max_time)/1000)
  176.         p_right(random.randrange(1, max_time)/1000)
  177.         p_up(random.randrange(1, max_time)/1000)
  178.         p_down(random.randrange(1, max_time)/1000)
  179.         p_down(random.randrange(1, max_time)/1000)
  180.         p_right(random.randrange(1, max_time)/1000, False)
  181.         strat_key_release()
  182.  
  183. def orb_ems_strike():
  184.     with ActionInProgress() as action:
  185.         strat_key_press(random.randrange(1, max_time)/1000)
  186.         p_right(random.randrange(1, max_time)/1000)
  187.         p_right(random.randrange(1, max_time)/1000)
  188.         p_left(random.randrange(1, max_time)/1000)
  189.         p_down(random.randrange(1, max_time)/1000, False)
  190.         strat_key_release()
  191.  
  192. def orb_gatling_barrage():
  193.     with ActionInProgress() as action:
  194.         strat_key_press(random.randrange(1, max_time)/1000)
  195.         p_right(random.randrange(1, max_time)/1000)
  196.         p_down(random.randrange(1, max_time)/1000)
  197.         p_left(random.randrange(1, max_time)/1000)
  198.         p_up(random.randrange(1, max_time)/1000)
  199.         p_up(random.randrange(1, max_time)/1000, False)
  200.         strat_key_release()
  201.  
  202. def orb_airburst_strike():
  203.     with ActionInProgress() as action:
  204.         strat_key_press(random.randrange(1, max_time)/1000)
  205.         p_left(random.randrange(1, max_time)/1000)
  206.         p_left(random.randrange(1, max_time)/1000)
  207.         p_left(random.randrange(1, max_time)/1000, False)
  208.         strat_key_release()
  209.  
  210. def orb_120mm_barrage():
  211.     with ActionInProgress() as action:
  212.         strat_key_press(random.randrange(1, max_time)/1000)
  213.         p_right(random.randrange(1, max_time)/1000)
  214.         p_right(random.randrange(1, max_time)/1000)
  215.         p_down(random.randrange(1, max_time)/1000)
  216.         p_left(random.randrange(1, max_time)/1000)
  217.         p_right(random.randrange(1, max_time)/1000)
  218.         p_down(random.randrange(1, max_time)/1000, False)
  219.         strat_key_release()
  220.  
  221. def orb_380mm_barrage():
  222.     with ActionInProgress() as action:
  223.         strat_key_press(random.randrange(1, max_time)/1000)
  224.         p_right(random.randrange(1, max_time)/1000)
  225.         p_down(random.randrange(1, max_time)/1000)
  226.         p_up(random.randrange(1, max_time)/1000)
  227.         p_up(random.randrange(1, max_time)/1000)
  228.         p_left(random.randrange(1, max_time)/1000)
  229.         p_down(random.randrange(1, max_time)/1000)
  230.         p_down(random.randrange(1, max_time)/1000, False)
  231.         strat_key_release()
  232.  
  233. def orb_walking_barrage():
  234.     with ActionInProgress() as action:
  235.         strat_key_press(random.randrange(1, max_time)/1000)
  236.         p_right(random.randrange(1, max_time)/1000)
  237.         p_down(random.randrange(1, max_time)/1000)
  238.         p_right(random.randrange(1, max_time)/1000)
  239.         p_down(random.randrange(1, max_time)/1000)
  240.         p_right(random.randrange(1, max_time)/1000)
  241.         p_down(random.randrange(1, max_time)/1000, False)
  242.         strat_key_release()
  243.  
  244. def orb_napalm_barrage():
  245.     with ActionInProgress() as action:
  246.         strat_key_press(random.randrange(1, max_time)/1000)
  247.         p_right(random.randrange(1, max_time)/1000)
  248.         p_right(random.randrange(1, max_time)/1000)
  249.         p_down(random.randrange(1, max_time)/1000)
  250.         p_left(random.randrange(1, max_time)/1000)
  251.         p_right(random.randrange(1, max_time)/1000)
  252.         p_up(random.randrange(1, max_time)/1000, False)
  253.         strat_key_release()
  254.  
  255. # Guns
  256.  
  257. def gun_stalwart():
  258.     with ActionInProgress() as action:
  259.         strat_key_press(random.randrange(1, max_time)/1000)
  260.         p_down(random.randrange(1, max_time)/1000)
  261.         p_left(random.randrange(1, max_time)/1000)
  262.         p_down(random.randrange(1, max_time)/1000)
  263.         p_up(random.randrange(1, max_time)/1000)
  264.         p_up(random.randrange(1, max_time)/1000)
  265.         p_left(random.randrange(1, max_time)/1000, False)
  266.         strat_key_release()
  267.  
  268. def gun_machine():
  269.     with ActionInProgress() as action:
  270.         strat_key_press(random.randrange(1, max_time)/1000)
  271.         p_down(random.randrange(1, max_time)/1000)
  272.         p_left(random.randrange(1, max_time)/1000)
  273.         p_down(random.randrange(1, max_time)/1000)
  274.         p_up(random.randrange(1, max_time)/1000)
  275.         p_right(random.randrange(1, max_time)/1000, False)
  276.         strat_key_release()
  277.  
  278. def gun_heavy_machine():
  279.     with ActionInProgress() as action:
  280.         strat_key_press(random.randrange(1, max_time)/1000)
  281.         p_down(random.randrange(1, max_time)/1000)
  282.         p_left(random.randrange(1, max_time)/1000)
  283.         p_up(random.randrange(1, max_time)/1000)
  284.         p_down(random.randrange(1, max_time)/1000)
  285.         p_down(random.randrange(1, max_time)/1000, False)
  286.         strat_key_release()
  287.  
  288. def gun_anti_material():
  289.     with ActionInProgress() as action:
  290.         strat_key_press(random.randrange(1, max_time)/1000)
  291.         p_down(random.randrange(1, max_time)/1000)
  292.         p_left(random.randrange(1, max_time)/1000)
  293.         p_right(random.randrange(1, max_time)/1000)
  294.         p_up(random.randrange(1, max_time)/1000)
  295.         p_down(random.randrange(1, max_time)/1000, False)
  296.         strat_key_release()
  297.  
  298. def gun_exp_anti_tank():
  299.     with ActionInProgress() as action:
  300.         strat_key_press(random.randrange(1, max_time)/1000)
  301.         p_down(random.randrange(1, max_time)/1000)
  302.         p_down(random.randrange(1, max_time)/1000)
  303.         p_left(random.randrange(1, max_time)/1000)
  304.         p_up(random.randrange(1, max_time)/1000)
  305.         p_right(random.randrange(1, max_time)/1000, False)
  306.         strat_key_release()
  307.  
  308. def gun_commando():
  309.     with ActionInProgress() as action:
  310.         strat_key_press(random.randrange(1, max_time)/1000)
  311.         p_down(random.randrange(1, max_time)/1000)
  312.         p_left(random.randrange(1, max_time)/1000)
  313.         p_up(random.randrange(1, max_time)/1000)
  314.         p_down(random.randrange(1, max_time)/1000)
  315.         p_right(random.randrange(1, max_time)/1000, False)
  316.         strat_key_release()
  317.  
  318. def gun_recoilless_rifle():
  319.     with ActionInProgress() as action:
  320.         strat_key_press(random.randrange(1, max_time)/1000)
  321.         p_down(random.randrange(1, max_time)/1000)
  322.         p_left(random.randrange(1, max_time)/1000)
  323.         p_right(random.randrange(1, max_time)/1000)
  324.         p_right(random.randrange(1, max_time)/1000)
  325.         p_left(random.randrange(1, max_time)/1000, False)
  326.         strat_key_release()
  327.  
  328. def gun_railgun():
  329.     with ActionInProgress() as action:
  330.         strat_key_press(random.randrange(1, max_time)/1000)
  331.         p_down(random.randrange(1, max_time)/1000)
  332.         p_right(random.randrange(1, max_time)/1000)
  333.         p_down(random.randrange(1, max_time)/1000)
  334.         p_up(random.randrange(1, max_time)/1000)
  335.         p_left(random.randrange(1, max_time)/1000)
  336.         p_right(random.randrange(1, max_time)/1000, False)
  337.         strat_key_release()
  338.  
  339. def gun_grenade():
  340.     with ActionInProgress() as action:
  341.         strat_key_press(random.randrange(1, max_time)/1000)
  342.         p_down(random.randrange(1, max_time)/1000)
  343.         p_left(random.randrange(1, max_time)/1000)
  344.         p_up(random.randrange(1, max_time)/1000)
  345.         p_left(random.randrange(1, max_time)/1000)
  346.         p_down(random.randrange(1, max_time)/1000, False)
  347.         strat_key_release()
  348.  
  349. def gun_flame_thrower():
  350.     with ActionInProgress() as action:
  351.         strat_key_press(random.randrange(1, max_time)/1000)
  352.         p_down(random.randrange(1, max_time)/1000)
  353.         p_left(random.randrange(1, max_time)/1000)
  354.         p_up(random.randrange(1, max_time)/1000)
  355.         p_down(random.randrange(1, max_time)/1000)
  356.         p_up(random.randrange(1, max_time)/1000, False)
  357.         strat_key_release()
  358.  
  359. def gun_arc_thrower():
  360.     with ActionInProgress() as action:
  361.         strat_key_press(random.randrange(1, max_time)/1000)
  362.         p_up(random.randrange(1, max_time)/1000)
  363.         p_down(random.randrange(1, max_time)/1000)
  364.         p_left(random.randrange(1, max_time)/1000)
  365.         p_right(random.randrange(1, max_time)/1000, False)
  366.         strat_key_release()
  367.  
  368. def gun_auto_cannon():
  369.     with ActionInProgress() as action:
  370.         strat_key_press(random.randrange(1, max_time)/1000)
  371.         p_down(random.randrange(1, max_time)/1000)
  372.         p_left(random.randrange(1, max_time)/1000)
  373.         p_down(random.randrange(1, max_time)/1000)
  374.         p_up(random.randrange(1, max_time)/1000)
  375.         p_up(random.randrange(1, max_time)/1000)
  376.         p_right(random.randrange(1, max_time)/1000, False)
  377.         strat_key_release()
  378.  
  379. def gun_spear():
  380.     with ActionInProgress() as action:
  381.         strat_key_press(random.randrange(1, max_time)/1000)
  382.         p_down(random.randrange(1, max_time)/1000)
  383.         p_down(random.randrange(1, max_time)/1000)
  384.         p_up(random.randrange(1, max_time)/1000)
  385.         p_down(random.randrange(1, max_time)/1000)
  386.         p_down(random.randrange(1, max_time)/1000, False)
  387.         strat_key_release()
  388.  
  389. def gun_laser_cannon():
  390.     with ActionInProgress() as action:
  391.         strat_key_press(random.randrange(1, max_time)/1000)
  392.         p_down(random.randrange(1, max_time)/1000)
  393.         p_left(random.randrange(1, max_time)/1000)
  394.         p_down(random.randrange(1, max_time)/1000)
  395.         p_up(random.randrange(1, max_time)/1000)
  396.         p_left(random.randrange(1, max_time)/1000, False)
  397.         strat_key_release()
  398.  
  399. def gun_quaser_cannon():
  400.     with ActionInProgress() as action:
  401.         strat_key_press(random.randrange(1, max_time)/1000)
  402.         p_down(random.randrange(1, max_time)/1000)
  403.         p_down(random.randrange(1, max_time)/1000)
  404.         p_up(random.randrange(1, max_time)/1000)
  405.         p_left(random.randrange(1, max_time)/1000)
  406.         p_right(random.randrange(1, max_time)/1000, False)
  407.         strat_key_release()
  408.  
  409. def gun_sterilizer():
  410.     with ActionInProgress() as action:
  411.         strat_key_press(random.randrange(1, max_time)/1000)
  412.         p_down(random.randrange(1, max_time)/1000)
  413.         p_left(random.randrange(1, max_time)/1000)
  414.         p_up(random.randrange(1, max_time)/1000)
  415.         p_down(random.randrange(1, max_time)/1000)
  416.         p_left(random.randrange(1, max_time)/1000, False)
  417.         strat_key_release()
  418.  
  419. def gun_wasp():
  420.     with ActionInProgress() as action:
  421.         strat_key_press(random.randrange(1, max_time)/1000)
  422.         p_down(random.randrange(1, max_time)/1000)
  423.         p_down(random.randrange(1, max_time)/1000)
  424.         p_up(random.randrange(1, max_time)/1000)
  425.         p_down(random.randrange(1, max_time)/1000)
  426.         p_right(random.randrange(1, max_time)/1000, False)
  427.         strat_key_release()
  428.  
  429. def gun_airburst_rocket():
  430.     with ActionInProgress() as action:
  431.         strat_key_press(random.randrange(1, max_time)/1000)
  432.         p_down(random.randrange(1, max_time)/1000)
  433.         p_up(random.randrange(1, max_time)/1000)
  434.         p_up(random.randrange(1, max_time)/1000)
  435.         p_left(random.randrange(1, max_time)/1000)
  436.         p_right(random.randrange(1, max_time)/1000, False)
  437.         strat_key_release()
  438.  
  439. # Backpack
  440.  
  441. def bp_jump_pack():
  442.     with ActionInProgress() as action:
  443.         strat_key_press(random.randrange(1, max_time)/1000)
  444.         p_down(random.randrange(1, max_time)/1000)
  445.         p_up(random.randrange(1, max_time)/1000)
  446.         p_up(random.randrange(1, max_time)/1000)
  447.         p_down(random.randrange(1, max_time)/1000)
  448.         p_up(random.randrange(1, max_time)/1000, False)
  449.         strat_key_release()
  450.  
  451. def bp_las_guard_dog():
  452.     with ActionInProgress() as action:
  453.         strat_key_press(random.randrange(1, max_time)/1000)
  454.         p_down(random.randrange(1, max_time)/1000)
  455.         p_up(random.randrange(1, max_time)/1000)
  456.         p_left(random.randrange(1, max_time)/1000)
  457.         p_up(random.randrange(1, max_time)/1000)
  458.         p_right(random.randrange(1, max_time)/1000)
  459.         p_right(random.randrange(1, max_time)/1000, False)
  460.         strat_key_release()
  461.  
  462. def bp_guard_dog():
  463.     with ActionInProgress() as action:
  464.         strat_key_press(random.randrange(1, max_time)/1000)
  465.         p_down(random.randrange(1, max_time)/1000)
  466.         p_up(random.randrange(1, max_time)/1000)
  467.         p_left(random.randrange(1, max_time)/1000)
  468.         p_up(random.randrange(1, max_time)/1000)
  469.         p_right(random.randrange(1, max_time)/1000)
  470.         p_down(random.randrange(1, max_time)/1000, False)
  471.         strat_key_release()
  472.  
  473. def bp_gas_guard_dog():
  474.     with ActionInProgress() as action:
  475.         strat_key_press(random.randrange(1, max_time)/1000)
  476.         p_down(random.randrange(1, max_time)/1000)
  477.         p_up(random.randrange(1, max_time)/1000)
  478.         p_left(random.randrange(1, max_time)/1000)
  479.         p_up(random.randrange(1, max_time)/1000)
  480.         p_right(random.randrange(1, max_time)/1000)
  481.         p_up(random.randrange(1, max_time)/1000, False)
  482.         strat_key_release()
  483.  
  484. def bp_supply():
  485.     with ActionInProgress() as action:
  486.         strat_key_press(random.randrange(1, max_time)/1000)
  487.         p_down(random.randrange(1, max_time)/1000)
  488.         p_left(random.randrange(1, max_time)/1000)
  489.         p_down(random.randrange(1, max_time)/1000)
  490.         p_up(random.randrange(1, max_time)/1000)
  491.         p_up(random.randrange(1, max_time)/1000)
  492.         p_down(random.randrange(1, max_time)/1000, False)
  493.         strat_key_release()
  494.  
  495. def bp_shield_gen():
  496.     with ActionInProgress() as action:
  497.         strat_key_press(random.randrange(1, max_time)/1000)
  498.         p_down(random.randrange(1, max_time)/1000)
  499.         p_up(random.randrange(1, max_time)/1000)
  500.         p_left(random.randrange(1, max_time)/1000)
  501.         p_right(random.randrange(1, max_time)/1000)
  502.         p_left(random.randrange(1, max_time)/1000)
  503.         p_right(random.randrange(1, max_time)/1000, False)
  504.         strat_key_release()
  505.  
  506. def bp_ballistic_shield():
  507.     with ActionInProgress() as action:
  508.         strat_key_press(random.randrange(1, max_time)/1000)
  509.         p_down(random.randrange(1, max_time)/1000)
  510.         p_left(random.randrange(1, max_time)/1000)
  511.         p_down(random.randrange(1, max_time)/1000)
  512.         p_down(random.randrange(1, max_time)/1000)
  513.         p_up(random.randrange(1, max_time)/1000)
  514.         p_left(random.randrange(1, max_time)/1000, False)
  515.         strat_key_release()
  516.  
  517. def bp_directional_shield():
  518.     with ActionInProgress() as action:
  519.         strat_key_press(random.randrange(1, max_time)/1000)
  520.         p_down(random.randrange(1, max_time)/1000)
  521.         p_up(random.randrange(1, max_time)/1000)
  522.         p_left(random.randrange(1, max_time)/1000)
  523.         p_right(random.randrange(1, max_time)/1000)
  524.         p_up(random.randrange(1, max_time)/1000)
  525.         p_up(random.randrange(1, max_time)/1000, False)
  526.         strat_key_release()
  527.  
  528. # Sentry
  529.  
  530. def sen_shield():
  531.     with ActionInProgress() as action:
  532.         strat_key_press(random.randrange(1, max_time)/1000)
  533.         p_down(random.randrange(1, max_time)/1000)
  534.         p_down(random.randrange(1, max_time)/1000)
  535.         p_left(random.randrange(1, max_time)/1000)
  536.         p_right(random.randrange(1, max_time)/1000)
  537.         p_left(random.randrange(1, max_time)/1000)
  538.         p_right(random.randrange(1, max_time)/1000, False)
  539.         strat_key_release()
  540.  
  541. def sen_gatling():
  542.     with ActionInProgress() as action:
  543.         strat_key_press(random.randrange(1, max_time)/1000)
  544.         p_down(random.randrange(1, max_time)/1000)
  545.         p_up(random.randrange(1, max_time)/1000)
  546.         p_right(random.randrange(1, max_time)/1000)
  547.         p_left(random.randrange(1, max_time)/1000, False)
  548.         strat_key_release()
  549.  
  550. def sen_machine():
  551.     with ActionInProgress() as action:
  552.         strat_key_press(random.randrange(1, max_time)/1000)
  553.         p_down(random.randrange(1, max_time)/1000)
  554.         p_up(random.randrange(1, max_time)/1000)
  555.         p_right(random.randrange(1, max_time)/1000)
  556.         p_right(random.randrange(1, max_time)/1000)
  557.         p_up(random.randrange(1, max_time)/1000, False)
  558.         strat_key_release()
  559.  
  560. def sen_flame():
  561.     with ActionInProgress() as action:
  562.         strat_key_press(random.randrange(1, max_time)/1000)
  563.         p_down(random.randrange(1, max_time)/1000)
  564.         p_up(random.randrange(1, max_time)/1000)
  565.         p_right(random.randrange(1, max_time)/1000)
  566.         p_down(random.randrange(1, max_time)/1000)
  567.         p_up(random.randrange(1, max_time)/1000)
  568.         p_up(random.randrange(1, max_time)/1000, False)
  569.         strat_key_release()
  570.  
  571. def sen_arc_tower():
  572.     with ActionInProgress() as action:
  573.         strat_key_press(random.randrange(1, max_time)/1000)
  574.         p_down(random.randrange(1, max_time)/1000)
  575.         p_up(random.randrange(1, max_time)/1000)
  576.         p_right(random.randrange(1, max_time)/1000)
  577.         p_up(random.randrange(1, max_time)/1000)
  578.         p_left(random.randrange(1, max_time)/1000)
  579.         p_right(random.randrange(1, max_time)/1000, False)
  580.         strat_key_release()
  581.  
  582. def sen_mortar():
  583.     with ActionInProgress() as action:
  584.         strat_key_press(random.randrange(1, max_time)/1000)
  585.         p_down(random.randrange(1, max_time)/1000)
  586.         p_up(random.randrange(1, max_time)/1000)
  587.         p_right(random.randrange(1, max_time)/1000)
  588.         p_right(random.randrange(1, max_time)/1000)
  589.         p_down(random.randrange(1, max_time)/1000, False)
  590.         strat_key_release()
  591.  
  592. def sen_mortar_ems():
  593.     with ActionInProgress() as action:
  594.         strat_key_press(random.randrange(1, max_time)/1000)
  595.         p_down(random.randrange(1, max_time)/1000)
  596.         p_up(random.randrange(1, max_time)/1000)
  597.         p_right(random.randrange(1, max_time)/1000)
  598.         p_down(random.randrange(1, max_time)/1000)
  599.         p_right(random.randrange(1, max_time)/1000, False)
  600.         strat_key_release()
  601.  
  602. def sen_auto_cannon():
  603.     with ActionInProgress() as action:
  604.         strat_key_press(random.randrange(1, max_time)/1000)
  605.         p_down(random.randrange(1, max_time)/1000)
  606.         p_up(random.randrange(1, max_time)/1000)
  607.         p_right(random.randrange(1, max_time)/1000)
  608.         p_up(random.randrange(1, max_time)/1000)
  609.         p_left(random.randrange(1, max_time)/1000)
  610.         p_up(random.randrange(1, max_time)/1000, False)
  611.         strat_key_release()
  612.  
  613. def sen_rocket():
  614.     with ActionInProgress() as action:
  615.         strat_key_press(random.randrange(1, max_time)/1000)
  616.         p_down(random.randrange(1, max_time)/1000)
  617.         p_up(random.randrange(1, max_time)/1000)
  618.         p_right(random.randrange(1, max_time)/1000)
  619.         p_right(random.randrange(1, max_time)/1000)
  620.         p_left(random.randrange(1, max_time)/1000, False)
  621.         strat_key_release()
  622.  
  623. def sen_mines():
  624.     with ActionInProgress() as action:
  625.         strat_key_press(random.randrange(1, max_time)/1000)
  626.         p_down(random.randrange(1, max_time)/1000)
  627.         p_left(random.randrange(1, max_time)/1000)
  628.         p_up(random.randrange(1, max_time)/1000)
  629.         p_right(random.randrange(1, max_time)/1000, False)
  630.         strat_key_release()
  631.  
  632. def sen_mines_incendiary():
  633.     with ActionInProgress() as action:
  634.         strat_key_press(random.randrange(1, max_time)/1000)
  635.         p_down(random.randrange(1, max_time)/1000)
  636.         p_left(random.randrange(1, max_time)/1000)
  637.         p_left(random.randrange(1, max_time)/1000)
  638.         p_down(random.randrange(1, max_time)/1000, False)
  639.         strat_key_release()
  640.  
  641. def sen_mines_tank():
  642.     with ActionInProgress() as action:
  643.         strat_key_press(random.randrange(1, max_time)/1000)
  644.         p_down(random.randrange(1, max_time)/1000)
  645.         p_left(random.randrange(1, max_time)/1000)
  646.         p_up(random.randrange(1, max_time)/1000)
  647.         p_up(random.randrange(1, max_time)/1000, False)
  648.         strat_key_release()
  649.  
  650. def sen_hmg_emplacement():
  651.     with ActionInProgress() as action:
  652.         strat_key_press(random.randrange(1, max_time)/1000)
  653.         p_down(random.randrange(1, max_time)/1000)
  654.         p_right(random.randrange(1, max_time)/1000)
  655.         p_left(random.randrange(1, max_time)/1000)
  656.         p_right(random.randrange(1, max_time)/1000)
  657.         p_right(random.randrange(1, max_time)/1000)
  658.         p_left(random.randrange(1, max_time)/1000, False)
  659.         strat_key_release()
  660.  
  661. def sen_anti_tank_emplacement():
  662.     with ActionInProgress() as action:
  663.         strat_key_press(random.randrange(1, max_time)/1000)
  664.         p_left(random.randrange(1, max_time)/1000)
  665.         p_left(random.randrange(1, max_time)/1000)
  666.         p_up(random.randrange(1, max_time)/1000)
  667.         p_up(random.randrange(1, max_time)/1000)
  668.         p_right(random.randrange(1, max_time)/1000)
  669.         p_left(random.randrange(1, max_time)/1000, False)
  670.         strat_key_release()
  671.  
  672. # Eagle
  673.  
  674. def eagle_five_hundred_kg():
  675.     with ActionInProgress() as action:
  676.         strat_key_press(random.randrange(1, max_time)/1000)
  677.         p_up(random.randrange(1, max_time)/1000)
  678.         p_right(random.randrange(1, max_time)/1000)
  679.         p_down(random.randrange(1, max_time)/1000)
  680.         p_down(random.randrange(1, max_time)/1000)
  681.         p_down(random.randrange(1, max_time)/1000, False)
  682.         strat_key_release()
  683.  
  684. def eagle_airstrike():
  685.     with ActionInProgress() as action:
  686.         strat_key_press(random.randrange(1, max_time)/1000)
  687.         p_up(random.randrange(1, max_time)/1000)
  688.         p_right(random.randrange(1, max_time)/1000)
  689.         p_down(random.randrange(1, max_time)/1000)
  690.         p_right(random.randrange(1, max_time)/1000, False)
  691.         strat_key_release()
  692.  
  693. def eagle_smoke():
  694.     with ActionInProgress() as action:
  695.         strat_key_press(random.randrange(1, max_time)/1000)
  696.         p_up(random.randrange(1, max_time)/1000)
  697.         p_right(random.randrange(1, max_time)/1000)
  698.         p_up(random.randrange(1, max_time)/1000)
  699.         p_down(random.randrange(1, max_time)/1000, False)
  700.         strat_key_release()
  701.  
  702. def eagle_cluster():
  703.     with ActionInProgress() as action:
  704.         strat_key_press(random.randrange(1, max_time)/1000)
  705.         p_up(random.randrange(1, max_time)/1000)
  706.         p_right(random.randrange(1, max_time)/1000)
  707.         p_down(random.randrange(1, max_time)/1000)
  708.         p_down(random.randrange(1, max_time)/1000)
  709.         p_right(random.randrange(1, max_time)/1000, False)
  710.         strat_key_release()
  711.  
  712. def eagle_strafing_run():
  713.     with ActionInProgress() as action:
  714.         strat_key_press(random.randrange(1, max_time)/1000)
  715.         p_up(random.randrange(1, max_time)/1000)
  716.         p_right(random.randrange(1, max_time)/1000)
  717.         p_right(random.randrange(1, max_time)/1000, False)
  718.         strat_key_release()
  719.  
  720. def eagle_napalm():
  721.     with ActionInProgress() as action:
  722.         strat_key_press(random.randrange(1, max_time)/1000)
  723.         p_up(random.randrange(1, max_time)/1000)
  724.         p_right(random.randrange(1, max_time)/1000)
  725.         p_down(random.randrange(1, max_time)/1000)
  726.         p_up(random.randrange(1, max_time)/1000, False)
  727.         strat_key_release()
  728.  
  729. def eagle_110mm():
  730.     with ActionInProgress() as action:
  731.         strat_key_press(random.randrange(1, max_time)/1000)
  732.         p_up(random.randrange(1, max_time)/1000)
  733.         p_right(random.randrange(1, max_time)/1000)
  734.         p_up(random.randrange(1, max_time)/1000)
  735.         p_left(random.randrange(1, max_time)/1000, False)
  736.         strat_key_release()
  737.  
  738. # Vehicle
  739.  
  740. def veh_patriot():
  741.     with ActionInProgress() as action:
  742.         strat_key_press(random.randrange(1, max_time)/1000)
  743.         p_left(random.randrange(1, max_time)/1000)
  744.         p_down(random.randrange(1, max_time)/1000)
  745.         p_right(random.randrange(1, max_time)/1000)
  746.         p_up(random.randrange(1, max_time)/1000)
  747.         p_left(random.randrange(1, max_time)/1000)
  748.         p_down(random.randrange(1, max_time)/1000)
  749.         p_down(random.randrange(1, max_time)/1000, False)
  750.         strat_key_release()
  751.  
  752. def veh_emancipator():
  753.     with ActionInProgress() as action:
  754.         strat_key_press(random.randrange(1, max_time)/1000)
  755.         p_left(random.randrange(1, max_time)/1000)
  756.         p_down(random.randrange(1, max_time)/1000)
  757.         p_right(random.randrange(1, max_time)/1000)
  758.         p_up(random.randrange(1, max_time)/1000)
  759.         p_left(random.randrange(1, max_time)/1000)
  760.         p_down(random.randrange(1, max_time)/1000)
  761.         p_up(random.randrange(1, max_time)/1000, False)
  762.         strat_key_release()
  763.  
  764. def veh_fast_recon():
  765.     with ActionInProgress() as action:
  766.         strat_key_press(random.randrange(1, max_time)/1000)
  767.         p_left(random.randrange(1, max_time)/1000)
  768.         p_down(random.randrange(1, max_time)/1000)
  769.         p_right(random.randrange(1, max_time)/1000)
  770.         p_down(random.randrange(1, max_time)/1000)
  771.         p_right(random.randrange(1, max_time)/1000)
  772.         p_down(random.randrange(1, max_time)/1000)
  773.         p_up(random.randrange(1, max_time)/1000, False)
  774.         strat_key_release()
  775.  
  776. while True:
  777.     event = kp.events.get()
  778.     if event:
  779.         if event.pressed:
  780.             # print("Key pressed:", event.key_number)
  781.         # First Row ###################################################
  782.             if event.key_number == 0:
  783.                 with ActionInProgress():
  784.                     base_resupply()
  785.                     # kbd.press(Keycode.A)
  786.                     # kbd.release(Keycode.A)
  787.             elif event.key_number == 1:
  788.                 with ActionInProgress():
  789.                     gun_laser_cannon()
  790.             elif event.key_number == 2:
  791.                 with ActionInProgress():
  792.                     gun_spear()
  793.             elif event.key_number == 3:
  794.                 with ActionInProgress():
  795.                     gun_heavy_machine()
  796.             elif event.key_number == 4:
  797.                 with ActionInProgress():
  798.                     gun_auto_cannon()
  799.             elif event.key_number == 5:
  800.                 with ActionInProgress():
  801.                     bp_shield_gen()
  802.             elif event.key_number == 6:
  803.                 with ActionInProgress():
  804.                     bp_las_guard_dog()
  805.         # Second Row ###################################################
  806.             elif event.key_number == 7:
  807.                 with ActionInProgress():    
  808.                     sen_machine()
  809.             elif event.key_number == 8:
  810.                 with ActionInProgress():
  811.                     sen_auto_cannon()
  812.             elif event.key_number == 9:
  813.                 with ActionInProgress():
  814.                     sen_mortar_ems()
  815.             elif event.key_number == 10:
  816.                 with ActionInProgress():
  817.                     sen_hmg_emplacement()
  818.             elif event.key_number == 11:
  819.                 with ActionInProgress():
  820.                     bp_jump_pack()
  821.             elif event.key_number == 12:
  822.                 with ActionInProgress():
  823.                     veh_patriot ()
  824.             elif event.key_number == 13:
  825.                 with ActionInProgress():
  826.                     base_seaf_art()
  827.         # Third Row ###################################################
  828.             elif event.key_number == 14:
  829.                 with ActionInProgress():
  830.                     base_renforce()
  831.             elif event.key_number == 15:
  832.                 with ActionInProgress():
  833.                     eagle_airstrike()
  834.             elif event.key_number == 16:
  835.                 with ActionInProgress():
  836.                     eagle_five_hundred_kg()
  837.             elif event.key_number == 17:
  838.                 with ActionInProgress():    
  839.                     eagle_cluster()
  840.             elif event.key_number == 18:
  841.                 with ActionInProgress():
  842.                     orb_napalm_barrage()
  843.             elif event.key_number == 19:    
  844.                 with ActionInProgress():
  845.                     orb_laser()
  846.             elif event.key_number == 20:
  847.                 with ActionInProgress():
  848.                     orb_railcannon_strike()
  849.         # else:
  850.         #     print("Key released:", event.key_number)
  851.  
  852. #
  853.  
Advertisement
Add Comment
Please, Sign In to add comment