XIM Community

Script policy and compatibility  (Read 1701 times)

Offline W11cE

  • Moderator
  • MVP
  • *
  • Posts: 1378
    • View Profile
Script policy and compatibility
« on: 11:17 AM - 03/26/18 »
ATTENTION! Script policy on this board:

The following scripts are not allowed and will be removed by moderators:

 - Anti recoil scripts
 - Rapid fire scripts
 - Farming bot scripts

What is being watched is the purpose of the script, not the content of the script itself.
Example: Dragging your mouse down with a script, while firing a weapon to compensate for the recoil is considered as an anti recoil script and therefore not allowed. However binding keys to mouse movement for easier vehicle turning is not.
« Last Edit: 08:38 PM - 05/02/18 by Od1n »

Offline W11cE

  • Moderator
  • MVP
  • *
  • Posts: 1378
    • View Profile
Re: Script policy and compatibility
« Reply #1 on: 02:55 PM - 04/08/18 »
The compatible AutoHotKey version is 1.1. You have to use either 32 or 64 bit Unicode executable. Ansi executables are not supported.

The AHK executable needs to be linked in the directories of XIM Link. This should be done automatically, but sometimes Link can not find it and you have to do it manually.
_______________________________________________________________

The directory for scripts is "Documents/XIM Link/Scripts/"

You do not need to modify the scripts manually for compatibility with XIM Link. This is done automatically by XIM Link with the line:
Code: [Select]
#Include %A_AppData%\XIM Link\ScriptAdditionals\AHK_ADDITIONALS.ahk
The referenced file contains everything needed for compatibility.

Here are the contents of the current version for those that are interested:
Code: [Select]
; This is automatically generated file by XIM Link
; XIL Version=1,ForceOverwrite=False
SetWorkingDir %A_AppData%\XIM Link\ScriptAdditionals\

#SingleInstance force
#UseHook On
Suspend On


if (A_PtrSize = 8)
    global XIL_libFile := "AhkLink64"
else
if (A_PtrSize = 4)
    global XIL_libFile := "AhkLink"
global XIL_libFileModule := DllCall("LoadLibrary", "Str", XIL_libFile)

OnExit("ExitCleanup")
ExitCleanup(ExitReason, ExitCode)
{
  DllCall("FreeLibrary", "Ptr", XIL_libFileModule)
  return 0
}

XIL_HostHandle = %1%
DetectHiddenWindows, on
XIL_ScriptHandle := WinExist("ahk_pid" DllCall("GetCurrentProcessId")) + 0

XIL_ProcessID := 0
WinGet, XIL_ProcessID, PID
XIL_ProcessID := XIL_ProcessID + 0


DllCall( XIL_libFile "\CopyDataCallback", "Int", XIL_HostHandle, "Int", XIL_ScriptHandle, "Int", XIL_ProcessID)

OnMessage(WM_COPYDATA:=74, "WMCopyData")
WMCopyData(wParam, lParam, msg, hWnd)
{
  local XIL_ret := DllCall( XIL_libFile "\CopyDataParsing", "UInt", hWnd, "Uint", msg, "UInt", wParam, "UInt", lParam)
If (XIL_ret = 1)
  Suspend On
If (XIL_ret = 2)
  Suspend Off
If (XIL_ret = 3)
  Reload
return
}

SetWorkingDir %A_ScriptDir%

Right now you can edit the scripts, but renaming, removing or adding scripts is not supported while XIM Link is running.
« Last Edit: 03:05 PM - 04/08/18 by W11cE »

Offline W11cE

  • Moderator
  • MVP
  • *
  • Posts: 1378
    • View Profile
Re: Script policy and compatibility
« Reply #2 on: 03:12 PM - 04/15/18 »
XIM Link specific commands:

What you need to use on the script is this:
Code: [Select]
XIMInputData(Function, value1, [value2 = 100])
"Function" is a string of one of the the next values:
Code: [Select]
            Button1
            Button2
            Button3
            Button4
            Button5
            Button6
            Button7
            Button8
            Button9
            Button10
            Button11
            Button12
            Button13
            Button14
            Button15
            Button16
            Button17
            Button18
            Button19
            Button20
            Button21
            Button22
            Button23
            Button24
            Button25
            Button26
            Button27
            Button28
            Button29
            Button30
            Button31
            Button32
            Button33
            Button34
            Button35
            Button36
            ButtonUp
            ButtonDown
            ButtonLeft
            ButtonRight
            LeftStickX
            LeftStickY
            LeftStickZ
            RightStickX
            RightStickY
            RightStickZ
            LeftTrigger
            RightTrigger
            Slider
            LeftStickDirectional
            RightStickDirectional

For Button types:
value1 is either:
  0 = unpressed, 1 = pressed.
value2 is not used

For Axis types:
value1 is the axis value between -100.0 and 100.0
value2 is not used

For StickDirectional types:
value1 is the direction of the stick (on XY "plane") in degrees between 0.0 and 360.0. Up is 0.0 and it rotates clockwise. To reset to the middle put in -1.0.
value2 is the distance value between 0 and 100.0. If blank, will default to 100.0

The set value will stay until a new one is set or passthrough is disabled.

Example:
Code: [Select]
h:: ;Will move LeftStickX to right one second, then left one second and stop.
    XIMInputData("LeftStickX", 100)
    Sleep 1000
    XIMInputData("LeftStickX", -100)
    Sleep 1000
    XIMInputData("LeftStickX", 0)
Return

g:: ;This will remap key "g" to joystick button 8
    XIMInputData("Button8", 1)
    KeyWait, g
    XIMInputData("Button8", 0)
Return

y:: ;Warframe inventory wheel. Will use item in slot 3.
    XIMInputData("Button13", 1) ;Button13 opens inventory.
    Sleep 50
    XIMInputData("Button13", 0)

    Sleep 350 ;Wait for the wheel to show up.
    XIMInputData("LeftStickDirectional", 360.0 / 12.0 * 2) ;12 Slots. This will select slot 3.
    Sleep 50 ;It takes a little time for the game to recognize the stick movement.

    XIMInputData("Button9", 1) ;Button9 uses the item.
    Sleep 50
    XIMInputData("Button9", 0)
    Sleep 50
    XIMInputData("LeftStickDirectional", -1) ;Reset stick to middle.


    XIMInputData("Button13", 1) ;Close inventory.
    Sleep 20
    XIMInputData("Button13", 0)
    Sleep 300 ;Extra delay to ensure inventory is closed before returning to regular movement.
Return
« Last Edit: 08:25 PM - 06/22/18 by W11cE »