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]
Reply

#2
bind YOURZOOMKEY "+zoom; cl_zoomfactor 5"
bind MOUSE4 "+zoom; cl_zoomfactor 4.5"
bind MOUSE5 "+zoom; cl_zoomfactor 5.5"
[Image: 21.png]
IRC (QuakeNet): #bot.xonotic | #xonotic.pickup | #xonotic | #xonotic.cup
Steam | Twitch.tv | YouTube
Movies: Mirification #1 | #2 | Mirificaption #1 | #3 | #4 | [BOT] Clan #3 | #5 | #6 | #7 | [BOT] Clan #4 | #8

Reply

#3
Not what I want. I want Mouse4 and Mouse5 to change the variable no matter what value it is.
[Image: 89685.png]
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
[Image: 21.png]
IRC (QuakeNet): #bot.xonotic | #xonotic.pickup | #xonotic | #xonotic.cup
Steam | Twitch.tv | YouTube
Movies: Mirification #1 | #2 | Mirificaption #1 | #3 | #4 | [BOT] Clan #3 | #5 | #6 | #7 | [BOT] Clan #4 | #8

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]
Reply

#6
Not possible without some mad alias script.
[Image: 21.png]
IRC (QuakeNet): #bot.xonotic | #xonotic.pickup | #xonotic | #xonotic.cup
Steam | Twitch.tv | YouTube
Movies: Mirification #1 | #2 | Mirificaption #1 | #3 | #4 | [BOT] Clan #3 | #5 | #6 | #7 | [BOT] Clan #4 | #8

Reply

#7
So, I need to do this a lot:
Code:
if cl_zoomfactor == 5 then set cl_zoomfactor 5.5
[Image: 89685.png]
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]
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.png]
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  Change the demo record + videos destination path? Formhault 7 4,326 08-10-2014, 04:29 PM
Last Post: Formhault

Forum Jump:


Users browsing this thread:
1 Guest(s)

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