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

Thread: Lua Chat objet

  1. #1

    Lua Chat objet

    Because I am an utter spaz who can't wait the 1 - 2 days it'll take to get some documentation on the chat object, here's how it works:

    Code:
    function Turbine.Chat.Received(f, args)
    	for k, v in pairs(args) do
    		Turbine.Shell.WriteLine(k .. ": " .. tostring(v));
    	end
    end
    f will be the Turbine.Chat.Received function, and args will have the fields "Sender", "ChatType", and "Message". Looks like it'll need a handler manager so scripts aren't stomping on each other's chat handlers.

    Edit: Oh, and it looks like Turbine.Shell.WriteLines don't trigger the chat received event, so you can't send yourself into an infinite loop that way.
    Last edited by moebius92; Sep 26 2011 at 06:27 PM.

  2. #2

    Re: Lua Chat objet

    Thank you for posting this! I can now finish up some new plugins.
    [CENTER]Othrandir[/CENTER]
    [CENTER]Resistance - Brandywine[/CENTER]

  3. #3
    Join Date
    Aug 2007
    Posts
    62

    Re: Lua Chat objet

    Quote Originally Posted by moebius92 View Post
    Because I am an utter spaz who can't wait the 1 - 2 days it'll take to get some documentation on the chat object, here's how it works:

    Code:
    function Turbine.Chat.Received(f, args)
    	for k, v in pairs(args) do
    		Turbine.Shell.WriteLine(k .. ": " .. tostring(v));
    	end
    end
    f will be the Turbine.Chat.Received function, and args will have the fields "Sender", "ChatType", and "Message". Looks like it'll need a handler manager so scripts aren't stomping on each other's chat handlers.

    Edit: Oh, and it looks like Turbine.Shell.WriteLines don't trigger the chat received event, so you can't send yourself into an infinite loop that way.
    Very nice. Thanks for the research.
    Lycius [size=1][color="gray"][ELF HNT][/color][/size] / Dannav [size=1][color="gray"][MAN WDN][/color][/size] / Pius [size=1][color="gray"][HOB BUR][/color][/size]
    [i][color="gray"]Landroval[/color][/i]

  4. #4
    Join Date
    Mar 2007
    Posts
    1,780

    Re: Lua Chat objet

    Sweet, thanks. I'm probably going to get into this in a few days. Hopefully we do also get some documentation soon.
    [B]Elendilmir - [COLOR=#3333ff]Evenwyn[/COLOR][/B] Burglar[B] - [COLOR=#3333ff]Evendale[/COLOR][/B] Guardian
    [FONT=Verdana][COLOR=#ff0000][SIZE=2][B]Combat Analysis[/B] [/SIZE][/COLOR][SIZE=2]([B]v4.2.3b[/B]) - [/SIZE][/FONT]Download "[URL="http://www.lotrointerface.com/downloads/info502-CombatAnalysis.html"]here[/URL]"

  5. #5
    Join Date
    Aug 2007
    Posts
    62

    Re: Lua Chat objet

    I was able to put this to use in the Raid Rolls plugin: http://www.lotrointerface.com/downlo...nfo.php?id=607
    Lycius [size=1][color="gray"][ELF HNT][/color][/size] / Dannav [size=1][color="gray"][MAN WDN][/color][/size] / Pius [size=1][color="gray"][HOB BUR][/color][/size]
    [i][color="gray"]Landroval[/color][/i]

  6. #6
    Join Date
    Apr 2007
    Location
    Colorado Springs, Colorado
    Posts
    238

    Re: Lua Chat objet

    Quote Originally Posted by Lycius View Post
    I was able to put this to use in the Raid Rolls plugin: http://www.lotrointerface.com/downlo...nfo.php?id=607
    See the comment I posted on LotroInterface... It doesn't load for me.

  7. #7
    Join Date
    Mar 2007
    Posts
    108

    Re: Lua Chat objet

    Sender always seems to be the local player, are there any cases where it isn't? I would have thought Sender would be the name of the player sending the message in cases of chat.

  8. #8

    Re: Lua Chat objet

    ? i havnt run into this problem, i have several filters made up to parse chat text. for example combat related sends are always in 2 , so just filter out the chan you want (number) then run the message through filters to determine message type

  9. #9
    Join Date
    Mar 2007
    Posts
    108

    Re: Lua Chat objet

    Yes the chat type is working for me. Here is an example of what I meant. Say I receive this message from glff. Here are the values of the event.

    args.ChatType = Turbine.ChatType.UserChat1
    args.Sender = Pengoros
    args.Message = [glff] Oden: 'testing'

    I would have thought that args.Sender would be Oden and not my character name Pengoros. Everything I've seen always has args.Sender = Pengoros.

  10. #10

    Re: Lua Chat objet

    ahh i see what you mean now, ill test this in a bit. i just glanced through my parsing the reason i havnt run into this is just the fact that, i make a class like

    chatSrch.type = 2
    chatSrch.msgType = 3
    chatSrch.Pattern = "glff"

    ... and so on

    then in the event i check 1st the type, then move to msg run the message through a type set function (so type might be 2 but has several sub types) with the pattern. if it comes back true, i then pull and store the info out of the message. and add that info to a message q that is time stamped.

  11. #11
    Join Date
    Mar 2007
    Posts
    1,780

    Re: Lua Chat objet

    Maybe its a sign they're thinking of eventually allowing us to access other players's chat logs in game . I can only hope.
    [B]Elendilmir - [COLOR=#3333ff]Evenwyn[/COLOR][/B] Burglar[B] - [COLOR=#3333ff]Evendale[/COLOR][/B] Guardian
    [FONT=Verdana][COLOR=#ff0000][SIZE=2][B]Combat Analysis[/B] [/SIZE][/COLOR][SIZE=2]([B]v4.2.3b[/B]) - [/SIZE][/FONT]Download "[URL="http://www.lotrointerface.com/downloads/info502-CombatAnalysis.html"]here[/URL]"

 

 

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