| Thema: Hunter Addon Problem mit LUA Diskutiere im Interfaceanpassung Forum über Hunter Addon Problem mit LUA. Hallo, ich will für den Hunter ein Addon schreiben, welches NUR den Zufriedenheitsframe des Pets anzeigt. hier sind die LUA und XML dateien:
Code:
function.lua
local happiness;
function out(text)
DEFAULT_CHAT_FRAME:AddMessage(text)
end
function error(textmsg)
UIErrorsFrame:AddMessage(textmsg, 1.0, 1.0, 0, 1, 10)
end
function FaraFrames_OnLoad()
this:RegisterEvent("PLAYER_ENTERING_WORLD");
this:RegisterEvent("PLAYER_LOGIN");
this:RegisterEvent("PLAYER_PET_CHANGED");
... Du bist noch kein Mitglied? Mitglieder sehen keine störende Werbung und können alle Funktionen des Forums nutzen. Die Registrierung ist kostenlos und es ist keine Bestätigung deiner E-Mail Adresse erforderlich! Schließe dich rund 260.000 Mitgliedern an und sei Teil des größten, deutschen World of Warcraft Forums!
07.10.2008, 07:58
|
#1 | Level 4 | Hunter Addon Problem mit LUA Hallo, ich will für den Hunter ein Addon schreiben, welches NUR den Zufriedenheitsframe des Pets anzeigt. hier sind die LUA und XML dateien: Code: function.lua
local happiness;
function out(text)
DEFAULT_CHAT_FRAME:AddMessage(text)
end
function error(textmsg)
UIErrorsFrame:AddMessage(textmsg, 1.0, 1.0, 0, 1, 10)
end
function FaraFrames_OnLoad()
this:RegisterEvent("PLAYER_ENTERING_WORLD");
this:RegisterEvent("PLAYER_LOGIN");
this:RegisterEvent("PLAYER_PET_CHANGED");
this:RegisterEvent("UNIT_AURA");
this:RegisterEvent("UNIT_COMBAT");
this:RegisterEvent("UNIT_DISPLAYPOWER");
this:RegisterEvent("UNIT_FOCUS");
this:RegisterEvent("UNIT_HAPPINESS");
this:RegisterEvent("UNIT_HEALTH");
this:RegisterEvent("UNIT_LEVEL");
this:RegisterEvent("UNIT_MANA");
this:RegisterEvent("UNIT_MAXFOCUS");
this:RegisterEvent("UNIT_MAXHEALTH");
this:RegisterEvent("UNIT_MAXMANA");
this:RegisterEvent("UNIT_MODEL_CHANGED");
this:RegisterEvent("UNIT_NAME_UPDATE");
this:RegisterEvent("UNIT_PET");
this:RegisterEvent("UNIT_PET_EXPERIENCE");
this:RegisterEvent("UNIT_PORTRAIT_UPDATE");
this:RegisterEvent("UNIT_SPELLMISS");
out("Pet Satisfaction erfolgreich geladen.");
SLASH_FARAFRAMES1 = "/petsatisfaction";
SLASH_FARAFRAMES2 = "/ps";
SlashCmdList["FARAFRAMES"] = function(msg)
FaraFrames_SlashCommandHandler(msg);
end
this:SetAttribute("unit", "pet");
end
function Pet_Satisfaction_Events:UNIT_HAPPINESS()
Pet_Satisfaction_Set_Happiness();
end
function Pet_Satisfaction_Set_Happiness()
happiness = GetPetHappiness();
if (happiness == 1) then
Pet_Satisfaction_Texture:SetTexCoord(0.375, 0.5625, 0, 0.359375);
elseif (happiness == 2) then
Pet_Satisfaction_Texture:SetTexCoord(0.1875, 0.375, 0, 0.359375);
elseif (happiness == 3) then
Pet_Satisfaction_Texture:SetTexCoord(0, 0.1875, 0, 0.359375);
end
end
function FaraFrames_SlashCommandHandler(msg)
FaraFrames_Toggle(msg);
end
function FaraFrames_Toggle(num)
local frame = getglobal("FaraFrames" .. num)
if (frame) then
if( frame:IsVisible() ) then
frame:Hide();
else
frame:Show();
end
end
end Code: interface.xml
<Ui xmlns="http://www.blizzard.com/wow/ui/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="functions.lua"/>
<!-- Here the Scripts that have to be Executed -->
<Frame name="FaraFrames_GeneralScripts" hidden="true">
<Scripts> <OnLoad> FaraFrames_OnLoad(); </OnLoad></Scripts>
</Frame>
<Frame name="FaraFrames" hidden="true" virtual="true" parent="UIParent">
<!-- set the size of the frame -->
<Size>
<AbsDimension x="200" y="200"/>
</Size>
<!-- set where the frame will be anchored -->
<Anchors>
<Anchor point="CENTER" />
</Anchors>
<!-- set the parameters for the layers of the frame -->
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parent_Background" setAllPoints="true">
<!-- Texture has blue color wit 50% alpha -->
<Color r="0" g="0" b="1" a="0.5" />
</Texture>
</Layer>
</Layers>
<!-- event handling -->
</Frame>
<!-- We now create a new Template with frameStrata="DIALOG" the Backdrop Border definitions work only correctly with the Dialog type of Frame -->
<Frame name="FaraFramesDialog" hidden="true" toplevel="true" virtual="true" frameStrata="DIALOG" parent="UIParent">
<Size>
<AbsDimension x="24" y="23"/>
</Size>
<Anchors>
<Anchor point="CENTER"/>
</Anchors>
<Backdrop tile="true">
<TileSize>
<AbsValue val="32"/>
</TileSize>
<EdgeSize>
<AbsValue val="32"/>
</EdgeSize>
<BackgroundInsets>
<AbsInset left="11" right="12" top="12" bottom="11"/>
</BackgroundInsets>
</Backdrop>
</Frame>
<Frame name="FaraFramesshow" inherits="FaraFramesDialog" movable="true" enableMouse="true">
<Size>
<AbsDimension x="24" y="23"/>
</Size>
<Anchors>
<Anchor point="TOP">
<Offset>
<AbsDimension x="0" y="-5"/>
</Offset>
</Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<Texture name="Pet_Satisfaction_Texture" file="Interface\PetPaperDollFrame\UI-PetHappiness" setAllPoints="true">
<Size>
<AbsDimension x="24" y="23"/>
</Size>
<TexCoords left="0" right="0.1875" top="0" bottom="0.359375"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnMouseDown> this:StartMoving(); </OnMouseDown>
<OnMouseUp> this:StopMovingOrSizing(); </OnMouseUp>
<OnDragStop> this:StopMovingOrSizing(); </OnDragStop>
</Scripts>
</Frame>
</Ui> Code: PetSatisfaction.toc
## Interface: 20400
## Title: PetSatisfaction
## Notes: Die Petzufriedenheits Frame.
## SavedVariablesPerCharacter: Pet_Satisfaction_Save
## Version: 1.0
## Author: uddy
interface.xml Ich hoffe auf schnelle antwort |
| |
07.10.2008, 07:58
|
| | AW: Hunter Addon Problem mit LUA
Hast du schon im Lösungsbuch nachgelesen? Eventuell hilft dir das ja weiter...
|
| |
07.10.2008, 08:12
|
#2 | Level 85
... ist apathisch
Fraktion: Allianz Realm: Arygos Rasse: Menschen Klasse: Todesritter
Beiträge: 4.790
| AW: Hunter Addon Problem!!! antwort worauf? sry aber kann bei bestem willen keine frage in deinem text finden und falls du hilfe bei deiner lua haben solltest, wäre es vll schön wenn du die stellen markierst, bei denen du nicht weißt wie die richtige codierung ist, 3 seiten codes zu posten bringt kaum einem was, poste dein problem, schreib was du willst und dann kann man auch antworten^^ |
| |
07.10.2008, 08:22
|
#3 | Level 4 | AW: Hunter Addon Problem!!! ok wie du willst 
also meine fragt ist: Warum wird im spiel nur das  Bild angezeigt?
Stellen im Code die nicht gehen: Code: function out(text)
DEFAULT_CHAT_FRAME:AddMessage(text)
end
function error(textmsg)
UIErrorsFrame:AddMessage(textmsg, 1.0, 1.0, 0, 1, 10)
end
function FaraFrames_OnLoad()
this:RegisterEvent("PLAYER_ENTERING_WORLD");
this:RegisterEvent("PLAYER_LOGIN");
this:RegisterEvent("PLAYER_PET_CHANGED");
this:RegisterEvent("UNIT_AURA");
this:RegisterEvent("UNIT_COMBAT");
this:RegisterEvent("UNIT_DISPLAYPOWER");
this:RegisterEvent("UNIT_FOCUS");
this:RegisterEvent("UNIT_HAPPINESS");
this:RegisterEvent("UNIT_HEALTH");
this:RegisterEvent("UNIT_LEVEL");
this:RegisterEvent("UNIT_MANA");
this:RegisterEvent("UNIT_MAXFOCUS");
this:RegisterEvent("UNIT_MAXHEALTH");
this:RegisterEvent("UNIT_MAXMANA");
this:RegisterEvent("UNIT_MODEL_CHANGED");
this:RegisterEvent("UNIT_NAME_UPDATE");
this:RegisterEvent("UNIT_PET");
this:RegisterEvent("UNIT_PET_EXPERIENCE");
this:RegisterEvent("UNIT_PORTRAIT_UPDATE");
this:RegisterEvent("UNIT_SPELLMISS");
out("Pet Satisfaction erfolgreich geladen.");
SLASH_FARAFRAMES1 = "/petsatisfaction";
SLASH_FARAFRAMES2 = "/ps";
SlashCmdList["FARAFRAMES"] = function(msg)
FaraFrames_SlashCommandHandler(msg);
end
this:SetAttribute("unit", "pet");
Pet_Satisfaction_Set_Happiness();
end
function Pet_Satisfaction_Events:UNIT_HAPPINESS() --DIESE FUNCTION KÖNNTE NICHT GEHEN
Pet_Satisfaction_Set_Happiness();
end
function Pet_Satisfaction_Set_Happiness() --DIESE FUNCTION KÖNNTE NICHT GEHEN
local happiness = GetPetHappiness();
if (happiness == 1) then
Pet_Satisfaction_Texture:SetTexCoord(0.375, 0.5625, 0, 0.359375);
elseif (happiness == 2) then
Pet_Satisfaction_Texture:SetTexCoord(0.1875, 0.375, 0, 0.359375);
elseif (happiness == 3) then
Pet_Satisfaction_Texture:SetTexCoord(0, 0.1875, 0, 0.359375);
end
end
function FaraFrames_SlashCommandHandler(msg)
FaraFrames_Toggle(msg);
end
function FaraFrames_Toggle(num)
local frame = getglobal("FaraFrames" .. num)
if (frame) then
if( frame:IsVisible() ) then
frame:Hide();
else
frame:Show();
end
end
end Stellen wurden mit "--DIESE FUNCTION KÖNNTE NICHT GEHEN" markiert.
so besser? |
| |
07.10.2008, 08:30
|
#4 | Ehren-Mitglied
... ist beschäftigt
Fraktion: Allianz Realm: Forscherliga Rasse: Gnome Klasse: Schurke
Beiträge: 7.055
| AW: Hunter Addon Problem!!! hm... fehlen bei den ersten beiden functions nicht schon Semikolons? 
Ausserdem hast du viel mehr "end"s als "function"s... ich würd den Code nochmal gründlich durchsehen an deiner Stelle |
| |
07.10.2008, 09:00
|
#5 | Level 85
... ist apathisch
Fraktion: Allianz Realm: Arygos Rasse: Menschen Klasse: Todesritter
Beiträge: 4.790
| AW: Hunter Addon Problem!!! jo sieht tatsächlich nach zuvielen ends und zu wenig functions aus, auch fehlen scheinbar einige zeichen, lies den text mal genau kontrolle.
falls die korrektur dich tatsächlich nicht weiterbringt, schau mal im offi-forum nach, da gibt es eine detaillierte decodierung mit erklärung etc. |
| |
07.10.2008, 10:35
|
#6 | Administrator
... ist fleißig
Fraktion: Horde Realm: Gorgonnash Rasse: Blutelfen Klasse: Jäger
Beiträge: 1.639
| AW: Hunter Addon Problem (lua) Wenn ich mich nicht irre, wird die Funktion Pet_Satisfaction_Set_Happiness aufgerufen, bevor sie überhaupt geladen wurde. |
| |
07.10.2008, 11:24
|
#7 | Level 4 | AW: Hunter Addon Problem mit LUA ich habe den code nochmal überarbeitet. Das jetzige Problem ist: Wenn ich im spiel versuche /ps einzugeben dann passiert nichts, der text /ps bleibt stehen. 2. Problem (wichtiger): Jetzt habe ich das event UNIT_HAPPINESS in einer event functon eingebunden nur das geht nicht.
Hier der Code: Code: local happiness;
function out(text)
DEFAULT_CHAT_FRAME:AddMessage(text);
end
function error(textmsg)
UIErrorsFrame:AddMessage(textmsg, 1.0, 1.0, 0, 1, 10);
end
function FaraFrames_OnLoad()
this:RegisterEvent("PLAYER_ENTERING_WORLD");
this:RegisterEvent("PLAYER_LOGIN");
this:RegisterEvent("PLAYER_PET_CHANGED");
this:RegisterEvent("UNIT_AURA");
this:RegisterEvent("UNIT_COMBAT");
this:RegisterEvent("UNIT_DISPLAYPOWER");
this:RegisterEvent("UNIT_FOCUS");
this:RegisterEvent("UNIT_HAPPINESS");
this:RegisterEvent("UNIT_HEALTH");
this:RegisterEvent("UNIT_LEVEL");
this:RegisterEvent("UNIT_MANA");
this:RegisterEvent("UNIT_MAXFOCUS");
this:RegisterEvent("UNIT_MAXHEALTH");
this:RegisterEvent("UNIT_MAXMANA");
this:RegisterEvent("UNIT_MODEL_CHANGED");
this:RegisterEvent("UNIT_NAME_UPDATE");
this:RegisterEvent("UNIT_PET");
this:RegisterEvent("UNIT_PET_EXPERIENCE");
this:RegisterEvent("UNIT_PORTRAIT_UPDATE");
this:RegisterEvent("UNIT_SPELLMISS");
out("Pet Satisfaction erfolgreich geladen.");
SLASH_FARAFRAMES1 = "/petsatisfaction";
SLASH_FARAFRAMES2 = "/ps";
SlashCmdList["FARAFRAMES"] = function(msg)
FaraFrames_SlashCommandHandler(msg);
end
this:SetAttribute("unit", "pet");
this:SetScript("OnEvent", Pet_Satisfaction_OnEvent);
end
function Pet_Satisfaction_OnEvent() --- hier muss irgendwo noch ein fehler sein
local func = Pet_Satisfaction_Events[event];
if (func) then
func();
end
end
function Pet_Satisfaction_Events:UNIT_HAPPINESS() -- diese Function ist verantwortlich für die eingabeprobleme
Pet_Satisfaction_Set_Happiness();
end
function Pet_Satisfaction_Set_Happiness()
if (GetPetHappiness() == 1) then
Pet_Satisfaction_Texture:SetTexCoord(0.375, 0.5625, 0, 0.359375);
elseif (GetPetHappiness() == 2) then
Pet_Satisfaction_Texture:SetTexCoord(0.1875, 0.375, 0, 0.359375);
elseif (GetPetHappiness() == 3) then
Pet_Satisfaction_Texture:SetTexCoord(0, 0.1875, 0, 0.359375);
end
end
function FaraFrames_SlashCommandHandler(msg)
if (msg == "change") then
Pet_Satisfaction_Set_Happiness()
end
FaraFrames_Toggle(msg);
end
function FaraFrames_Toggle(num)
local frame = getglobal("FaraFrames" .. num)
if (frame) then
if( frame:IsVisible() ) then
frame:Hide();
else
frame:Show();
end
end
end |
| |
07.10.2008, 11:55
|
#8 | Level 4 | AW: Hunter Addon Problem (lua) Zitat:
Zitat von Labrador Wenn ich mich nicht irre, wird die Funktion Pet_Satisfaction_Set_Happiness aufgerufen, bevor sie überhaupt geladen wurde.
Diese Function geht einwahnfrei, es geht nur um diese beiden functionen Code: function Pet_Satisfaction_OnEvent()
local func = Pet_Satisfaction_Events[event];
if (func) then
func();
end
end
function Pet_Satisfaction_Events:UNIT_HAPPINESS()
Pet_Satisfaction_Set_Happiness();
end Diese enthalten Fehler... |
| |
07.10.2008, 12:14
|
#9 | Level 4 | AW: Hunter Addon Problem mit LUA Ich habe den Fehler gefunden, Danke an alle die sich dem Thread gewidmet haben. |
| | Ähnliche Themen zu „Hunter Addon Problem mit LUA” - addon problem
hi
ich habe ein problem mit meienem addon
und zwar zeigt mir das addon komplett an was wer in meienm umkreis castet
heist im bg sehe ich meine... - Hunter Addon Problem!!!
Hallo, ich will für den Hunter ein Addon schreiben, welches NUR den Zufriedenheitsframe des Pets anzeigt. hier sind die LUA und XML dateien:... - Riesengroßes Problem mit eienn Addon!
Habe ein Problem mit einen Addon und zwar den Titan-emotes menu addon es funktioniert nicht.
Titan Pannel läuft einwandfrei unter Addons ist untzer... - Problem mit einen Interface Addon
Hallo Leute
ich habe mir da Addon Pack "Victory Rush UI" heruntergeladen, und es passt mir auch sehr gut.
Das Problem das ich habe ist eigentlich... - Addon Problem
Habe ein grosses Addon Problem! :traurig:
Habe gerade vor ca 30 Minuten etwa 10 neue Addons die mit dem neuen Patch 2.0 funzen müssten. Von...
Stichworte zum Thema Hunter Addon Problem mit LUA | wow lua unit_aura, abs dimension x=, wow lua get backdrop name | | |