Skip to content

hotkeys.lua

This script allows you to create custom hotkeys for FC2. By default, you will notice a predefined table:

Lua
1
2
3
4
5
6
-- keys
local keys =
{
    -- windows, linux
    reload = { 45, 0xff63 }
}

45 on Windows is the INSERT key. On Linux, that would be 0xff63. You can find key codes here (Windows - Linux).

This script is harder to configure as it requires some proficiency with Lua and the FC2 Lua modules.

Lua
if hotkey_down then

    -- reloading hotkey
    if key_name == "reload" then

        -- uncalibrate solution
        scripts:reset( true )

        -- stop this worker for a second.
        fantasy.sleep( 1000 )
    end

end

This code is a response to your reload hotkey. As shown, it reloads all scripts, which is useful for debugging a script you are working on. If you are interested in developing your own scripts, you can read the Scripting Guide for FC2 (Complete) thread. This hotkey can also be used to reload the Cloud scripts you have enabled/disabled.

Adding your own hotkey would require you to follow the same format as reload. Simply add a new table entry with your Windows/Linux hotkey and create a condition statement which responds to the key being pressed.