Skip to content

Instantly share code, notes, and snippets.

@ZerothAngel
ZerothAngel / Mouselook.ahk
Last active November 10, 2021 15:19
Mouselook AutoHotKey script that inverts the right mouse button when toggled on. Very useful for MMOs that lack an action-mouselook mode. As-is, it works with FFXIV but can be easily adapted by correctly setting the ahk_class.
#SingleInstance force
#NoEnv
SendMode Input
; Keybinds
AutoCenterToggle := "RWin"
MouseLook := "RButton"
; Config
CenterOffsetX := 100
@ZerothAngel
ZerothAngel / upslot.py
Last active February 28, 2021 06:30
A simple utility for Phantasy Star Online 2 (PSO2) to calculate the overall success rate of upslotting a weapon/unit to N slots from N-1.
#!/usr/bin/env python3
"""
A simple utility for Phantasy Star Online 2 to calculate the overall success
rate of upslotting a weapon/unit to N slots from N-1.
Can also take number of (filled) S-Grade Augment slots (aka SSA slots) which,
when present, always improve the overall chance (because they are 100% even
on upslot).
Specifying additional boosts (e.g. boost week) and/or manually specifying the
@ZerothAngel
ZerothAngel / Script.cs
Created August 15, 2015 16:53
Space Engineers Generic Solar-Powered Satellite Controller
// Generated from ZerothAngel's SEScripts version 11998d7043c3 tip
// Modules: satellitecontroller, batterymanager, solargyrocontroller, gyrocontrol, thrustcontrol, shiporientation, shipcontrol, eventdriver, commons
const string BATTERY_MANAGER_DISCHARGE_INTERVAL = "00:00:57"; // HH:MM[:SS]
const string BATTERY_MANAGER_RECHARGE_INTERVAL = "00:00:03"; // HH:MM[:SS]
// BatteryManager
const uint BATTERY_MANAGER_DRAIN_CHECK_TICKS = 120;
const uint BATTERY_MANAGER_DRAIN_CHECK_THRESHOLD = 100;
@ZerothAngel
ZerothAngel / Script.cs
Created August 15, 2015 15:00
Space Engineers General Rangefinder
public class Rangefinder
{
public struct LineSample
{
public Vector3D Point;
public Vector3D Direction;
public LineSample(IMyCubeBlock reference, Vector3I forward3I)
{
Point = reference.GetPosition();
@ZerothAngel
ZerothAngel / Script.cs
Created August 12, 2015 15:21
Space Engineers Smart Undock (WIP)
// Generated from ZerothAngel's SEScripts version 56430963671f tip
// Modules: undocktest, smartundock, gyrocontrol, thrustcontrol, shiporientation, shipcontrol, translateauto, pid, velocimeter, eventdriver, commons
// SmartUndock (ship-dependent)
const double SMART_UNDOCK_RTB_SPEED = 25.0; // In meters per second
const double AUTOPILOT_MIN_SPEED = 1.0; // In meters per second
const double AUTOPILOT_TTT_BUFFER = 5.0; // Time-to-target buffer, in seconds
const double AUTOPILOT_DISENGAGE_DISTANCE = 5.0; // In meters
// SmartUndock
@ZerothAngel
ZerothAngel / gist:3d47f70a62e7645f6538
Created August 2, 2015 17:24
Space Engineers Script: Split container stacks
private const float StackSize = 10000.0f;
public bool SplitContainerContents(IMyCargoContainer container)
{
var inventory = ((Sandbox.ModAPI.Interfaces.IMyInventoryOwner)container).GetInventory(0);
var items = inventory.GetItems();
// NB We only check the first item
var item = items.Count > 0 ? items[0] : null;
var amount = item != null ? (float)item.Amount : 0.0f;
if (amount >= StackSize * 2.0f)