Quantcast LoTROInterface - View Single Post - Lua Beginner has some questions
View Single Post
Unread 06-13-2016, 08:23 PM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
Join Date: Oct 2010
Posts: 270

I'll try answering your questions in order:
Originally Posted by Hamkaas
I just started messing around with creating lua lotro plugins and i have quite a lot of questions. Please feel free to answer just a couple instead of all if you don't know all answers or you don't feel like it.

I've just started and i don't have a lot of experience with programming and have a lot of questions. I'll start with the questions most important to me.

1. Is there a way to disable the tooltip that pops up when you hover over a alias shortcut. the "alias: bla bla bla" popup?
There's a few UI options for changing how tooltips function but nothing via Lua.
2. When i make a quickslot and bind an alias shortcut to it, can i somehow make it do something extra when you click it? like do the alias shortcut and perform commands. If i try to catch the mouseclick event it does not seem to be willing to do both. At the moment i'm using a workaround by catching the message it sends in the chat and then run the commands from that but it is too slow for what i want to use it for and also not very elegant.
Unfortunately you've already found the best solution for that one which is the chat listener. FWIW, very few of the solutions to the Turbine limitations on Lua are elegant
3. When i create a quickslot and drag an item to it ingame and then try to unload the plugin my client crashes 100% of the time. Is this because i do not handle the unloading properly? i've read the "writing plugins for noobs" post from garan on lotro forums (https://www.lotro.com/forums/showthr...gins-for-Noobs) but i didn't really understand the part about unloading right. How should i write the unload section for my plugin?
I suspect the crashes are due to the way you are creating your quickslots. I'd have to see your code to be sure. The unload event handler is more for cleaning up event handlers and command objects (the client used to crash if you created a command and exited without removing it but I believe that bug was fixed many years ago).
4. What is the max size image i can load? I was trying to make an animation by making 2 Turbine.UI.Control() things, then making control 1 parent of control 2 and setting a size for control 1 and then setting a image with the whole animation (like 10 frames) as background for control 2 and then moving control 2's relative position to control 1 so it gets cropped.
When trying this it worked for really small images but it didn't when my images were larger then around 50x50 pixels. Would you advice me to not use animations or load 10 different pictures?
I don't actually know what the max size for an image would be but it's several meg. However, Turbine's implementation of Lua probably does not handle animated images very well. I would recommend using separate images and controlling their loading via an Update event and a timer, that way you can also retain some control of the speed of the animation.
5. Then finally i have a couple of questions about what i saw in this thread:
Here in the 2nd post Garan gives tips on hiding quickslots.

Garan says you should make your quickslot 34 pixels higher and wider and then crop it by making another control with a smaller size the parent to hide the alias text. But in the example code Garan also makes a black window in front of the quickslot to hide the icon boundry when you hover.
But why make the extra control and crop the quickslot? the black window hides the text as well right?
Or let me ask it like this: What extra functionality do you get making your quickslot part of a different control like this?

Also Garan says you should write code to prevent people from dragging your shortcut out of the quickslot, but somehow for me this behavior is default? i cannot drag the shortcut out of there even if i wanted to.

Did an update change these things or do i miss the point of these things altogether?

Thanks in advance.
You don't gain any advantage other than masking by putting the quickslot inside another control. The point of the excess size is so that the quickslot will still be clickable but will be positioned far enough behind the border of its parent so as to be properly clipped. If you have more than one quickslot then the window would not be sufficient - with only one, yes, you could just use the window as the parent.

As to dragging the shortcut out of the quickslot, I believe it is still possible to accidentally drag a shortcut out of a quickslot if it is not prevented by the author. Are you possibly playing with a Mac or Linux install? That may make a difference to the shortcut drag behavior.
Reply With Quote