All pastes #86281 Raw Edit

Industrial

public text v1 · immutable
·published 2006-07-12 18:38 UTC
rendered paste body
idUnitframes:RegisterChatCommand({'/idunitframes'}, { -- line 17
    name = 'idUnitframes',
    desc = 'Industrial\'s unitframes',
    type = 'group',
    args = {
        setx = {
            name = 'setx',
            type = 'group',
            desc = 'Set the x coordinate of a frame.',
            args = {
                player = {
                    name = 'player',
                    type = 'text',
                    desc = 'Set the x coordinate of the player frame.',
                    usage = '<number>',
                    input = true,
                    get = function()
                        return idUnitframes.Frames.player:GetLeft()
                    end,
                    set = function(Value)
                        idUnitframes.Frames.player:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', Value, idUnitframes.Frames.player:GetTop())
                        idUnitframes:savePosition('player')
                    end,
                    validate = function(Value)
                        if type(Value) == 'number' then
                            return true
                        end
                    end
                },
                target = {
                    name = 'target',
                    type = 'text',
                    desc = 'Set the x coordinate of the target frame.',
                    usage = '<number>',
                    input = true,
                    get = function()
                        return idUnitframes.Frames.target:GetLeft()
                    end,
                    set = function(Value)
                        idUnitframes.Frames.target:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', Value, idUnitframes.Frames.target:GetTop())
                        idUnitframes:savePosition('target')
                    end,
                    validate = function(Value)
                        if type(Value) == 'number' then
                            return true
                        end
                    end
                },
            }
        },
        sety = {
            name = 'sety',
            type = 'group',
            desc = 'Set the y coordinate of a frame.',
            args = {
                player = {
                    name = 'player',
                    type = 'text',
                    desc = 'Set the y coordinate of the player frame.',
                    usage = '<number>',
                    input = true,
                    get = function()
                        return idUnitframes.Frames.player:GetLeft()
                    end,
                    set = function(Value)
                        idUnitframes.Frames.player:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', idUnitframes.Frames.player:Getleft(), Value)
                        idUnitframes:savePosition('player')
                    end,
                    validate = function(Value)
                        if type(Value) == 'number' then
                            return true
                        end
                    end
                },
                target = {
                    name = 'target',
                    type = 'teyt',
                    desc = 'Set the y coordinate of the target frame.',
                    usage = '<number>',
                    input = true,
                    get = function()
                        return idUnitframes.Frames.target:GetLeft()
                    end,
                    set = function(Value)
                        idUnitframes.Frames.target:SetPoint('TOPLEFT', UIParent, 'TOPLEFT', idUnitframes.Frames.target:GetLeft(), Value)
                        idUnitframes:savePosition('target')
                    end,
                    validate = function(Value)
                        if type(Value) == 'number' then
                            return true
                        end
                    end
                },
            }
        }
    }
})