Skip to content

Instantly share code, notes, and snippets.

@KarlRamstedt
KarlRamstedt / Lost Ark Macros.ahk
Last active May 15, 2024 14:32
A collection of time-saving macros for repetitive UI tasks in Lost Ark. NOTE: Delays may need to be increased for slower PCs (info in 1st comment)
#NoEnv ; For performance and compatibility with future AutoHotkey releases
SendMode Input ; For speed and reliability
SetBatchLines -1 ; No script sleep, for more consistent spam behavior. Default behavior is 10ms execution then 10ms sleep
ListLines Off ; Increase performance by a few percent by not logging the lines of code that are executed
global donateSilver := false ; Guild donation is a silver sink; you lose more than you gain, so only do it if your guild needs it or if you're desperate for bloodstones
global supportResearch := false ; Set to false to avoid Guild Task pop-up after daily macro (happens if no active research)
global spam := false ; Change this to true if you want it on by default
spamHotkeys := ["Space"] ; Hold one of these to spam that key. Just add a key to the array to automatically make it a new spam hotkey. Shift+G spam is handled separately.
global BoundFuncCache := {} ; A collection of bound functions for use in Timer stopping. Func(f).Bind(k) seems to create an object and return
@KarlRamstedt
KarlRamstedt / Display Mouse Coordinates.ahk
Last active August 26, 2023 06:59
Utility script for finding screen coordinates. Simply shows the coordinates your mouse is currently located at
Gui -Caption +AlwaysOnTop +ToolWindow +LastFound ; +ToolWindow means no taskbar button or alt-tab item. LastFound is used for WinSet.
Gui, Font, s32 q3, Arial ; Set font size and quality (prevents AA mixing letters with background)
Gui, Add, Text, vCoordText c00FF00, XXXXX YYYYY ; XX & YY sets window size to roughly what is needed to contain mouse coordinates
Gui, Color, Black ; Background color
WinSet, TransColor, Black 150 ; Make the background color transparent and set text opacity(150)
CoordMode, Mouse, Screen ; Mouse position relative to screen, not active window
SetTimer, Update, 50
Gui, Show, x0 y0 NA ; Shows window without activating it. Change X and Y numbers to move the overlay.
return ; End of auto-execute
@KarlRamstedt
KarlRamstedt / SpamKeys.ahk
Last active October 23, 2023 17:48
Generic AutoHotKey Spam Script. All keys in the spamHotkeys array are turned into hotkeys. Just add/remove whichever keys you want
#NoEnv ; For performance and compatibility with future AutoHotkey releases
SendMode Input ; For speed and reliability
SetBatchLines -1 ; No script sleep, for more consistent spam behavior. Default behavior is 10ms execution then 10ms sleep
ListLines Off ; Increase performance by a few percent by not logging the lines of code that are executed
global spam := false
spamHotkeys := ["3", "f", "LButton"] ; Hold one of these to spam that key. Just add a key to the array to automatically make it a new spam hotkey
global BoundFuncCache := {} ; A collection of bound functions for use in Timer stopping. Func(f).Bind(k) seems to create an object and return a reference to it, without caching the result, so manual caching is required to reference the same object
for i, key in spamHotkeys { ; Creates hotkeys for each key in the array above
@KarlRamstedt
KarlRamstedt / Crosshair Overlay.ahk
Last active August 13, 2024 15:16
AHK Crosshair Overlay
#NoEnv ; For performance and compatibility with future AutoHotkey releases
Gui, -Caption +AlwaysOnTop +ToolWindow +LastFound +E0x20 ; +E0x20 makes the window click-through
Gui, Margin, 0, 0 ; Remove margins to get perfect alignment with center of screen
Gui, Add, Picture, , Crosshair.png ; Picture file name, in the same folder as the script
Controlgetpos, , , picW, picH, , ; Store picture width and height in variables
xPos := A_ScreenWidth/2 - picW/2
yPos := A_ScreenHeight/2 - picH/2 ; Used to align picture center with screen center
Gui, Show, x%xPos% y%yPos% NA ; Crosshair can be moved by manually setting X and Y numbers
Gui, Color, 0000FF ; Set background color. You might need to change this color to one not contained in the crosshair
@KarlRamstedt
KarlRamstedt / LazySingleton.cs
Last active January 25, 2020 17:09
Lazyloaded Singleton for Unity
using UnityEngine;
using System;
/// <summary>
/// A Singleton that uses Lazy initialization. The superior option for persistent Singletons.
/// Thread-safe and efficient through the use of the Lazy class.
/// Can only be created once, so make sure it doesn't get destroyed.
/// ALWAYS creates a new object. Placing the Singleton in a scene does nothing.
/// </summary>
public abstract class LazySingleton<T> : MonoBehaviour where T : LazySingleton<T> {
@KarlRamstedt
KarlRamstedt / FirstPersonCameraRotation.cs
Created January 8, 2020 10:17
A simple First Person Camera rotation script for Unity.
using UnityEngine;
/// <summary>
/// A simple FPP (First Person Perspective) camera rotation script.
/// Like those found in most FPS (First Person Shooter) games.
/// </summary>
public class FirstPersonCameraRotation : MonoBehaviour {
public float Sensitivity {
get { return sensitivity; }
@KarlRamstedt
KarlRamstedt / SceneRefAttribute.cs
Created January 4, 2020 16:34
Unity Scene Reference Attribute
using UnityEngine;
namespace ModularOptions {
/// <summary>
/// Uses a CustomPropertyDrawer to draw a string field as a SceneAsset object field.
/// </summary>
/// <example><code>
/// [SceneRef] string mainMenu;
/// </code></example>
[System.AttributeUsage(System.AttributeTargets.Field)]
@KarlRamstedt
KarlRamstedt / Warframe Macros.ahk
Last active September 9, 2024 05:29
Spam macros for Slide-Attack, Ability, Primary-fire and Melee in Warframe. Including non-spam Contagion macro.
#NoEnv ; For performance and compatibility with future AutoHotkey releases
SendMode Input ; For speed and reliability
SetBatchLines -1 ; No script sleep, for more consistent timing behavior. Default behavior is 10ms execution then 10ms sleep
ListLines Off ; Increase performance by a few percent by not logging the lines of code that are executed
; Modifiers: [+ = Shift] [^ = Ctrl] [# = Win] [! = Alt] [* = Ignores unspecified modifiers] [~ = Doesn't block normal function] [$ = Forces hook, preventing hotkey self-trigger] More info here: https://www.autohotkey.com/docs/KeyList.htm
; Time values are in ms(MilliSeconds), 1/1000 of a second. 1000/delay = activationsPerSecond. I.e: 50ms delay -> 1000/50 = 20 per sec
; Time values are typically rounded up to a multiple of 10ms by the Windows time-keeping system. So there's no point to Timer/Sleep values that aren't multiples of 10. Higher precision may be achieved via Loop+DllCall, but is rarely relevant and certainly doesn't matter for this script
global slideDela