• 0

    posted a message on Benalian
    I have a small problem with the slash commands: I would make sure that if after the command there is no argument, a specific function is performed; however, if I specify an argument, another function will be run.
    For example

    /unitscan: Opens the options panel
    /unitscan on: Enables the addon
    /unitscan off: Disables the addon

    SLASH_UnitScan1 = "/unitscan"
    SlashCmdList["UnitScan"] = function(arg1)
    	if (arg1) then 
    		if (arg1 == "on") then enabling code addon
    		elseif (arg1 == "off") then disabling code addon
    		end
    	else InterfaceOptionsFrame_OpenToCategory(UnitScan.optFrames)
    end
    end
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    Using UNIT_SPELLCAST_SUCCEEDED could be an alternative? I'd like to be able to monitor when a spell is used.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    With this script, how would I know if the spell source is my target or my focus?

    local spell = { "Wind Shear" }
    local cd = { 6 }
    
    local MyEventFrame = CreateFrame("Frame", "MyEventFrame", UIParent)
    MyEventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    MyEventFrame:SetScript("OnEvent", function(self, event, arg1)
    	if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
    		if (arg2 == "SPELL_CAST_SUCCESS") or (arg2 == "SPELL_DAMAGE") then 
    			for i = 1, #spell do
    				if (arg10 == spell[i]) then print(spell[i], cd[i]) end
    				print(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)
    			end
    		end
    	end
    end)
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    There is a problem with draggable buttons: if a button hides while I'm dragging it (must hide itself if a certain buff or debuff expires) I can not longer interact with the rest of the interface of the game and I have to restart by pressing alt + f4

    This is the skeleton code of the button:

    <Button name="UnitScan_IconTemplate" enableMouse="true" movable="true" virtual="true">
        <Size>
            <AbsDimension x="30" y="30"/>
        </Size>
        <Layers>
            <Layer level="HIGHLIGHT">
                <Texture name="$parentHighlight" file="Interface\Buttons\CheckButtonHilight" alphaMode="ADD" setAllPoints="true" hidden="true">
                    <Size>
                        <AbsDimension x="30" y="30"/>
                    </Size>
                </Texture>
            </Layer>
    		<Layer level="ARTWORK">
    				<Texture name="$parentIcon" parentKey="texture" file="Interface\AddOns\UnitScan\Icons\Spell_generic">
    					<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
    						<AbsDimension x="2" y="2"/>
    					</Anchor>
    				</Texture>
    			</Layer>
    			<Layer level="OVERLAY">
    				<FontString name="$parentCharge" parentKey="countText" inherits="NumberFontNormalSmall" justifyH="RIGHT">
    					<Anchors>
    						<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
    							<Offset>
    								<AbsDimension x="-2" y="2"/>
    							</Offset>
    						</Anchor>
    					</Anchors>
    				</FontString>
    			</Layer>
        </Layers>
        <Scripts>
            <OnLoad>
                self:RegisterForDrag("LeftButton");
            </OnLoad>
            <OnDragStart>
                self:GetParent():StartMoving();
            </OnDragStart>
            <OnDragStop>
                self:GetParent():StopMovingOrSizing();
            </OnDragStop>
            <OnMouseDown>
    			self:GetParent():StartMoving();
                DropDownTest_ButtonOnMouseDown(self, button);
            </OnMouseDown>
    		<OnMouseUp>
    		    self:GetParent():StopMovingOrSizing();
            </OnMouseUp>
        </Scripts>
        <Frames>
            <Frame name="$parent_UnitScanDropDown" inherits="UIDropDownMenuTemplate" enableMouse="true" hidden="true">
                <Anchors>
                    <Anchor point="TOP"/>
                </Anchors>
                <Scripts>
                    <OnLoad>
                        DropDownTest_DropDownOnLoad(self)
                    </OnLoad>
                    <OnShow>
                        DropDownTest_DropDownOnLoad(self)
                    </OnShow>
                </Scripts>
            </Frame>
    		<Cooldown name="$parentCooldown" parentKey="cooldown" inherits="CooldownFrameTemplate">
    				<Size x="30" y="30"/>
    				<Anchors>
    					<Anchor point="CENTER">
    						<Offset>
    							<AbsDimension x="0" y="-1"/>
    						</Offset>
    					</Anchor>
    				</Anchors>
    			</Cooldown>
        </Frames>
    </Button>
    
    
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    Ok, I managed to make do decently. A question about database: I saw that some addon can load profiles from other accounts. How can I do it?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    Even if I write the right name does not load the image :(
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    If I want set this picture as background what should I do? I converted this to .tga format, placed inside a folder on my addon called "Icons" and I wrote it as xml but fails to load :(

    <Texture name="$parentmyTexture" file="Icons\myImmage.tga">
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    There should be the guide to LibButtonFacade but the link is broken: http://www.wowace.com/addons/buttonfacade/pages/api/lib-button-facade
    Posted in: AddOn HELP!
  • 0

    posted a message on Benalian
    I use Notepad++ for .Lua scripting. How can I get my code from this to this? Please do not tell me just using "tab": P wowlua does it automatically, how can I do the same with Notepad++?
    Posted in: General Chat
  • 0

    posted a message on Benalian
    I moved the libraries in the main addon. Now, to call the functions present in the options addon in the main what should I do?
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    As already said, my addon is inspired to Power Auras, and has as its objective to trace auras and weapon enchant. Consiste in creating a group (function UNITSCANNER_Bar_Update, line 223) in which are inserted a variable number of icons (function UNITSCANNER_Icon_Update, line 260). Right-clicking the icon, you can select the item to be traced and the various options (target, reaction, weapon to monitor). If you selected ”Aura”, buffscan() is the main function; instead, for weapon enchants is wpnenchscan(). Both buffscan() and wpnenchscan() are modulated by onUpdate (around line 512). It's possible that the first time the addon starts does not appear anything, because I have not been able to ensure that the basic options are those shown in defaults table.
    I apologize for blunders, but certain documents found on the net are at the limit of compressibility :( :( :(

    1. Write an initialization function in UnitScanner.lua that gets the database from USopt. Use directly USopt.db.profile ; there is no need for the ugly "current" member you are assigning to your SavedVariables.




    It's exactly what I Intended but the libraries are located in the UnitScanner_options, how can I do? Could you show me how the code should look? I've tried with

    function UNITScan_Bar_Update() -- Bar group creation
    db.profle = USopt.db.profle
    ...
    end


    and BugSack brings me this error: 1x UnitScanner-0.7\UnitScan.lua:224: attempt to index global 'USopt' (a nil value)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    Well, yours are great recommendations and follow them for sure. But what about I've asked for help? (line 390, 391, 398, 399, 475, 476, 477, there are comments ^_^) If there's something you do not understand the utility just ask me.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    UnitScanner.lua: http://nopaste.dk/p17284
    Core.lua (UnitScanner_options): http://nopaste.dk/p17285
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    This is the addon I've often asked for help. For its making I was inspired by PowerAuras and TellMeWhen
    My addon consists of two folders: UnitScanner and UnitScanner_options.
    Could you give us a review? Could you tell me which pieces of code can be written in a more elegant way, possibly making me see how the code should look?
    In particular, the function from 448 to 478 (UnitScanner.lua), and the way I make communicate Unit Scanner.lua and Core.lua (line 224 and 225 of UnitScanner.lua and 541 of Core.lua)

    If at first you don't see anything, type /us

    http://www.filehosting.org/file/details/409498/UnitScanner.zip
    Posted in: Lua Code Discussion
  • 0

    posted a message on Benalian
    I'm trying to plug the profiles managing interface (which I would like this) in my options panel. As usual, the documentation found on the net is very rough, and the only thing I could do is this.

    http://lua.nopaste.dk/p17016

    Currently, BugSack brings me the following error: AceConfigDialog-3.0-50:1498: attempt to index local 'group' (a nil value)
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.