Garry's Mod

Garry's Mod

Not enough ratings
Rapidfire script for the lazy people [ The Linux Way]
By /run/udev/roofox
A rapidfire script for GMod for doing those long hours of trying to spawn 5,000 props and destroying them to do all of them in a short amount of time, a little guide I've created for Linux users who play GMod.
   
Award
Favorite
Favorited
Unfavorite
Introduction:
Find it being too much effort to obtain those certain GMod achievements where you got to spawn 5,000 props and remove them? or spawn ragdolls? or opening the spawn menu 10,000 times… It does get a little bit tiring and boring having to try do that. So I've created this guide, intended for those on Linux who play GMod.

My way was a little simple, but in just a short time you'll be able to complete those achievements in as little as 45 minutes or less. You can also probably use this for other games too for rapid fire. You might have to modify the script so it activates on button press. This rapidfire script will just automatically fire the keys when just run as it is. A similar way of a rapidfire script can be done on Windows by using AHK, but that is completely different from the following below.
xdotool
You will need to make sure you have the package xdotool installed on your system before you can use this rapidfire script.

Q): What is xdotool?
A): xdotool simulates X11 keyboard and mouse input, xdotool can let you programmatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11's XTEST extension and other Xlib functions.

if you're on Debian system you can install it by doing from Terminal: (ignore the '$' at the start as this is start of terminal command line)
$ sudo apt-get --install-suggests install xdotool

once installed you should be good to go.
Rapidfire script
I've included some small set instructions to give you a helping hand if you're not sure what to change to suit your needs.

#!/bin/bash ## RapidFire Script v0.1 ## this is a rapidfire script designed to ## simulate key or mouse presses in rapid succession ## ## the following line for xdotool searches for the ## window name in the quotes there. You can hange it ## to match whatever window name you're using it for. winid=$(xdotool search "Garry's Mod - OpenGL" | head -n1) while true do # echo spams terminal with message tell you its running. # Edit out '| echo "" ' part if don't want it to spam terminal output. # # only modify what's in the quotes after $winid to whatever button # MOUSE: Left = 1, Middle = 2, Right = 3 # If you want to use Key Modifiers, ie; Ctrl, Alt, Shift, etc... # look at 'man xdotool' on how to use them. # # you can probably make rapidfire even faster if you repeat the # same lines a couple times, I probably wouldn't do any more than 2-3 xdotool mousedown --window $winid "1" | echo "RapidFire: Mouse 1 [DOWN]" xdotool mouseup --window $winid "1" | echo "RapidFire: Mouse 1 [UP]" xdotool mousedown --window $winid "3" | echo "RapidFire: Mouse 3 [DOWN]" xdotool mouseup --window $winid "3" | echo "RapidFire: Mouse 3 [UP]" xdotool keydown --window $winid "z" | echo "RapidFire: Z [DOWN]" xdotool keyup --window $winid "z" | echo "RapidFire: Z [UP]" done exit 0 ## The instruction for the script to work is pretty straight forward. ## Modify the buttons and keys as you see fit to suit your layout. ## --------------------------------------------------------------\ ## press ^C to stop when done. \ ## \ ## see manpage for 'xdotool' to see more options. \ ## http://www.semicomplete.com/projects/xdotool/xdotool.xhtml \ ## --------------------------------------------------------------\

Save that to file and put it somewhere you can remember it, and call it whatever you want. ie; rapidfire.sh

then set execute permissions on to the file by doing in terminal;
(do not include the '$' at the beginning there, that is start of command line)

$ chmod +x rapidfire.sh
and run it from terminal by doing;
$ ./rapidfire.sh

Pressing ^C (Ctrl+C) will stop the script from running when you're done.

This rapidfire script should work with other stuff, it can work with emulators where button input may be too slow for games that require rapid button input. You're free to modify and use the script as you see fit, what you do with it is up to you. I'm only merely showing a way to do rapidfire input in a quick clean simple way on Linux.
1 Comments
point_mei Nov 21 @ 12:34pm 
I love xdotool! I love xdotool!!!!