• 0

    posted a message on Create frame
    Hm, i cant understand what i have to do to set the frame to special width or heigh or write a text in it. Or what is the different from Frame, BlizOptionsGroup, Container, Widget,...

    I think i need a beginner guide.

    I can set the title...
    local frame = LibStub("AceGUI-3.0"):Create("Frame")
    frame:SetTitle("Test")

    ...but not the position?
    frame:OnWidthSet(100)
    frame:OnHeightSet(100) 


    mfg
    Posted in: Ace3
  • 0

    posted a message on Delay in While loop?
    Thx,

    UNIT_HEALTH will not work - but i have found a way with the COMBAT_LOG_EVENT.
    The string in pethealthpro = 100 / petmaxhealth * pethealth is like 99.8476465353535. Is it possible to take shape like 99,95?


    function PETty:COMBAT_LOG_EVENT_UNFILTERED()
    	petname = UnitName("pet")
    	if arg2 == ("SWING_DAMAGE" or "RANGE_DAMAGE" or "SPELL_DAMAGE") then
    		if arg7 == petname then
    		petmaxhealth = UnitHealthMax("pet")
    		pethealth = UnitHealth("pet")
    		pethealthpro = 100 / petmaxhealth * pethealth
    			if pethealthpro <= 10 then
    			self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    			elseif pethealthpro <= 20 then
    			self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    			elseif pethealthpro <= 30 then
    			self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    			elseif pethealthpro <= 40 then
    			self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    			elseif pethealthpro <= 50 then
    			self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    			elseif pethealthpro <= 70 then
    			self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    			else
    			self:Print(petname .. " wurde getroffen und hat noch " .. pethealthpro .. "% Leben")
    			end
    		end		
    	end	
     end


    mfg
    Posted in: Lua Code Discussion
  • 0

    posted a message on Delay in While loop?
    Hi,

    i have a problem. When i do this my computer crashed. I think i need a delay for each while loop - is it possible?
    function PETty:PET_ATTACK_START()
    	petattack = 1
    	
    	while petattack == 1 do
    	petmaxhealth = UnitHealthMax("pet")
    	pethealth = UnitHealth("pet")
    	pethealthpro = 100 / petmaxhealth * pethealth
    		if pethealthpro <= 10 then
    		self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    		elseif pethealthpro <= 20 then
    		self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    		elseif pethealthpro <= 30 then
    		self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    		elseif pethealthpro <= 40 then
    		self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    		elseif pethealthpro <= 50 then
    		self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    		elseif pethealthpro <= 70 then
    		self:Print("Max Leben: " .. petmaxhealth .. ", Leben: " .. pethealth .. ", Leben in %: " .. pethealthpro)
    		else
    		end
    	end	
     end
     
     function PETty:PLAYER_REGEN_ENABLED()
    	petattack = 0
    end


    mfg
    Posted in: Lua Code Discussion
  • 0

    posted a message on Change macro on PET_ATTACK_STOP()
    Ok, i have found the reason. I cant edit a macro in combat...

    But this is what i want to do. Is there another way? Can i create a button or frame in combat?

    Dragaron
    Posted in: Lua Code Discussion
  • 0

    posted a message on Change macro on PET_ATTACK_STOP()
    Hi,

    i have a problem. I want to change a macro wenn my pet starts attacking and when it stops. On Start no problem - but on stop is nothing change! Why?

    function HunterSwitch:OnEnable()
      -- Called when the addon is enabled
    	self:RegisterEvent("PET_ATTACK_START")
    	self:RegisterEvent("PET_ATTACK_STOP")
    	
    	macroIndex = GetMacroIndexByName(macroName)
    	
    	if macroIndex == 0 then
    	CreateMacro(macroName, 33, nil, 1, 1) else
    	EditMacro(macroIndex, macroName, 180, "/cast Aspekt des Rudels", 1, 1)
    	end
    	
    	if debugLevel == 1 then
    	self:Print(debugLevel, macroIndex) else
    	end
    end
    
    function HunterSwitch:PET_ATTACK_START()
    	-- Called when the pet attacks
    	HunterSwitch:AspectOfTheHawk()
    	
    	if debugLevel == 1 then
    	self:Print("Pet attack start") else
    	end
    end
    
    function HunterSwitch:PET_ATTACK_STOP()
    	-- Called when the pet stops attack
    	HunterSwitch:AspectOfThePack()
    	
    	if debugLevel == 1 then
    	self:Print("Pet attack stop") else
    	end
    end
    
    function HunterSwitch:AspectOfTheHawk()
    	-- Aspect of the Hawk (Aspekt des Falken)
    	macroIndex = GetMacroIndexByName(macroName)
    	EditMacro(macroIndex, macroName, 28, "/cast Aspekt des Falken", 1, 1)
    	
    	if debugLevel == 1 then
    	self:Print("Macro switched to Aspect of the Hawk") else
    	end
    end	
    
    function HunterSwitch:AspectOfThePack()
    	-- Aspect of the Pack (Aspekt des Rudels)
    	macroIndex = GetMacroIndexByName(macroName)
     	EditMacro(macroIndex, macroName, 180, "/cast Aspekt des Rudels", 1, 1)
    	
    	if debugLevel == 1 then
    	self:Print("Macro switched to Aspect of the Pack") else
    	end
    end


    Dragaron
    Posted in: Lua Code Discussion
  • 0

    posted a message on Starts with showing on minimap
    Hi,

    Iam searching a way to start something, when on minimap is showing the yellow point of herbs etc.

    Can someone help me?

    mfg
    Dragaron
    Posted in: Lua Code Discussion
  • 0

    posted a message on Create frame
    Hi,

    i found in "AceGUI for Ace 3.x" this code to create a frame.

    local frame = LibStub("AceGUI-3.0"):Create("Frame");


    Ok, but i do not understand what i have do to set name, width, height, etc?

    mfg
    Dragaron
    Posted in: Ace3
  • 0

    posted a message on GetSpellCooldown
    Hi, i try to get the cooldowntime to programm a timer. When I use this function the content of the variable "duration" is 1,5 and not the cooldowntime of 30 sec. ?! Why

    function IceAge:UNIT_SPELLCAST_SUCCEEDED(event, unit, name, rank)
    	local start, duration, enabled = GetSpellCooldown(name)
    	self:Print(name, start, duration, enabled)
    end


    mfg
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Beginner] Questions about events
    Ah, thx. The first arg is not Unit, it is Eventname.

    function IceAge:UNIT_SPELLCAST_SUCCEEDED(Event, TrapUnit, TrapName, TrapRank)
    	if TrapRank == "" then
    	self:Print(TrapName, "gelegt")
    	UIErrorsFrame:AddMessage(TrapName, 0.0, 1.0, 0.0, 5.0)
    	else self:Print(TrapName, TrapRank, "gelegt")
    	UIErrorsFrame:AddMessage(TrapName, 1.0, 1.0, 1.0, 5.0)
    	end
    end


    How do i program self:Print(TrapName, TrapRank, "gelegt") in a UIErrorsFrame:AddMessage(TrapName, 1.0, 1.0, 1.0, 5.0)

    And is there a event to get the cooldowntime?
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Beginner] Questions about events
    This is the way i tried it, but is doesnt work.

    function IceAge:UNIT_SPELLCAST_SUCCEEDED(unit, name, rank)
    	if name == "Eisk?ltefalle" then
    	self:Print(name "gelegt!")
    	end
    end


    I try to program a timer for Freezing Trap. Have i to use the english trapnames?

    mfg
    Posted in: Lua Code Discussion
  • 0

    posted a message on [Beginner] Questions about events
    Hi,

    i dont know why, but i have started to learn how to program a addon. ;)

    I have some know about Visual Basic - and i thing lua is similar.

    Ok, i have used the beginnerguide "WelcomeHome - Your first Ace3 Addon" and i have same questions about events.
    I use this code:
    IceAge = LibStub("AceAddon-3.0"):NewAddon("IceAge", "AceConsole-3.0", "AceEvent-3.0")
    
    function IceAge:OnInitialize()
      -- Called when the addon is loaded
     end
    
    function IceAge:OnEnable()
      -- Called when the addon is enabled
    	self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
    end
    
    function IceAge:OnDisable()
      -- Called when the addon is disabled
    end
    
    function IceAge:UNIT_SPELLCAST_SUCCEEDED()
    	self:Print(spell)
    end


    But my problem is, that all cast stardet the UNIT_SPELLCAST_SUCCEEDED. Is it possible that only a Trap stardet it?
    And i dont know, but how stardet the Function? The game? And arg1,...,arg3 - must i give this?

    mfg
    Dragaron
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.