Hi,
How can I get an event when the player smokes some pipe?
I have been successful in getting eating and drinking events from chat but realized that smoking do not raise a chat response. Can I have it in another way?
Thanks! =)
Hi,
How can I get an event when the player smokes some pipe?
I have been successful in getting eating and drinking events from chat but realized that smoking do not raise a chat response. Can I have it in another way?
Thanks! =)
But smoking does generate messages in the emote chat channel:
/smokeYou begin to smoke.
You begin to smoke with Galahard.
Thurallor begins to smoke.
Thurallor begins to smoke with Galahard.
/smoke1
You choke on your pipe smoke.
Thurallor chokes on his pipe smoke.
Last edited by Thurallor; Nov 15 2017 at 10:12 PM.
Pipeweed smoke and Dwale's pipe do not.
"I never feed trolls and I don't read spam" - Weird Al Yankovic
Hi Thurallor,
Thank you for your reply, I didn't know about the "/smoke1", it is quite fun! =p
I should have been more clear, I was talking about when you use items, like "Pouch of Sweet Lobelia Pipe-weed".
When we use food items (like "Small Rations", for example) you have a message in chat like: "You use small rations.", but that does not happen when you use pipe-weed items (since they are actually "Effects" as a category, I think).
Since I am doing some stuffs when player eat and drink (and now smoke) I need to track these, and I couldn't do it anymore through chat.
My workaround (after spending a few hours finding out that I couldn't ever create shortcuts dynamically =p) was creating a special bag with item controls and creating a overlay control that tell me then these items are used, therefore allowing me a doing some nice stuff with it! =D
But now I think I need to recreate the tooltip for the items since the control blocks them from appearing, do you know how I can do it?
I actually created a custom Tooltip plugin for a user that wanted custom tooltips for some reason a few years back. Check:
http://www.lotrointerface.com/downlo...ustomTips.html
it may save you a bit of time.
Thanks Garan, I will check it!
I have been tinkering with your example with a "fake" item (actually I loved the idea since I first tried it a few years ago) and this is one of my core tricks for this plugin.
However, I cannot make it work with a overlay (like the ItemControl works)
Perhaps with an example it is more clear:
This is the ItemControl with Overlay (working but without tooltip and mouseenter effect):
I tried the samething with your Quickslot + Shortcut + Backdrop + Icon but with no success. Whenever I try to "MouseVisible(true) in the Icon control I loose the interaction with the Quickslot (which is the core of the "fake item").self.items[i] = Turbine.UI.Lotro.ItemControl( self.backpack:GetItem( i ) );
-- this is necessary to track the iteration with the items
self.items[i].overlay = Turbine.UI.Control();
self.items[i].overlay:SetParent(self.items[i]);
self.items[i].overlay:SetSize(self.items[i]:GetSize());
self.items[i].overlay:SetPosition(self.item s[i]:GetPosition());
self.items[i].overlay:SetZOrder(self.items[i]:GetZOrder() + 1);
self.items[i].overlay:SetToolTip(itemInfo:G etName());
-- Hiding it also hides the mouse events, that way, we have either to manually (if possible) trigger the mousehover item or recreate the tooltip
--self.items[i].overlay:SetMouseVisible(false );
self.items[i].overlay.MouseClick = function (sender, args)
-- do stuff here
end
The arguments to SetPosition() should be 0, 0 (which is the default, so you don't need to call it). A control is positioned relative to the top, left corner of its parent (in this case, self.items[i]), so if you want them to be in the same position, use (0, 0) for the child.
I don't think GetZOrder() is needed here, either; the child control is in front of its parent by default. And if I recall, it only affects the Z-order of controls that are "peers", i.e. have the same parent.
You should SetMouseVisible(false) for anything in front of the Shortcut.
The Quickslot will give you MouseClick events.
Last edited by Thurallor; Nov 17 2017 at 03:02 PM.
As Thurallor pointed out, you should set the masking image mouse visible false so that mouse interaction passes through to the control beneath it. If there is only one control beneath the mask and the mask doesn't cover more area than the control then you should indeed set the mask as a child of the control for simplicity (position and zorder can be left at defaults). Position and ZOrder can become relevant if you want the mask to be larger than the control under it such as using one image to mask a grid of controls in which case you would not set the mask as a child of the control. You would still set the mouse visibility of the mask false though as you need the mouse events to pass to the control under the mask.
FWIW, there were some issues with quickslots not firing mouse events but I believe those were all ironed out in the last real Lua bug fixes back in 2014.
I see, thanks for the help with that. I will try to comment out them to see if they make any difference. I might keep them though because this is a base class for several things and may became relevant in the future.
What is happening is that the Quickslot is not firing MouseClick Events when an item slotted in the quickslot is used. (Or even an alias shortcut too.)
(It still fires around the shortcut though.)
Is there anything that I might be doing wrong?
Last edited by Galahard; Nov 17 2017 at 06:38 PM.
Yes, so it makes sense because it is a child element on the top of it. Therefore the difficulty remains, how to get a mouse event from then the user clicks on the shortcut? (I saw that the shortcut class is inherited only from the Object, therefore no mouse events from that...)
A Shortcut is not a Control. Turbine.UI.Lotro.Shortcut is derived from Turbine.Object.
A Quickslot is a Control, derived from Turbine.UI.Control.
Only Controls (and things derived from Controls) generate MouseClick events when clicked on. And this requires that you SetMouseVisible(true) for the Control, and SetMouseVisible(false) for any Controls that appear in front of it.
If you have a Quickslot that contains an item Shortcut, that Quickslot will only generate MouseClick events if the user clicks on it. It will not generate MouseClick events if the user uses the item by some other method (e.g. keyboard shortcut, or clicking another Quickslot elsewhere that happens to contain the same item).
Here's a demo that covers a quickslot with a red square:
https://drive.google.com/open?id=1C8...aNy09lXqzJMwLF