Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Magicka G15 script / macro
-- To use this script
-- 1) copy and paste this body into the script editor window and save it.
-- 2) Set each G Key in each M mode (that you want to use) to "script"
-- NOTE: Only G1 - G6 are configured since I am using the orange G15,
-- Extending this to 18 is just copy and paste.
-- If you are trying to record macros and they are not working, make sure you have
-- the record delay checkbox checked, however I find this script works better and
-- is more flexible than recording each macro by hand and adjusting the delay.
--Keybindings for the elements
WATER_KEY = "q"
LIFE_KEY = "w"
SHIELD_KEY = "e"
COLD_KEY = "r"
LIGHTNING_KEY = "a"
SPIRIT_KEY = "s"
EARTH_KEY = "d"
FIRE_KEY = "f"
--How long to keep the keydown
RELEASE_DELAY_TIME = 40
function tap_key(key)
PressKey(key);
Sleep(RELEASE_DELAY_TIME);
ReleaseKey(key);
Sleep(RELEASE_DELAY_TIME);
end
function cast()
tap_key("spacebar");
end
function range_attack(charge_time)
PressMouseButton(3); -- Right Click
Sleep(charge_time);
ReleaseMouseButton(3);
end
--Basic elements
function fire()
tap_key(FIRE_KEY);
end
function water()
tap_key(WATER_KEY);
end
function life()
tap_key(LIFE_KEY);
end
function earth()
tap_key(EARTH_KEY);
end
function spirit()
tap_key(SPIRIT_KEY);
end
function lightning()
tap_key(LIGHTNING_KEY);
end
function shield()
tap_key(SHIELD_KEY);
end
function cold()
tap_key(COLD_KEY);
end
--Composite elements
function ice()
Sleep(RELEASE_DELAY_TIME);
water();
cold();
Sleep(RELEASE_DELAY_TIME);
end
function steam()
Sleep(RELEASE_DELAY_TIME);
fire();
water();
Sleep(RELEASE_DELAY_TIME);
end
-- Spells
function teleport()
lightning();
spirit();
lightning();
cast();
end
function thunder_bolt()
steam();
lightning();
spirit();
lightning();
cast();
end
function grease()
water();
earth();
life();
cast();
end
function meteor_shower()
fire();
earth();
steam();
earth();
fire();
cast();
end
-- Broken, Queues 3 steam?
function conflagration()
steam();
fire();
steam();
fire();
steam();
cast();
end
function time_warp()
cold()
shield();
cast();
end
function haste()
lightning();
spirit();
fire();
cast();
end
function invisibility()
spirit();
shield();
steam();
spirit();
cast();
end
function fear()
cold();
spirit();
shield();
cast();
end
function charm()
life();
shield();
earth();
cast();
end
function rain()
water();
steam();
cast();
end
function vortex()
ice();
spirit();
ice();
shield();
ice();
cast();
end
function raise_dead()
ice();
earth();
spirit();
cold();
cast();
end
function summon_elemental()
spirit();
shield();
earth();
steam();
spirit();
cast();
end
-- Broken
function summon_death()
spirit();
cold();
ice();
cold();
spirit();
cast();
end
function summon_pheonix()
life();
lightning();
fire();
cast();
end
function nullify()
spirit();
shield();
cast();
end
function corporealize()
spirit();
steam();
lightning();
shield();
spirit();
cast();
end
-- Useful Combos
function lazer_ice(charge_time)
ice();
ice();
ice();
spirit();
lightning();
range_attack(charge_time);
end
-- M mode delegate functions
function m1_mode(event,arg)
if (event == "G_PRESSED") then
if(arg == 1) then -- G1 key
teleport();
elseif(arg == 2) then -- G2 key
thunder_bolt();
elseif(arg == 3) then -- G3 key
grease();
elseif(arg == 4) then -- G4 key
meteor_shower();
elseif(arg == 5) then -- G5 Key
lazer_ice(300);
elseif(arg == 6) then -- G6 Key
time_warp();
end
end
if (event == "G_RELEASED" and arg == 1) then
-- G1 has been released
end
end
function m2_mode(event,arg)
if (event == "G_PRESSED") then
if(arg == 1) then -- G1 key
summon_death();
elseif(arg == 2) then -- G2 key
summon_elemental();
elseif(arg == 3) then -- G3 key
summon_pheonix();
elseif(arg == 4) then -- G4 key
raise_dead();
elseif(arg == 5) then -- G5 Key
lazer_ice(300);
elseif(arg == 6) then -- G6 Key
vortex();
end
end
if (event == "G_RELEASED" and arg == 1) then
-- G1 has been released
end
end
function m3_mode(event,arg)
end
-- Main
function OnEvent(event, arg)
current_mkey = GetMKeyState(); -- Get which M key is active on the keyboard
if(current_mkey == 1) then -- M1
m1_mode(event,arg);
elseif(current_mkey == 2) then -- M2
m2_mode(event,arg);
else -- M3 (future proof if they add M4...)
m3_mode(event,arg);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment