Jump to content
Sign in to follow this  
Dr_Cox1911

Local Chat - How does it work?

Recommended Posts

Hey all!

 

Hope you can throw me in the right direction, because I really don´t know were to look. Searched the lua-files for the local chat, but couldn´t find anything, only how the chat-window is drawn.

 

So where do I find the code for local chat? Or is this purely done in Java and not accessible through lua?

Share this post


Link to post
Share on other sites

eya doc,

 

while i havent looked into how chat works much, did came across some stuff that might be useful. There's a lua event:

 

sendWorldMessage(String message ) void

 

That appears to send a chatmessage, additionally there's a event "OnWorldMessage".

 

Also,

zombie/network/GameClient.java

has methods relating to chat.

 

Hope its helpful,

Turbo

Share this post


Link to post
Share on other sites

Thanks turbotutone and JonSyn! But I ment more like how they do the rangedistribution for the local chat to decide which player sees the message.

 

Will look into GameClient.java and see what I can dig up.

Share this post


Link to post
Share on other sites

Didnt read properly btw and misread you were looking for LOCAL :P

 

By the reference JonSyn gave, the :Say() method can be found in IsoGameCharacter:

cec94c082e63457129b58f370ac23495.png

As seen uses sendChat in GameClient. However i wasnt able to quickly spot the part that handles reception of these messages, i.e. theres no receiveChat() so probably handled somewhere inside a method.

 

EDIT:

private void mainLoopDealWithNetData(ZomboidNetData d)

c8dbbae4fa4fd08586ee06edc44d6b9f.png

 

Chat()

6ecca4cdada7b7a0a7a87fa40a96de7e.png

 

Regards,

Turbo

Share this post


Link to post
Share on other sites

Thanks turbotutone! I just hate my bad Lua skills  :cry:

I´m trying to get the coords and usernames of all mp-players around the player. Obivously in a defined radius, that´s why I wanted to look at the local chat to see how it´s done there.

Share this post


Link to post
Share on other sites

Turbo, there's no Event for:

 

"OnWorldMessage"

 

I, likewise, wanted to create some server specific commands relating to the chat.  I discovered only lua relating to drawing UI although there was some methods in the "media/lua/Chat/" folder that would fire a "Command" like the method you mentioned, the sendWorldMessage stuff.  

 

Good link for the java class tho

Share this post


Link to post
Share on other sites

Turbo, there's no Event for:

 

"OnWorldMessage"

 

There should be, im not in a position to test atm but what build do you have installed? Perhaps it wasnt added yet in a older build. It certainly is in Build26 as thats where the screens are taken in.

Share this post


Link to post
Share on other sites

Holy smokes.  You are quite right, I do apologise.  There's an event in there:

 

Events.OnWorldMessage.Add(ISChat.addLineInChat);

 
I use this website HERE to look up my events.  Is there a more (regularly) updated one I can check out, out there?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...