05-31-05, 10:33 AM | #41 |
just tried it. it appears to work, however not without errors. Some tweaking may be in order, but my initial test of remapping an element to a new element worked perfectly.
I tried it with PlayerFrame = cPlayerFrame; and then created cPlayerFrame as an exact duplicate of the regular PlayerFrame, but with the new name... Generated some errors, but still showed up in place of the regular PlayerFrame... |
|
05-31-05, 10:39 AM | #42 |
That sounds like the way I'm going to want to do things, if I'm reading it right.
|
|
05-31-05, 12:17 PM | #43 |
It didn't work with Minimap=DS_Minimap, or with MinimapCluster=DS_MinimapCluster, at least not in the way I had hoped.
It certainly ties the two together, but it doesn't appear to carry anchors or parents over. All of the AddOns referencing the original minimap still did, without carring over any of said activity to the new map. <sigh> Back to the drawing board. I dont mind editing a few buttons to anchor to my new minimap, but I haven't even peeked at Gatherer's Code yet. The mere notion gives me the willy's. |
|
05-31-05, 03:34 PM | #44 |
hmm, will play with it some more. Remapping an element reference would in fact be the ideal way to do a total conversion in my opinion...
Something else you might consider is NOT hiding MinimapCluster, but instead find a way to make it transparent. You might do this by setting the texture for it in your LUA to something that is blank, and then anchor it to your new minimap. Then addons can still anchor to it all they want, they will just be anchored to it, which is anchored to yours... if you get what I mean. The final thing you could do, to at least get some mods to work right, is to do a detection script within your own addon. I did this for an addon I was testing, which is going to be part of a larger suite I plan to release very soon. Create a new function that does something like: Code:
function MyMiniMapCluster_OnDetect() if (SomeGathererFunction) then GathererIcon:ClearAllPoints(); GathererIcon:SetPoint("TOP", "MyMiniMapCluster", "TOP", 0, 0); end end I don't believe in making slight changes in other AddOns to make them work with mine. I either rewrite their AddOn from the ground up to suit my needs, or I do something in my own AddOn to make theirs behave the way I need it to. Changing underlying code in an AddOn maintained by someone else breaks forwards compatibility when someone attempts to update that individual AddOn. This is one of the problems many users of "Recompilations" face when the original creator of a mod releases an update, and the recmp user attempts to update that part. They then lose whatever custom code the recmp creator added or changes, and thereby lose some functionality of that recmp, or worse causes errors... Last edited by Beladona : 05-31-05 at 04:00 PM. |
|
05-31-05, 06:31 PM | #45 | ||
The code block you gave me above should be just the ticket though for some of the map issues, if not all of them. (Assuming of course, that I can sort it out once I get in there ). Thanks again Beladona. |
|||
05-31-05, 07:34 PM | #46 |
EDIT: scrap all that its already been said, should read before I post, lol.
On another note, one option is that you could actually leave the minimap name being the same as the blizzard default and this *should* overwrite their definition. This works because the FrameXML files(the defacto standard as it where) loads first. Then the addon directory loads. Not a 'recommended way of doing things' but it may work. Last edited by Kaelten : 05-31-05 at 07:57 PM. |
|
05-31-05, 11:51 PM | #47 | |
Thank you Kaeltan. I'll give that a try tomorrow night. I'm tired now, and tired me makes version saving mistakes. I figured this wouldn't be easy, if possible at all, otherwise someone would have done it already. It's funny, I could have been done with this in less than an hour with a FrameXML hack, but that just wouldn't be any fun now would it. I think I would have more luck petitioning Blizzard just to name the dang textures in their default file. |
||
06-01-05, 09:32 AM | #48 |
That minimap is so hot.
|
|
06-02-05, 06:04 AM | #50 | |
I'm aware. . . In the past, that site made little more sense to me than lua in general. Now that I'm slowly beginning to wrap my brain around the script, mayhap I should give it another look-see. I'm sure its a useful resource, I just hadn't been able to put it to much use in the past. I'm still looking for a lua for dummies. It's probably sounds funny to those who code, but I couldn't tell you specifically what the significance of a semi colon is. Some times they appear needed, other times they dont. Another one is "=" vs "==". Does the latter mean, "not equal"? If so, then why do you sometimes simply say: "if not yadada". I'm a language sort. Many moons ago I used to love diagramming sentences when all my classmates were groaning. Somehow, the syntax here is just coming so so slowly to me however. :| |
||
06-02-05, 08:46 AM | #51 |
WoWwiki is useful to me only in refreshing my memory on existence of functions and such. The site is HORRIBLY lacking in information. They rely on the communnity to provide usage info for each function and stuff like that, which I guess is partly my fault in that I never bother to submit anything...
Still, nothing can beat a direct question to someone that knows the answer. I tend to find all my info out on my own, but am more than willing to answer questions when they arise. |
|
06-03-05, 12:36 PM | #52 |
Just a sneak peek at part of what I am working on:
I moved all of the default micro menu buttons to the bar at the top, and mde a minimap toggle button with the minimap docked to the bar in a way that makes it look integrated to the bar. I know this looks like Titan Panel, which is true only in appearance, as all base coding is original, not to mention this is NOT meant to use plugins. In fact, if anything, I designed this bar to be a companion to Titan panel, as you can effectively have both on screen at the same time, with Titan panel docked to the bottom. I have done tons of experimentation with code standards, playing with different methods of writing my lua scripts, in order to see which works the best / fastest. For the sake of standard compliance and making sure my mod never uses the same namespace for a function or widget that another mod uses, I have started putting ALL my functions and such into tables. Basically if I have a mod called myMod, I create a table called myMod, and all functions that go into that mod are children of that table. For example myMod.onUpdate(); could be a valid function. It also makes it easier to add new functions into that table within other lua scripts, sot aht other mods could effectively "plug in" to my mod. It also makes it MUCH less likely that my mod will conflict with other mods because of a shared namespace. The other thing I have started experimenting with is disabling default functions that no longer serve a purpose. For instance, if you decided to hide something in the ui permanently (as long as the mod is installed anyway), then that ui element no longer really needs to exist. yet there are all these functions in the background that may or may not be firing, and as a result are taking up engine and memory space. So why not rehook them to a blank function? Less memory used = faster gameplay in my opinion. If the widget you disable is the only thing using that function, then there is no reason on earth the widget needs to exist at all. SO FAR this has worked like a charm for me, but as I do further testing I will know for sure. Obviously some functions may be best to leave alone, as they may be in use elsewhere... Hopefully this gave people ideas. My eventual goal is to almost completely redesign the look and feel of the ui, rather than just add little things here and there. |
|
06-03-05, 01:59 PM | #53 | |||
Speaking of the map, that is really nicely executed. Well done! I have to ask... What happens when you click the open button for it? (give you three guesses why I'm curious)
On a not really related note, I have a question. My AddOn, so far, doesn't contain a much if any lua/memory action. (Cant speak for MoveAnything! waaaay over my head what's goin on in there, but It feels clean on the top end anyway.) What it does have is a lot of frames, much of which are typically hidden. I swear I read once that a hidden (truly hidden, like, lua :Hide(); hidden) frame isn't using system resources. I'm curious if this is true, I think its fairly relevant to DiivSkins. Any idea if this is corrrect?
Thank you for sharing, I look forward to seeing more. |
||||
06-04-05, 12:29 AM | #54 |
After finally knuckling down and asking about getting the minimap texture named in the official forums, I found that someone <cough> Gello <cough> had beat me to the punch.
http://forums.worldofwarcraft.com/th...n&t=138577&p=3 Looks like all it will take to do a proper reskin of the minimap and the casting bar is a little patience. EDIT: actually, that thread is chock-o-block with blue text.. lot of nice info there. I linked to page three, but take it from the top. It's a good read. Last edited by diiverr : 06-04-05 at 12:32 AM. |
|
06-04-05, 07:18 PM | #55 |
very nice link... and damnit, stop making me add stuff to my already messy list of bookmarks =p
Functions arranged in tables: Just a short tutorial that I hope will help you............. myMod.lua contains: Code:
myMod = {}; --------------------------------------------- myMod.onLoad = function() this:RegisterEvent("VARIABLES_LOADED"); GameTimeFrame:Hide(); end; myMod.onEvent = function() if (event == "VARIABLES_LOADED") then -- do whatever here end -- do some more stuff end; Make sure when you do it this way, that you put a semicolon after the last END for each function (the engine might let you get away with not doing it, but for the sake of proper coding practices, you should do it.). The reason you ahve to put a semicolon there is that each function is essentially just a variable with a function as it's data. It works the same as any normal function, but gets written a little different... Any Questions? hehe |
|
06-04-05, 09:02 PM | #56 |
Lord help me, I think that actually did make sense.
Lately I've been pouring over the XML, and have been learning a lot about the fundamental architecture there. The system here is a lot more wide open than it was in DAoC. It can be more complicated, but once you get a handle on it, I've found you can do some comparatively nifty stuff with the parent child relationships, particularly when you toss a little lua in to assist something more complex. The lua stuff is coming, gradually. Thankfullly what I tend to work with doesn't require a ton of it, and what I do use it for is fairly simple, but I find myself calling more and more functions as my XML (and my end result in game) gets more and more intricate. I will definitely play around with the tables, even if only just to see if I can get them working. By the time I'm happy with what I'm doing with DiivSkins, I might actually understand some of what has thus far been so baffling for me when I dig around in the more complicated AddOns. As always, thanks so much for your reply Beladona. |
|
06-29-05, 01:33 PM | #57 | |
Also, you mentioned widgets. How do you name your ui elements in the XML? Do you declare all named ui elements in a table in an included script at the beginning of the XML or something? |
||
10-13-05, 03:09 PM | #58 |
I hate reviving an old thread but this one is really interesting... I do have one question for you
Here's Diiver's code for his casting bar Code:
CASTING_BAR_ALPHA_STEP = 0.05; CASTING_BAR_FLASH_STEP = 0.2; CASTING_BAR_HOLD_TIME = 1; function DS_CastingBarFrame_OnLoad() this:RegisterEvent("SPELLCAST_START"); this:RegisterEvent("SPELLCAST_STOP"); this:RegisterEvent("SPELLCAST_FAILED"); this:RegisterEvent("SPELLCAST_INTERRUPTED"); this:RegisterEvent("SPELLCAST_DELAYED"); this:RegisterEvent("SPELLCAST_CHANNEL_START"); this:RegisterEvent("SPELLCAST_CHANNEL_UPDATE"); this.casting = nil; this.holdTime = 0; CastingBarFrame_OnEvent = DS_CastingBarFrame_OnEvent CastingBarFrame_OnUpdate = DS_CastingBarFrame_OnUpdate --tried just using CastingBarFrame:Hide(); below too. that didn't work either if DS_CastingBarFrame:IsVisible() then CastingBarFrame:Hide(); end end function DS_CastingBarFrame_OnEvent() if ( event == "SPELLCAST_START" ) then DS_CastingBarFrameStatusBar:SetStatusBarColor(1.0, 0.7, 0.0); DS_CastingBarSpark:Show(); this.startTime = GetTime(); this.maxValue = this.startTime + (arg2 / 1000); DS_CastingBarFrameStatusBar:SetMinMaxValues(this.s tartTime, this.maxValue); DS_CastingBarFrameStatusBar:SetValue(this.startTim e); DS_CastingBarText:SetText(arg1); this:SetAlpha(1.0); this.DS_holdTime = 0; this.DS_casting = 1; this.fadeOut = nil; this:Show(); this.mode = "DS_casting"; elseif ( event == "SPELLCAST_STOP" ) then if ( not this:IsVisible() ) then this:Hide(); end if ( this:IsShown() ) then DS_CastingBarFrameStatusBar:SetValue(this.maxValue ); DS_CastingBarFrameStatusBar:SetStatusBarColor(0.0, 1.0, 0.0); DS_CastingBarSpark:Hide(); DS_CastingBarFlash:SetAlpha(0.0); DS_CastingBarFlash:Show(); this.DS_casting = nil; this.flash = 1; this.fadeOut = 1; this.mode = "flash"; end elseif ( event == "SPELLCAST_FAILED" or event == "SPELLCAST_INTERRUPTED" ) then if ( this:IsShown() ) then DS_CastingBarFrameStatusBar:SetValue(this.maxValue ); DS_CastingBarFrameStatusBar:SetStatusBarColor(1.0, 0.0, 0.0); DS_CastingBarSpark:Hide(); if ( event == "SPELLCAST_FAILED" ) then DS_CastingBarText:SetText(FAILED); else DS_CastingBarText:SetText(INTERRUPTED); end this.DS_casting = nil; this.fadeOut = 1; this.DS_holdTime = GetTime() + CASTING_BAR_HOLD_TIME; end elseif ( event == "SPELLCAST_DELAYED" ) then if( this:IsShown() ) then this.startTime = this.startTime + (arg1 / 1000); this.maxValue = this.maxValue + (arg1 / 1000); DS_CastingBarFrameStatusBar:SetMinMaxValues(this.s tartTime, this.maxValue); end elseif ( event == "SPELLCAST_CHANNEL_START" ) then DS_CastingBarFrameStatusBar:SetStatusBarColor(1.0, 0.7, 0.0); DS_CastingBarSpark:Show(); this.maxValue = 1; this.startTime = GetTime(); this.endTime = this.startTime + (arg1 / 1000); this.duration = arg1 / 1000; DS_CastingBarFrameStatusBar:SetMinMaxValues(this.s tartTime, this.endTime); DS_CastingBarFrameStatusBar:SetValue(this.endTime) ; DS_CastingBarText:SetText(arg2); this:SetAlpha(1.0); this.DS_holdTime = 0; this.DS_casting = nil; this.channeling = 1; this.fadeOut = nil; this:Show(); elseif ( event == "SPELLCAST_CHANNEL_UPDATE" ) then if ( arg1 == 0 ) then this.channeling = nil; elseif ( this:IsShown() ) then local origDuration = this.endTime - this.startTime this.endTime = GetTime() + (arg1 / 1000) this.startTime = this.endTime - origDuration --this.endTime = this.startTime + (arg1 / 1000); DS_CastingBarFrameStatusBar:SetMinMaxValues(this.s tartTime, this.endTime); end end end function DS_CastingBarFrame_OnUpdate() if ( this.DS_casting ) then local status = GetTime(); if ( status > this.maxValue ) then status = this.maxValue end DS_CastingBarFrameStatusBar:SetValue(status); DS_CastingBarFlash:Hide(); local sparkPosition = ((status - this.startTime) / (this.maxValue - this.startTime)) * 195; if ( sparkPosition < 0 ) then sparkPosition = 0; end DS_CastingBarSpark:SetPoint("CENTER", "DS_CastingBarFrameStatusBar", "LEFT", sparkPosition, 0); elseif ( this.channeling ) then local time = GetTime(); if ( time > this.endTime ) then time = this.endTime end if ( time == this.endTime ) then this.channeling = nil; this.fadeOut = 1; return; end local barValue = this.startTime + (this.endTime - time); DS_CastingBarFrameStatusBar:SetValue( barValue ); DS_CastingBarFlash:Hide(); local sparkPosition = ((barValue - this.startTime) / (this.endTime - this.startTime)) * 195; DS_CastingBarSpark:SetPoint("CENTER", "DS_CastingBarFrameStatusBar", "LEFT", sparkPosition, 0); elseif ( GetTime() < this.DS_holdTime ) then return; elseif ( this.flash ) then local alpha = DS_CastingBarFlash:GetAlpha() + CASTING_BAR_FLASH_STEP; if ( alpha < 1 ) then DS_CastingBarFlash:SetAlpha(alpha); else this.flash = nil; end elseif ( this.fadeOut ) then local alpha = this:GetAlpha() - CASTING_BAR_ALPHA_STEP; if ( alpha > 0 ) then this:SetAlpha(alpha); else this.fadeOut = nil; this:Hide(); end end end function DS_CastingBarFrame_UpdatePosition() local castingBarPosition = 60; if ( PetActionBarFrame:IsVisible() or ShapeshiftBarFrame:IsVisible() ) then castingBarPosition = castingBarPosition + 40; end if ( MultiBarBottomLeft:IsVisible() ) then castingBarPosition = castingBarPosition + 40; end DS_CastingBarFrame:SetPoint("BOTTOM", "UIParent", "BOTTOM", 0, castingBarPosition); end this.DS_casting = 1; this.fadeOut = nil; "this." is a table, right? I'm kinda mising it up with "this:"... |
|
10-13-05, 04:57 PM | #59 | |
You can add stuff to the frame/table too. It's very common in the default UI to have a frame store its tooltip there. To backtrack a bit: when an event is sent to your mod, "this" is the frame from which it was sent. The following example doesn't relate to anything but it will hopefully point out exactly what "this" is. If you have 2 frames in your mod and one has the onload: <Frame name="MyFrame1"> <Scripts> <OnLoad> this:RegisterEvent("BAG_UPDATE") </OnLoad> </Scripts> </Frame> <Frame name="MyFrame2"> <Scripts> <OnHide> this:UnregisterEvent("BAG_UPDATE") <!-- wrong as an example see below --> </OnHide> </Scripts> </Frame> When the mod loads, this = MyFrame1 When MyFrame2 hides, this = MyFrame2 Note that you registered MyFrame1 to receive BAG_UPDATE. So you would want to use the frame name instead: <Frame name="MyFrame2"> <Scripts> <OnHide> MyFrame1:UnregisterEvent("BAG_UPDATE") </OnHide> </Scripts> </Frame> As another example, if you have a bunch of buttons in your mod, but don't want to make an _OnClick for each of them. They can all share one function: <Button name="ButtonTemplate" virtual="true"> <Scripts> <OnClick> MyMod_Button_OnClick() </OnClick> </Scripts> </Button> <Button name="Button1" inherits="ButtonTemplate"/> <Button name="Button2" inherits="ButtonTemplate"/> <Button name="Button3" inherits="ButtonTemplate"/> <Button name="Button4" inherits="ButtonTemplate"/> then in your lua: function MyMod_Button_OnClick() local buttonName = this:GetName() DEFAULT_CHAT_FRAME:AddMessage(buttonName) end When you click Button1-4, this is the name of the frame that called it. (Buttons are frames too) So "this" is the table (or frame) Button1, Button2, Button3, etc. You can get its name or the name of any named frame with frame:GetName(). So buttonName = this:GetName() will grab the name of the button that was clicked. btw none of the xml above is fully functional. Just examples kept short. |
||
10-14-05, 10:01 AM | #60 |
Cool thanks alot Gello. Sens and understanding are slowly creeping into my brain
Last edited by shouryuu : 10-14-05 at 11:03 AM. |
|
WoWInterface » Developer Discussions » Lua/XML Help » GUI's |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|