We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 13 of 13

Thread: Smoke Event

  1. #1
    Join Date
    May 2011
    Posts
    9

    Smoke Event

    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! =)

  2. #2
    Join Date
    Jun 2011
    Posts
    2,190
    But smoking does generate messages in the emote chat channel:

    /smoke
    You 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.

  3. #3
    Join Date
    Oct 2010
    Posts
    1,570
    Pipeweed smoke and Dwale's pipe do not.
    "I never feed trolls and I don't read spam" - Weird Al Yankovic

  4. #4
    Join Date
    May 2011
    Posts
    9

    Pipeweed Items

    Quote Originally Posted by Thurallor View Post
    But smoking does generate messages in the emote chat channel:

    /smoke
    You 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.
    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?

  5. #5
    Join Date
    Mar 2007
    Posts
    1,590
    Quote Originally Posted by Galahard View Post
    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.

  6. #6
    Join Date
    May 2011
    Posts
    9
    Quote Originally Posted by Garan View Post
    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):

    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
    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").

  7. #7
    Join Date
    Jun 2011
    Posts
    2,190
    Quote Originally Posted by Galahard View Post
    Code:
    self.items[i].overlay:SetPosition(self.item s[i]:GetPosition());
    self.items[i].overlay:SetZOrder(self.items[i]:GetZOrder() + 1);
    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.


    Quote Originally Posted by Galahard View Post
    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").
    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.

  8. #8
    Join Date
    Mar 2007
    Posts
    1,590
    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.

  9. #9
    Join Date
    May 2011
    Posts
    9
    Quote Originally Posted by Thurallor View Post
    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.
    Quote Originally Posted by Garan View Post
    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.

    Quote Originally Posted by Thurallor View Post
    You should SetMouseVisible(false) for anything in front of the Shortcut.

    The Quickslot will give you MouseClick events.
    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.

  10. #10
    Join Date
    Jun 2011
    Posts
    2,190
    Quote Originally Posted by Galahard View Post
    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.)
    Of course, the MouseClick events only occur when the user clicks on the Quickslot. Not when the user clicks on something else.

  11. #11
    Join Date
    May 2011
    Posts
    9
    Quote Originally Posted by Thurallor View Post
    Of course, the MouseClick events only occur when the user clicks on the Quickslot. Not when the user clicks on something else.
    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...)

  12. #12
    Join Date
    Jun 2011
    Posts
    2,190
    Quote Originally Posted by Galahard View Post
    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).

  13. #13
    Join Date
    Jun 2011
    Posts
    2,190
    Here's a demo that covers a quickslot with a red square:
    https://drive.google.com/open?id=1C8...aNy09lXqzJMwLF

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload