Il semble que les cookies ne soient pas activés dans votre navigateur. Veuillez activer les cookies pour garantir une expérience du site optimale.
Affichage des résultats 1 à 13 sur 13

Discussion: Smoke Event

  1. #1
    Date d'inscription
    mai 2011
    Messages
    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
    Date d'inscription
    juin 2011
    Messages
    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.
    Dernière modification par Thurallor ; 15/11/2017 à 21h12.

  3. #3
    Date d'inscription
    octobre 2010
    Messages
    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
    Date d'inscription
    mai 2011
    Messages
    9

    Pipeweed Items

    Citation Envoyé par Thurallor Voir le message
    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
    Date d'inscription
    mars 2007
    Messages
    1 590
    Citation Envoyé par Galahard Voir le message
    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
    Date d'inscription
    mai 2011
    Messages
    9
    Citation Envoyé par Garan Voir le message
    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
    Date d'inscription
    juin 2011
    Messages
    2 190
    Citation Envoyé par Galahard Voir le message
    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.


    Citation Envoyé par Galahard Voir le message
    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.
    Dernière modification par Thurallor ; 17/11/2017 à 14h02.

  8. #8
    Date d'inscription
    mars 2007
    Messages
    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
    Date d'inscription
    mai 2011
    Messages
    9
    Citation Envoyé par Thurallor Voir le message
    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.
    Citation Envoyé par Garan Voir le message
    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.

    Citation Envoyé par Thurallor Voir le message
    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?
    Dernière modification par Galahard ; 17/11/2017 à 17h38.

  10. #10
    Date d'inscription
    juin 2011
    Messages
    2 190
    Citation Envoyé par Galahard Voir le message
    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
    Date d'inscription
    mai 2011
    Messages
    9
    Citation Envoyé par Thurallor Voir le message
    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
    Date d'inscription
    juin 2011
    Messages
    2 190
    Citation Envoyé par Galahard Voir le message
    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
    Date d'inscription
    juin 2011
    Messages
    2 190
    Here's a demo that covers a quickslot with a red square:
    https://drive.google.com/open?id=1C8...aNy09lXqzJMwLF

 

 

Règles de messages

  • Vous ne pouvez pas créer de nouvelles discussions
  • Vous ne pouvez pas envoyer des réponses
  • Vous ne pouvez pas envoyer des pièces jointes
  • Vous ne pouvez pas modifier vos messages
  •  

La session de ce formulaire a expiré. Vous devez recharger la page.

Recharger