Wir haben festgestellt, dass Euer Browser keine Cookies akzeptiert. Bitte erlaubt die Verwendung von Cookies in den Optionen Eures Browsers, um eine optimale Funktion dieser Webseite zu gewährleisten.
Ergebnis 1 bis 13 von 13

Thema: Smoke Event

  1. #1
    Registriert seit
    10.05.2011
    Beiträge
    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
    Registriert seit
    21.06.2011
    Beiträge
    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.
    Geändert von Thurallor (15.11.2017 um 21:12 Uhr)

  3. #3
    Registriert seit
    20.10.2010
    Beiträge
    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
    Registriert seit
    10.05.2011
    Beiträge
    9

    Pipeweed Items

    Zitat Zitat von Thurallor Beitrag anzeigen
    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
    Avatar von Garan
    Garan ist offline Defender of the Hornburg
    Registriert seit
    25.03.2007
    Beiträge
    1.590
    Zitat Zitat von Galahard Beitrag anzeigen
    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
    Registriert seit
    10.05.2011
    Beiträge
    9
    Zitat Zitat von Garan Beitrag anzeigen
    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
    Registriert seit
    21.06.2011
    Beiträge
    2.190
    Zitat Zitat von Galahard Beitrag anzeigen
    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.


    Zitat Zitat von Galahard Beitrag anzeigen
    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.
    Geändert von Thurallor (17.11.2017 um 14:02 Uhr)

  8. #8
    Avatar von Garan
    Garan ist offline Defender of the Hornburg
    Registriert seit
    25.03.2007
    Beiträge
    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
    Registriert seit
    10.05.2011
    Beiträge
    9
    Zitat Zitat von Thurallor Beitrag anzeigen
    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.
    Zitat Zitat von Garan Beitrag anzeigen
    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.

    Zitat Zitat von Thurallor Beitrag anzeigen
    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?
    Geändert von Galahard (17.11.2017 um 17:38 Uhr)

  10. #10
    Registriert seit
    21.06.2011
    Beiträge
    2.190
    Zitat Zitat von Galahard Beitrag anzeigen
    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
    Registriert seit
    10.05.2011
    Beiträge
    9
    Zitat Zitat von Thurallor Beitrag anzeigen
    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
    Registriert seit
    21.06.2011
    Beiträge
    2.190
    Zitat Zitat von Galahard Beitrag anzeigen
    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
    Registriert seit
    21.06.2011
    Beiträge
    2.190
    Here's a demo that covers a quickslot with a red square:
    https://drive.google.com/open?id=1C8...aNy09lXqzJMwLF

 

 

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •  

Diese Formular-Sitzung ist abgelaufen. Du musst die Seite neu laden.

Neu laden