Jump to content
Sign in to follow this  
Cyborg11

GlovePIE Script: Zoom with your mousewheel

Recommended Posts

Today I wrote a GlovePIE script to zoom with the mouse wheel.

I hate it to zoom with FreeTrack so I decided to write a script to change that :)

Requirements:

Tutorial to install PPJoy on Windows Vista / 7 64 Bit:

ScuYfagMixU

You have to activate the test mode to install the unsigned driver from PPJoy. Easiest way to do that is to use the Driver Signatur Enforcement Overrider.

I included the line to fix the Throttle axis. If you don't want to use it, you don't have to. :D For more information see this thread by TheHarvesteR.

// Script by Cyborg11
// @ 05.11.2010
// v1.1
// Joystick Fix (Full Throttle) by TheHarvesteR (First line)
//   http://forums.bistudio.com/showthread.php?t=108410
// Description:
// With this script you can zoom with your mouse wheel
// - Press Ctrl + Alt + Space to change the toggle mode
// - Toggle mode means that you have to press the activate (default: Shift + B)
//   only once to zoom everytime with your mousewheel.
// - Non-Toggle mode means that you have to hold the activate key to zoom
// - Shift + B + Spacebar is the Reset button

// In the block below you can change the keys, the default toggle value
// (default: false -> Non-Toggle mode) and the sensitive of the zoom levels
// 120 means 2 zoom levels (2x zoom in / 2x zoom out)
// 240 means 4 zoom levels (4x zoom in / 4x zoom out)
// 360 means 6 zoom levels (6x zoom in / 6x zoom out)
// 480 means 8 zoom levels (8x zoom in / 8x zoom out)

// Changelog
// v1.1
// - Fixed: Toggle Zoom
// - Added: Zooming is disabled when chatting (because Backspace is running every
//          10ms to prevent the menu from showing every time you zoom)
// - Added: Now you can aim while holding the right mouse button.
//          That means that you have to hold the right mousebutton to look through
//          the ironsight/scope. To use it you have to remove the 'Right Mousebutton'
//          from the optics in the controls and set the
//          variable 'var.aimwhileholding' to true. Uses the 0 button on the numpad
//          for the optics (default for optics in arma).
//          (Requested by: ])rStrangelove => http://forums.bistudio.com/showpost.php?p=1780768&postcount=5)
// v1.0
// - Release

Download: http://cyborg11.cy.funpic.de/ArmA2/Downloads/ArmA2.PIE

Usage:

  • Open the script ArmA2.pie with GlovePIE, change the keys and click on the Run button
  • Start ArmA 2 and go to your Controls
  • Scroll down to the entries "Zoom in (continuous)" and "Zoom out (continuous)"
  • "Zoom in (continuous)" should be "PPJoy Virtual Stick X- Rotate" (mousewheel up - scroll fast so ArmA 2 can recognize the axis)
  • "Zoom out (continuous)" should be "PPJoy Virtual Stick X+ Rotate" (mousewheel down - scroll fast so ArmA 2 can recognize the axis)
  • Stop the script
  • Set the variable 'var.firstSetup' to false
  • Restart the script and have fun

If you can't set the axis ingame don't worry. Open your YourName.ArmA2OAProfile file in your Documents \ ArmA 2 folder, scroll down to "keyZoomContIn" and change it to this:

keyZoomContIn[]={524299,198147};
keyZoomContOut[]={524293,198155};

Edited by Cyborg11

Share this post


Link to post
Share on other sites

Hehe, I was about to reply to your question about this on my thread, but I see you've got it down already :)

I wondered how you planned to use the mousewheel for zoom without disturbing the default setting... Nice job with the modes there!

Isn't GlovePIE awesome? :bounce3:

Cheers

Share this post


Link to post
Share on other sites

One idea that springs to mind would be to do mousewheel or mouse x axis movement + modifier key (eg ctrl) to do lean settings, ala raven shield's lean system; I know incremental lean is doable via freetrack axis but don't know whether it could be defined as a joystick axis instead

Share this post


Link to post
Share on other sites
Isn't GlovePIE awesome? :bounce3:

Yes GlovePIE is awesome. :yay:

@DaveP: It should be possible too to control the lean with the mouse x axis :) But first I have to find a way to disable the aiming when you press the Toggle button.

Share this post


