Jump to content

Local Chat - How does it work?


Dr_Cox1911

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?

Link to comment
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

Link to comment
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

Link to comment
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.

Link to comment
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

Link to comment
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.

Link to comment
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?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...