If(KeyDown...

Moderator: GZDoom Developers

User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

If(KeyDown...

Post by Xaser »

While ACS-based menus are rather nifty, it's often a hassle to force the player to define new keys for the sole purpose of moving a menu around. Here's an idea that might do something to help...

Code: Select all

If(KeyDown("key")==1 or 0) { ...
where "key" corresponds to a certain key on the keyboard (not "key" as in "keycard", mate). You can additionally specify whether to execute the sub-block if the key is held down (1) or not (0).

Additionally, you could, instead of specifying a specific key, give an action name instead. So, using "+FORWARD" would check for whatever the 'move forward' key is, regardless of configuration.

Not sure if this is within engine limits, but it would really help to have some sort of a way to create a menu without relying on awkward custom bindings.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: If(KeyDown...

Post by HotWax »

I second this suggestion, but propose an alteration.

Instead of allowing any keyboard key to be checked, only allow bindings to be checked. That way, instead of forcing the user to use "Cursor Down" for your menu, you can just check MENU_DOWN (or whatever the CCMD is) and react accordingly. It should also allow custom bindings specified in KEYCONF for maximum flexibility. The advantage of doing it this way is it's still ultimately up to the user what controls do what.

It's too bad ACS can't handle event-based triggering.... ;)
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: If(KeyDown...

Post by Xaser »

Hmm... you've got a point there. Funny I didn't see it the first time around, but checking for specific keys probably would be problematic. Imagine if a script wanted the user to press the 'K' key to continue, not realizing that the player had bound his 'K' key to "kill". ;P
User avatar
Demolisher
Posts: 1749
Joined: Mon Aug 11, 2008 12:59 pm
Graphics Processor: nVidia with Vulkan support
Location: Winchester, VA
Contact:

Re: If(KeyDown...

Post by Demolisher »

Xaser wrote:Hmm... you've got a point there. Funny I didn't see it the first time around, but checking for specific keys probably would be problematic. Imagine if a script wanted the user to press the 'K' key to continue, not realizing that the player had bound his 'K' key to "kill". ;P

Code: Select all

Print(s:"Press ",k:"+use",s:" to continue.")
User avatar
Nash
 
 
Posts: 17500
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: If(KeyDown...

Post by Nash »

That doesn't solve anything, Demolisher. Xaser wants a way to retrieve a key binding OUTSIDE of the print function, so he can do things like an in-game menu that is controllable with the user's movement keys.

This would also ditch the need to teleport the player in a control sector for the vehicles in my zombie mod. If this was implemented I can control my car directly instead of relying on the player bumping into trigger linedefs in the control sector.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: If(KeyDown...

Post by HotWax »

Nash wrote:That doesn't solve anything, Demolisher.
It doesn't solve anything now, but if this suggestion was implemented to only allow for the reading of binds, it would work great in concert.

Code: Select all

Print (s:"Press ", k:"+use", s:" to continue.");

while (!KeyDown("+use")) delay(1);

Print (s:"Yay!  We're continuing!");
User avatar
Grubber
Posts: 1031
Joined: Wed Oct 15, 2003 12:19 am
Location: Czech Republic
Contact:

Re: If(KeyDown...

Post by Grubber »

I've seen that before...
User avatar
Isle
Posts: 687
Joined: Fri Nov 21, 2003 1:30 am
Location: Arizona, USA

Re: If(KeyDown...

Post by Isle »

eh, you can get most of em with a little work.
+use? [wiki=Classes:SecActUse]sector action[/wiki]
attack buttons? acs_execute on a decorate weapon
movement keys? lock him somewhere and poll his position change every tic.
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Re: If(KeyDown...

Post by HotWax »

What about menu up and down?
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: If(KeyDown...

Post by Xaser »

All these workaraounds won't mean a thing if I'm not modifying the maps. 'Tis the problem.

Eh, if this is not doable, a proper way to define ACS menus would be nice. Perhaps a special script type where you can define a list of 'choices' and the game will allow you to use up/down and choose them like you would in a regular menu. Something like that anyhow.
Gez
 
 
Posts: 17946
Joined: Fri Jul 06, 2007 3:22 pm

Re: If(KeyDown...

Post by Gez »

Xaser wrote:Eh, if this is not doable, a proper way to define ACS menus would be nice. Perhaps a special script type where you can define a list of 'choices' and the game will allow you to use up/down and choose them like you would in a regular menu. Something like that anyhow.
Strife conversation?
User avatar
Xaser
 
 
Posts: 10774
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: If(KeyDown...

Post by Xaser »

Actually that's what I'm using for the time being. The problem is it's very uncustomizable and again, you have to attach it to a map in order for it to work. Granted, I don't actually have to modify the maps to get it to work, but what if I'm trying to play the mod on a map named, say, GUSTAV instead of MAP01?

Considering the death of the earlier mention of this, maybe it would just be wise for me to start a seperate thread for the menu feature. Why not something that works similarly to Strife's dialogue system only the graphics shown and locations of selectable items could be customized? Not as flexible as KeyDown but it'll do in a pinch.
User avatar
randi
Site Admin
Posts: 7749
Joined: Wed Jul 09, 2003 10:30 pm
Contact:

Re: If(KeyDown...

Post by randi »

You got your wish, sort of. ACS now has access to the same player inputs that the normal play simulation does. See the example map with r1215.
User avatar
Nash
 
 
Posts: 17500
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: If(KeyDown...

Post by Nash »

HOLY FREAKING CRAP!

This was one of the last things I thought would see the light of day!

Suddenly, so many possibilities have opened...

This is going to make drivable vehicles sooooooooooo much easier. Can't wait to implement this into my zombie mod...
User avatar
Project Shadowcat
Posts: 9369
Joined: Thu Jul 14, 2005 8:33 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: Blacksburg, SC USA
Contact:

Re: If(KeyDown...

Post by Project Shadowcat »

Nash wrote:HOLY FREAKING CRAP!

This was one of the last things I thought would see the light of day!

Suddenly, so many possibilities have opened...

This is going to make drivable vehicles sooooooooooo much easier. Can't wait to implement this into my zombie mod...
ZDoom, the Shmup, here I come!!!
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”