Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] How to configure long press buttons?

#1
I wonder if it's possible to map different functions to a short press and a long press of a button. E.g. in Overkill: short press alternate fire = laser, long press alternate fire = execute laser jump script. Or in Minsta|Hook: short press fire = fire, long press fire = hook.

Controls are quite complex in Xonotic, I'm trying to make things a bit easier for me.

Related to this topic another question: Why does the following script work in local games but not on an actual server (Nexuiz 2.5.2)?

alias +my "+attack;wait:-attack;wait;+hook"
alias -my "-hook"
bind mouse1 +my

In a local game this script fires the minsta on a short press. If I keep mouse1 pressed, it also shoots the hook. On the server it only shoots the hook.

Thanks for your help!
Reply

#2
Your script probably doesn't work because "wait" waits one client frame. It's probably too fast to be sent to the server at all. Use defer 0.1 -attack instead of wait; -attack. Please be aware that the kind of thing you're trying to achieve might end up looking suspicious to a spectator. You might be accused of cheating.

There is no long press / short press. That would probably be hackable in cfg though. However, we have builtin weapon list capabilities. You can assign several weapons in a list and have a key cycle through that list. I don't know if that's documented. Check out the cl_weaponpriority0 to cl_weaponpriority9 cvars. Their description explains how to use them.
Reply

#3
Thanks Mr. Bougo. Makes sense. I'll try defer 0.1 when I'm back home.

What do you mean with "cycle through that list"? Does this mean a single press will e.g. fire the nex, switch to mortar, fire mortar and switch back to nex? This would be very effective!
Reply

#4
I would strongly advise against using a script that does automatic laser jumps or weapon combos for you, especially by using "long press" key binds. The concerns I would have are:
  • Using long and short key presses will mean moving the action from the "attack" key press phase to the "release" key press phase, so that the weapon fires upon release of the key rather than the pressing of the key. This will feel very unnatural at first, and break any muscle memory you built up so far (of course you can re-learn it so it won't feel weird then anymore).
  • Xonotic gameplay is way too fast for allowing weapon control/movement input to wait for determining whether the key has been pressed long or short. The game play requires you to react fast, you cannot do that if your client is waiting to find out whether this will be a long press or a short press.
  • You won't be able to make use of special abilities of weapons that already distinguish between "attack" and "release" phases of a key stroke such as rocket launcher and crylink.
  • Using predefinied weapon combo scripts will make it hard for you to learn how to choose the right weapon for the job. Of course you can rely on the general usefulness of the versatile nex mortar combo, but in the end there are more effective combos at times and on the longrun you'll benefit from learning to combo on-the-fly, rather than working off combo scripts.
  • You will always need the required weapons for your combo scripts, otherwise they might not work at all or not as expected. For example if you happen to have only mortar and rocket launcher a combo might turn out to be really painful in closed quarters (and trust me, I know what I'm talking about, I use that combo a lot). Not to mention weapons that are not really usable in "standard" fire-switch-fire combos such as hagar or mg.
  • Things like laser jumps need to be timed precisely in order to have the desired effect. The time and the angle of the laser shot differs depending on the movement speed you have and how high you want to jump or how much forward speed you want to get.

If controls are confusing for you, try to figure out a keyboard layout that you can work with, this already helps a lot after a short while of learning. The gameplay basics may be more complicated than some other games' controls, but complexity allows for versatility, too. I would like to encourage you to experiment with weapon binds and practice a bit more, maybe take part in a short personalized tutorial many advanced players will be happy to do for you (if not, find me on IRC, I'll do it). But please don't try to script yourself an autopilot for the game, then it would be easier to just spec a bot and pretend you're playing.Cool

Edit: IF you want to spec bots, make sure you spec bots such as [BOT]Mirio, [BOT]Grunt, [BOT]kuniuthefrogg or [BOT]naryl. Speccing them can be a very rewarding experience, but unfortunately you can do that only on special servers. Despite frantic attempts I have not been able so far to enable those bots on local servers. I think you need to do some custom compiling in order to get such advanced bots locally, dunno why Xonotic doesn't ship with the code. Maybe it includes some proprietary code or something. Also I have heard that maps may need to be compiled with special waypoints so those bots work properly, but I can't personally verify that one. To me, they seem to work almost on any map pretty well. Anyway, that was a bit off topic. Sorry.
My Xonstats Profile
Latest track on soundcloud: Farewell - to a better Place (piano improvisation)
New to Xonotic? Check out the Newbie Corner!

Reply

#5
(04-10-2012, 04:56 AM)Micha Wrote: Thanks Mr. Bougo. Makes sense. I'll try defer 0.1 when I'm back home.

What do you mean with "cycle through that list"? Does this mean a single press will e.g. fire the nex, switch to mortar, fire mortar and switch back to nex? This would be very effective!

Yep, that's it. Each of the ten lists has three impulse codes associated with it, that you can bind to a key. There's the next/prev keys that navigate through the list, and the "best" key that switches to the first weapon from the list that's in your inventory. Give it a try! Here's the relevant section of defaultXonotic.cfg, reformatted a bit for readability:

Code:
//"use impulse 200 for prev gun from this list, 210 for best gun, 220 for next gun.  Default value: explosives"
seta cl_weaponpriority0 "rocketlauncher grenadelauncher hagar seeker fireball"

//"use impulse 201 for prev gun from this list, 211 for best gun, 221 for next gun.  Default value: energy"
seta cl_weaponpriority1 "minstanex nex crylink hlac electro laser"

//"use impulse 202 for prev gun from this list, 212 for best gun, 222 for next gun.  Default value: hitscan exact"
seta cl_weaponpriority2 "minstanex nex rifle"

//"use impulse 203 for prev gun from this list, 213 for best gun, 223 for next gun.  Default value: hitscan all"
seta cl_weaponpriority3 "minstanex nex rifle uzi shotgun"

//"use impulse 204 for prev gun from this list, 214 for best gun, 224 for next gun.  Default value: spam weapons"
seta cl_weaponpriority4 "grenadelauncher minelayer hlac hagar crylink seeker shotgun"

//"use impulse 205 for prev gun from this list, 215 for best gun, 225 for next gun.  Default value: weapons for moving"
seta cl_weaponpriority5 "laser hook porto"

//"use impulse 206 for prev gun from this list, 216 for best gun, 226 for next gun"
seta cl_weaponpriority6 ""

//"use impulse 207 for prev gun from this list, 217 for best gun, 227 for next gun"
seta cl_weaponpriority7 ""

//"use impulse 208 for prev gun from this list, 218 for best gun, 228 for next gun"
seta cl_weaponpriority8 ""

//"use impulse 209 for prev gun from this list, 219 for best gun, 229 for next gun"
seta cl_weaponpriority9 ""
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [SOLVED] Can I disable "while in the midair press jump and jetpack is activated" zwz 2 4,064 04-21-2015, 02:06 PM
Last Post: BuddyFriendGuy
  [SOLVED] Long waiting time when connecting to a server TheGoodGamer 3 5,673 10-20-2013, 07:18 AM
Last Post: TheGoodGamer
  [SOLVED] Multiple key press problem ZxEfR 3 5,749 06-16-2013, 04:52 AM
Last Post: Mr. Bougo
  [SOLVED] how should I configure my network settings Shadowman84 1 5,514 09-03-2012, 06:35 AM
Last Post: zykure
  [SOLVED] MergeMetaTriangles takes very long time... [SOLVED] kuniu the frogg 11 12,423 11-30-2010, 04:37 AM
Last Post: kuniu the frogg

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB original theme © iAndrew 2016, remixed by -z-