The Gold Road Chapter – which includes the Scribing system – and Update 42 is now available to test on the PTS! You can read the latest patch notes here: https://forums.elderscrollsonline.com/en/discussion/656454/
Maintenance for the week of April 15:
• [COMPLETE] ESO Store and Account System for maintenance – April 16, 8:00AM EDT (12:00 UTC) - 6:00PM EDT (22:00 UTC)

Setup script for login

Shuichi
Shuichi
✭✭✭
I'm trying to create an addon to run a simple one line script every time I log in so that I don't have to type it in myself.

I think this is what I need but have never scripted an addon:

addon.active = true

function addon.init ()
/script function "script" return true
end

function addon.playerinit()
if IsPlayerInWorld then
addon.init
end


Am I anywhere close to this?
Hand of Sithis - Daggerfall Covenant
  • Syntse
    Syntse
    ✭✭✭✭✭
    Syntse Dominion Khajiit Dragonknight Stamina Tank [50]
    Ra'Syntse Dominion Khajiit Nightblade Magica DPS [50]
    Syntselle Dominion Dark Elf Dragonknight Magica DPS [50]
    Syntseus Dominion Imperial Templar Healer [50]
    Syntsetar Dominion High Elf Sorcerer Magica DPS [50]
    Friar Tuktuk Daggerfall Brenton Templar Healer [50]
    Syntseyn Ebonheart Brenton Nightblade Magica DPS [50]
  • Garkin
    Garkin
    ✭✭✭
    Take a look to other addons, you will get an idea how addons look like.

    But if it is just one line, it should be easy.


    You will have to create some folder in Addons, then create .txt file with the same name as folder and write somethig like:

    My Documents/Elder Scrolls Online/live/Addons/MyAddon

    MyAddon.txt:
    ## APIVersion: 100010
    ## Title: My Addon
    ## Description: My first addon
    ## Author: Me
    ## Version: 1
    
    MyAddon.lua
    

    Then create a new .lua file and now depends on what you want to do write some code. In most case it is something like:

    MyAddon.lua:
    local function MyFunction(eventCode, addonName)
        if addonName == "MyAddon" then
            --here some code what you want to do for example:
            SelectPlayerStatus(PLAYER_STATUS_DO_NOT_DISTURB)
        end
    end
    
    EVENT_MANAGER:RegisterForEvent("MyAddon", EVENT_ADD_ON_LOADED, MyFunction)
    
    Garkin / EU / CSF guild
    My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you, ... (full list)
    I'm taking care of: Azurah - Interface Enhanced, Srendarr - Aura, Buff & Debuff Tracker and more
    My folder with updated/modified addons: DROPBOX
  • Shuichi
    Shuichi
    ✭✭✭
    Thanks a lot Garkin, and Syntse for sending me to the right place.

    Here is my base addon, but I cannot get the script to run for some reason.

    "
    local CONTROLLER_IsInit = false

    function CONTROLLER_IsInit()
    return CONTROLLER_IsInit
    end

    local function CONTROLLER_Init()
    CONTROLLER_IsInit = true
    end

    local function controller_OnLoad(p_eventCode, p_addOnName)
    if p_addOnName ~= "CONTROLLER" then
    return
    end

    "/script function IsInGamepadPreferredMode() return true end"

    EVENT_MANAGER:UnregisterForEvent("CONTROLLER_EVENT_ADD_ON_LOADED", EVENT_ADD_ON_LOADED)
    end

    EVENT_MANAGER:RegisterForEvent("CONTROLLER_EVENT_ADD_ON_LOADED", EVENT_ADD_ON_LOADED, controller_OnLoad)
    "

    Is there no way to send a chat message through an addon, as far as I'm concerned this is the only way to activate a script, but clearly I don't know what I'm talking about.
    Hand of Sithis - Daggerfall Covenant
  • Shuichi
    Shuichi
    ✭✭✭
    I DID IT!!!!!

    "local CONTROLLER_IsInit = false

    function CONTROLLER_IsInit()
    return CONTROLLER_IsInit
    end

    local function CONTROLLER_Init()
    CONTROLLER_IsInit = true
    end

    local function controller_OnLoad(p_eventCode, p_addOnName)
    if p_addOnName ~= "CONTROLLER" then
    function IsInGamepadPreferredMode() return true end
    return
    end



    EVENT_MANAGER:UnregisterForEvent("CONTROLLER_EVENT_ADD_ON_LOADED", EVENT_ADD_ON_LOADED)
    end

    EVENT_MANAGER:RegisterForEvent("CONTROLLER_EVENT_ADD_ON_LOADED", EVENT_ADD_ON_LOADED, controller_OnLoad)
    "

    I'm sure there's a much simpler way to do this, but I receive no errors and get the UI I actually want to use. Thanks so much for the help everyone!
    Hand of Sithis - Daggerfall Covenant
  • Shuichi
    Shuichi
    ✭✭✭
    Now I have another problem. Radial menu support is not there on the mouse, I need to devise a way to set the mouse movements to the gamepad directionals. I'll be looking into tomorrow but for now it's time for ZzZs
    Hand of Sithis - Daggerfall Covenant
  • Garkin
    Garkin
    ✭✭✭
    You don't need to wait for EVENT_ADD_ON_LOADED, you can redefine IsInGamepadPreferredMode function right away. So your .lua file can be simplified to:
    IsInGamepadPreferredMode = function() return true end
    
    Edited by Garkin on February 23, 2015 11:32AM
    Garkin / EU / CSF guild
    My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you, ... (full list)
    I'm taking care of: Azurah - Interface Enhanced, Srendarr - Aura, Buff & Debuff Tracker and more
    My folder with updated/modified addons: DROPBOX
  • Shuichi
    Shuichi
    ✭✭✭
    Yeah I noticed that. Unfortunately without a way to set commands to the radial context menus this endeavor seems pointless.
    Hand of Sithis - Daggerfall Covenant
  • Smaxx
    Smaxx
    ✭✭✭✭✭
    Wait, overriding that function actually works now? I remember trying that a big ago and unfortunately it did nothing. Or do I have to do it while addons load? :)
  • Garkin
    Garkin
    ✭✭✭
    You can redefine every single global function.
    Smaxx wrote: »
    Wait, overriding that function actually works now? I remember trying that a big ago and unfortunately it did nothing. Or do I have to do it while addons load? :)

    Everything depends on what you want to do, but you should be able to redefine every single global function in game.
    Garkin / EU / CSF guild
    My addons: SkyShards, LoreBooks, Dustman, Map Coordinates, No, thank you, ... (full list)
    I'm taking care of: Azurah - Interface Enhanced, Srendarr - Aura, Buff & Debuff Tracker and more
    My folder with updated/modified addons: DROPBOX
Sign In or Register to comment.