Running a script by releasing a Key?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Running a script by releasing a Key?

Post by Amuscaria »

I know you cna bind a Key to a ACS script and then have it activate when you press it, but how to you get a ACS to execute only when you release the key?
User avatar
Risen
Posts: 5263
Joined: Thu Jan 08, 2004 1:02 pm
Location: N44°30' W073°05'

Re: Running a script by releasing a Key?

Post by Risen »

Use a +/- alias, and set the +alias to do nothing while the -alias pukes the script.
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Running a script by releasing a Key?

Post by Amuscaria »

Risen wrote:Use a +/- alias, and set the +alias to do nothing while the -alias pukes the script.
you lost me. o_o
User avatar
Remmirath
Posts: 2562
Joined: Sun Dec 23, 2007 3:53 am
Graphics Processor: nVidia with Vulkan support
Location: My house
Contact:

Re: Running a script by releasing a Key?

Post by Remmirath »

Simple. That should be put in KEYCONF. Read the wiki for more info about the syntax.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: Running a script by releasing a Key?

Post by Ryan Cordell »

addmenukey "Switch HUD" +gs_hudswitch
alias +gs_hudswitch "take RC_GS_DarkHud; give RC_GS_FutureHud"
alias -gs_hudswitch "take RC_GS_FutureHud; give RC_GS_DarkHud"
defaultbind h +gs_hudswitch

Take this for example.
+gs_hudswitch is when you're PRESSING the weapon
-gs_hudswitch is when you're NOT pressing the weapon.

Considering KEYCONF is merely a cuter way of default-izing several console commands, anything you could do in the console you could (In theory, I guess.) do in KEYCONF's options.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: Running a script by releasing a Key?

Post by HotWax »

Blade Nightflame wrote:Take this for example.
+gs_hudswitch is when you're PRESSING the weapon
-gs_hudswitch is when you're NOT pressing the weapon.
More accurately, +gs_hudswitch executes once when you press the key, and -gs_hudswitch executes once when you release the key.

If you simply want a key to puke a script on release, set up a bind like this:

Code: Select all

alias +script_run "wait"
alias -script_run "puke 100"
bind X +script_run
When you press X, +script_run executes, which does nothing. When X is subsequently released, -script_run executes and pukes script 100. The + symbol at the start of the bind is what tells ZDoom to look for and execute a matching command beginning with - on release. It is automatic.
User avatar
Ryan Cordell
Posts: 4349
Joined: Sun Feb 06, 2005 6:39 am
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia (Modern GZDoom)
Location: Capital of Explodistan

Re: Running a script by releasing a Key?

Post by Ryan Cordell »

Now how would a toggle-able version work though?
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: Running a script by releasing a Key?

Post by Amuscaria »

oh i see. :D Thanks
Locked

Return to “Editing (Archive)”