1. Please be advised of a few specific rules and guidelines for this section.

RELEASED Mousebutton Toggle Script

Discussion in 'Other' started by locsta, Dec 11, 2013.

  1. locsta

    locsta Void-Bound Voyager

    Here's an autohotkey script to let you toggle left or right mouse buttons, so you don't have to hold them down for a long time when doing lots of mining especially. You'll need to download and install autohotkey to run this script. The script cancels the toggles when the mousewheel is scrolled or the i key for inventory is pressed. You can press ' ctrl+shift+s ' to disable/enable the script at any time, which you may need to do if typing or using keys f or g for other things. You'll need to right click this script and run it as administrator for it to work correctly. Otherwise it may work badly or not at all. It's a security feature of windows, I don't think it's something I can change.

    You can edit it yourself too to change what key you want to press to toggle the action. I have it set as ' f ' for left mouse toggle and ' g ' for right mouse toggle. To change this so that the mouse buttons toggle themselves instead of f and g, try changing the 'f' and 'g' on lines 1 and 2 to ' LButton' and 'RButton' in that order. I like Notepad++ for editing AHK scripts, you can use the autoit built in highlighter for easier editing, but the program will try to save with autoit extension instead.
    This code is the same as in the zip, save it with ahk extension to be able to run it as an autohotkey script. Careful not to run without administrator permissions though, I have done that lots of times and wondered why my scripts weren't working, so that's why I remind twice. Be sure to check out the very good autohotkey help file included with autohotkey if you need scripting help with it or want to learn about all of what it can automate.

    Edit : New version 4 below that untoggles mousebuttons if any number keys are pressed (0-9). Like with before, toggles are independent so you can use one to constantly block with a shield while toggling on/off the other hand's item, for instance. Yeah, there must be a shorter way to write this but this was just whipped up for quick use, reasoning Starbound might have this feature built-in sometime in the future. If you have more efficient or similar scripts already, or related scripts , please do post them here.

    Edit 2 : If you can't download the zipfile for whatever reason from this attachment, the script still works as well if you use the code from below though. See above about how to save and run it.

    Starbound modding is off to a great start with all the activity around here!

    Code:
    *f:: SendInput, % "{Click " ((Y := !Y) ? "down" : "up") "}"
    *g:: SendInput, % "{Click " ((B := !B) ? "down right" : "up right") "}"
    ~*i::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*WheelDown::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*WheelUp::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*1::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*2::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*3::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*4::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*5::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*6::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*7::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*8::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*9::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ~*0::
    If(Y != 0 OR B != 0 )
    {
        Y := 0
        B := 0
        SendInput, {Click up}
        SendInput, {Click up right}
    }
    return
    ^+s::Suspend
     

    Attached Files:

    Last edited: Jan 28, 2014
    Vicitus likes this.
  2. Vicitus

    Vicitus Master Chief

    Awesome! Many Thanks. Such a little but powerfull help. :megusta:
     
  3. locsta

    locsta Void-Bound Voyager

    You're welcome. I hope it helps anyone.
     

Share This Page