Page 1 of 1

The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Sun Jul 12, 2015 12:07 am
by MaxRideWizardLord
Hello people of Zandronum.

Are you tired of heartlessly smashing your computer mouse buttons till your fingers start bleeding, and then buying new computer mouse over and over because of how often some crappy mods like demonsteele requires way too much intense clicking? Not anymore!

I'd like to introduce you to my toggleable turbo button for autofire that works both for primary attack and alt attack and is quite smooth, even on Zandronum!

Code: Select all

Name=toggleautofire
Command=toggleautofireon
Name=toggleautofireon
Command=bind mouse1 "+autoattack";bind mouse2 "+autoaltattack";echo "auto-attack on";alias toggleautofire toggleautofireoff"
Name=toggleautofireoff
Command=bind mouse1 "+attack";bind mouse2 "+altattack";echo "auto-attack off";alias toggleautofire toggleautofireon"
Name=+autoattack
Command=alias autoattack_+fire "+attack;wait;autoattack_+fire";alias autoattack_-fire "-attack;wait;autoattack_-fire";autoattack_+fire;wait 2;autoattack_-fire
Name=-autoattack
Command=alias autoattack_+fire "";alias autoattack_-fire "";wait 2;-attack
Name=+autoaltattack
Command=alias autoaltattack_+fire "+altattack;wait;autoaltattack_+fire";alias autoaltattack_-fire "-altattack;wait;autoaltattack_-fire";autoaltattack_+fire;wait 2;autoaltattack_-fire
Name=-autoaltattack
Command=alias autoaltattack_+fire "";alias autoaltattack_-fire "";wait 2;-altattack
Just copy the text in the quotes, open your zandronum-username.ini in your ZandroDev folder, and paste it under your [Doom.ConsoleAliases] paragraph (use ctrl+f if you struggle to find it). Click "Save the Changes" and now you have the script installed. Make sure you're not in the game while doing this process, though.

After you've done that, you can simple bind the "toggleautofire" command to any of your buttons through the console. For example - write "bind mouse3 toggleautofire" if you want to bind it to middle wheel mouse button. So now you have it!

Once you push the button you bind with "toggleautofire", at the left top of the screen it will say "auto-attack on", means your left and right mouse buttons are now turbo. If you push the binded button with the "toggleautofire", it will say "auto-attack off", and your left and right mouse button will be set back to default +attack and +altattack with default attack mode.



I've made it to be a toggleable button for a good reason, so in case you have normal classic computer mouse and normal classic keyboard, you wouldn't have much of extra buttons in order to bind this thing. However, in case you have quite expensive mouse with lots of extra buttons, you can bind the turbo attacks to them separately: +autoattack for primary fire and +autoaltattack for secondary fire.

Unfortunately, Zandronum has this unpleasant issue with wait command which causes every wait to have +1 extra tic, which causes the wait command have extra +1 tic for each wait, which results wait to behave like this: wait = 2 tic; wait 2 = 3 tic, wait 3 = 4 tic and etc.

I know I'm not the first one who did attempt at making this turbo script, but often they happened to be lousy as they have way too big delay before each 'fire'. I've spend fairly amount of time to figure out how to make my aliasing be more smooth, but the idea of how to upgrade my script become more clear after I found out about the wait "+1" issue. The script now works pretty smooth and have behavior like this: it 'fires' at 0th tic, 2th tic, 3th tic, 4th tic, 5th tic, 6th tic, 7th tic and every single tic afterwards as long as you hold the 'fire' button. Unfortunately it's impossible to make the script fire at 1th tic due the above mentioned "wait +1" bug.

Note: the 1 tic is 1/35 of one second, wait 1 has = 1 (+1) tic, means that wait 34 = one second delay.

Special thanks goes to #Zandronum IRC channel, specifically Leonard to let me know about this infamous "wait +1" bug that still remain in current Zandronum. However, is it fixed in the last beta version of Gzdoom. I've heard that you may as well fix the "wait +1" bug manually yourself, but this may result of you being unable to connect to most of the modded servers, or result the wait command of certain mods not work as intended, so I'd suggest better to not risk. Once the issue will be fixed, I will try to simplify the script code.

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Sun Jul 12, 2015 3:27 am
by Ænima
Neato. I'm gonna bind these to my PS3 controller so it'll feel like the good old days of turbo controllers. Then I'll try it with every mod that uses +Weapon.NOAUTOFIRE, including my own.

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire

Posted: Sun Jul 12, 2015 4:01 pm
by Lord Smash
This will surely be useful
Thanks a lot :razz:

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Sun Jul 12, 2015 5:57 pm
by Ivan
tl;dr it makes you fire constantly? That's already possible. Click fire while pressing your talk key and press ESC. You'll keep firing.

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Sun Jul 12, 2015 6:37 pm
by Empyre
No, this will act like you're pressing fire repeatedly several time a second for as long as you hold the fire button, useful for those mods with weapons that don't repeat when you hold the fire button.

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Wed Jul 15, 2015 12:35 am
by Dastan
Thanks a lot for making this, it's helpful!
Wish you the best with your next projects. :wink:

Possible workaround

Posted: Wed Jul 15, 2015 12:45 pm
by Klofkac
I have found a way how to get 1 tic delay even through this wait bug. The downside is though that the initial command delay will always be 2 tics no matter what.
Zandronum has an "exec" command, that parses a file and reads it as commands. All commands on their respective lines are run independently, the semicolon still works like in aliases.

So, with this knowledge, I created slightly different version of the autofiring aliases:

Code: Select all

name=+autoattack
command=set is_firing 1;+attack;exec attack.txt
name=-autoattack
command=set is_firing 0;wait;-attack
name=+autoaltattack
command=set is_altfiring 1;+altattack;exec altattack.txt
name=-autoaltattack
command=set is_altfiring 0;wait;-altattack

Code: Select all

wait;-attack; test $is_firing "exec attack.txt" 
wait 2;+attack

Code: Select all

wait;-altattack; test $is_altfiring "exec altattack.txt" 
wait 2;+altattack
The difference between +attack and -attack will be 1 tic. Delay between first and second attack should be 2 tics.
So, this should work just like the code in OP, but slightly less complicated coding-wise.

Only downside is, you need an external file for this to work.

It is (or should be) compatibile with the above toggler aliases.

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Wed Jul 15, 2015 2:54 pm
by agaures
You know... autoclicker is a thing...

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Wed Jul 15, 2015 5:06 pm
by Ænima
agaures wrote: You know... autoclicker is a thing...
Oh yeah. Input macro software works too.

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Sun Aug 16, 2015 10:51 pm
by Zanieon
Hum, bumping this to say that this script doesn't work like Autoclicker or either Input Macro, the script only executes while you hold the button and is switchable.

For me, this is more flexible and better controlled by the user than Autoclicker.

Also welcome to the forums dude (1 post epic-win title)

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Mon Aug 17, 2015 12:29 am
by [DD]Aladdin
Nice Work body keep going

RE: The Perfect-Working Zandronum Toggleable Turbo Button Script For Autofire - for Free!

Posted: Mon Aug 17, 2015 2:02 am
by Konda
Klofkac wrote: I have found a way how to get 1 tic delay even through this wait bug. The downside is though that the initial command delay will always be 2 tics no matter what.
Zandronum has an "exec" command, that parses a file and reads it as commands. All commands on their respective lines are run independently, the semicolon still works like in aliases.

So, with this knowledge, I created slightly different version of the autofiring aliases:

Code: Select all

name=+autoattack
command=set is_firing 1;+attack;exec attack.txt
name=-autoattack
command=set is_firing 0;wait;-attack
name=+autoaltattack
command=set is_altfiring 1;+altattack;exec altattack.txt
name=-autoaltattack
command=set is_altfiring 0;wait;-altattack

Code: Select all

wait;-attack; test $is_firing "exec attack.txt" 
wait 2;+attack

Code: Select all

wait;-altattack; test $is_altfiring "exec altattack.txt" 
wait 2;+altattack
The difference between +attack and -attack will be 1 tic. Delay between first and second attack should be 2 tics.
So, this should work just like the code in OP, but slightly less complicated coding-wise.

Only downside is, you need an external file for this to work.

It is (or should be) compatibile with the above toggler aliases.
Another advantage of this script is the fact that it doesn't automatically bind the user's controls like in OP. I think I'll take both scripts posted here and use yours until the bug it utilizes is fixed, hopefully the wait bug will also be fixed around the same time.

Also I'm wondering if something like this can contribute to being kicked for client command flood.