Link to post
Share on other sites
)rStrangelove;1780768']Are you trying to get an aim-while-holding functionality? That would rock. I hate toggle-aim. :)

How should it work? Should the script presses the optics button after a certain time? :D

In my opinion it's useless. But maybe I missunderstood you :)

Share this post


Link to post
Share on other sites

I dont want to click right mouse button to aim/ironsights and then click again to switch back, i want to hold right mouse button, then release it to switch back.

It works in most other games but not here i think. Would be great if GlovePIE could do this.

Share this post


Link to post
Share on other sites
)rStrangelove;1781323']I dont want to click right mouse button to aim/ironsights and then click again to switch back' date=' i want to hold right mouse button, then release it to switch back.

It works in most other games but not here i think. Would be great if GlovePIE could do this.[/quote']

It probably could, or Autohotkey could.

EDIT:

(Add this script below to the txt file in Autohotkey its free. Direct download.)

(Sorry for hijack :p)

The first script is just a basic COD iron if you dont mind losing map right click, cancel menu and iron sights toggle.

;1---------------------------------------------------------------------------------------------

; Arma 2: COD Iron sights 1

*RButton::

Send, {RButton 1}

KeyWait RButton

return

*RButton Up::

Send, {RButton 1}

return

;----------------------------------------------------------------------------------------------

The second one lets you toggle with a fast click, hold release (COD style) with a hold longer than about a 100miliseconds.

It also lets you use the map right click as normal and cancel menu quick menu options with the small hassle of going into iron sights mode you have to exit after canceling the quick action... There might be better ways, but I recommend the first one for clean PVP deathmatch etc and the second one for other stuff where you need the other functions.

;2---------------------------------------------------------

; Arma 2: COD Iron sights 2

*RButton::

Send, {RButton 1}

Send, {RButton down}

KeyWait RButton

Send, {RButton up}

Send, {RButton 1}

return

;---------------------------------------------------------

You can also try both scripts with this toggle zoom key.

It makes indoor battles easier because the turning speed is slightly increased without any settings changing.

Use one of the top scrips, 1 or 2, and this one, 3, below. Press F12 to toggle zoom out. You can change F12 to any key you want, but F1-10 and a few others, but the basic keys work if you have any of them empty.

;3---------------------------------------------------------

; Arma 2: Zoom out and hold toggle key.

state:=0

$F12::

state:= !state

if state

Send {NumpadSub down}

else

Send {NumpadSub Up}

return

;---------------------------------------------------------

Edited by JojoTheSlayer

Share this post


Link to post
Share on other sites
)rStrangelove;1781323']I dont want to click right mouse button to aim/ironsights and then click again to switch back' date=' i want to hold right mouse button, then release it to switch back.

It works in most other games but not here i think. Would be great if GlovePIE could do this.[/quote']

Now I understand what you mean :)

Here is the GlovePIE Script for that:

if (not var.init) {
  var.init = true
  var.righthold = false
}

If (Mouse.RightButton) {
  var.rightcount++
} else {
  var.rightcount = 0
}

if (var.rightcount > 0) {
  Press (Key.Numpad0)
  var.righthold = true
}

if (var.rightcount == 0 and var.righthold) {
  var.righthold = false
  Release (Key.Numpad0)
  Press (Key.Numpad0)
  Wait 100ms
  Release (Key.Numpad0)
}
debug = Key.NUMPAD0 + " " + var.rightcount + " " + var.righthold;

To use:

- Remove the "Right mouse button" from the optics

- 0 (NUM) should be a default key for the optics so you don't have to do anything more

I added this piece of code into version 1.1 :)

I updated the script to 1.1:

// Changelog
// v1.1
// - Fixed: Toggle Zoom
// - Added: Zooming is disabled when chatting (because Backspace is running every
//          10ms to prevent the menu from showing every time you zoom)
// - Added: Now you can aim while holding the right mouse button.
//          That means that you have to hold the right mousebutton to look through
//          the ironsight/scope. To use it you have to remove the 'Right Mousebutton'
//          from the optics in the controls and set the
//          variable 'var.aimwhileholding' to true. Uses the 0 button on the numpad
//          for the optics (default for optics in arma).
//          (Requested by: ])rStrangelove => [url]http://forums.bistudio.com/showpost.php?p=1780768&postcount=5[/url])
// v1.0
// - Release

Have fun with 1.1 :yay:

Downloadlink in the first post.

Edited by Cyborg11

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×