Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] How do I change a variable by 0.5 when a key is pressed?

#1
I'd like to set cl_zoomfactor to cl_zoomfactor + 0.5 when Mouse5 is pressed and to cl_zoomfactor - 0.5 when Mouse4 is pressed. How can I do this?
[Image: 89685.png]

Join Jeff's Discord Server: https://discord.gg/vkgxVQ4
Join Jeff's IRC Channel: #jeff-xonotic @ irc.quakenet.org

Server IPs:
Jeff Vehicle Warfare: 178.32.217.17:26010
Jeff & Julius Resurrection Server: 178.32.217.17:26015
Reply

#2
bind YOURZOOMKEY "+zoom; cl_zoomfactor 5"
bind MOUSE4 "+zoom; cl_zoomfactor 4.5"
bind MOUSE5 "+zoom; cl_zoomfactor 5.5"
Reply

#3
Not what I want. I want Mouse4 and Mouse5 to change the variable no matter what value it is.
[Image: 89685.png]

Join Jeff's Discord Server: https://discord.gg/vkgxVQ4
Join Jeff's IRC Channel: #jeff-xonotic @ irc.quakenet.org

Server IPs:
Jeff Vehicle Warfare: 178.32.217.17:26010
Jeff & Julius Resurrection Server: 178.32.217.17:26015
Reply

#4
Adjust the binds then, unless you're telling me that you have several binds to change the zoomfactor.
0.5 is literally no change at all anyway. Tongue
Reply

#5
What I want is:

Zoomfactor is 10
I press m5
Now it's 10.5
I press m4 11 times
Now it's 5

This thing in JS (pseudocode):
mouse4.on("click", => {cl_zoomfactor = cl_zoomfactor - 0.5});
mouse5.on("click", => {cl_zoomfactor = cl_zoomfactor + 0.5});
[Image: 89685.png]

Join Jeff's Discord Server: https://discord.gg/vkgxVQ4
Join Jeff's IRC Channel: #jeff-xonotic @ irc.quakenet.org

Server IPs:
Jeff Vehicle Warfare: 178.32.217.17:26010
Jeff & Julius Resurrection Server: 178.32.217.17:26015
Reply

#6
Not possible without some mad alias script.
Reply

#7
So, I need to do this a lot:
Code:
if cl_zoomfactor == 5 then set cl_zoomfactor 5.5
[Image: 89685.png]

Join Jeff's Discord Server: https://discord.gg/vkgxVQ4
Join Jeff's IRC Channel: #jeff-xonotic @ irc.quakenet.org

Server IPs:
Jeff Vehicle Warfare: 178.32.217.17:26010
Jeff & Julius Resurrection Server: 178.32.217.17:26015
Reply

#8
Code:
alias morezoom "menu_cmd rpn /cl_zoomfactor cl_zoomfactor 0.5 add def"
alias lesszoom "menu_cmd rpn /cl_zoomfactor cl_zoomfactor 0.5 sub def"
bind m4 morezoom
bind m5 lesszoom
Reply

#9
Thanks!

Sadly has no limit
[Image: 89685.png]

Join Jeff's Discord Server: https://discord.gg/vkgxVQ4
Join Jeff's IRC Channel: #jeff-xonotic @ irc.quakenet.org

Server IPs:
Jeff Vehicle Warfare: 178.32.217.17:26010
Jeff & Julius Resurrection Server: 178.32.217.17:26015
Reply

#10
If you want something more complex, here is a lot more info about our RPN scripting. You can probably find more examples on the forums or in cfg files.
[Image: 30381.jpg]

<packer> when i see martin-t's name my blood pressure increases

<[BOT]Hоtdоg> anyone here lives near martin?
<[BOT]Hоtdоg> will pay monies for shooting him
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Remove/Change playermodel and model name ArenaVet2008 1 1,541 12-21-2022, 08:40 PM
Last Post: ballerburg9005
  How to bind several actions to a key? voice 5 7,569 03-21-2020, 04:27 PM
Last Post: martin-t
  Change the demo record + videos destination path? Formhault 7 9,579 08-10-2014, 04:29 PM
Last Post: Formhault
  key bindings to rotate weapons after shooting? zim2dive 7 7,798 12-24-2011, 05:17 AM
Last Post: tZork

Forum Jump:


Users browsing this thread:
1 Guest(s)

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