Custom chat additions

Users who are viewing this thread

melhadan

Recruit
Hey, i would like to add my server commands to make custom taunts like :

when i write /taunt greets you
i want it to be seen in chat like *Melhadan greets you* ( in purple colour*)

How can i make commands like this through wse?
 
Solution
This script implemented by WSE intercepts chat messages.

Python:
#script_wse_chat_message_received
# Called each time a chat message is received (both for servers and clients)
# INPUT
# script param 1 = sender player no
# script param 2 = chat type (0 = global, 1 = team)
# s0 = message
# OUTPUT
# trigger result = anything non-zero suppresses default chat behavior. Server will not even broadcast messages to clients.
# result string = changes message text for default chat behavior (if not suppressed).
("wse_chat_message_received", [
    (store_script_param, ":player_no", 1),
    (store_script_param, ":chat_type", 2),
]),


Then use str_contains operation to check if chat message contains X string.
This script implemented by WSE intercepts chat messages.

Python:
#script_wse_chat_message_received
# Called each time a chat message is received (both for servers and clients)
# INPUT
# script param 1 = sender player no
# script param 2 = chat type (0 = global, 1 = team)
# s0 = message
# OUTPUT
# trigger result = anything non-zero suppresses default chat behavior. Server will not even broadcast messages to clients.
# result string = changes message text for default chat behavior (if not suppressed).
("wse_chat_message_received", [
    (store_script_param, ":player_no", 1),
    (store_script_param, ":chat_type", 2),
]),


Then use str_contains operation to check if chat message contains X string.
 
Upvote 0
Solution
This script implemented by WSE intercepts chat messages.

Python:
#script_wse_chat_message_received
# Called each time a chat message is received (both for servers and clients)
# INPUT
# script param 1 = sender player no
# script param 2 = chat type (0 = global, 1 = team)
# s0 = message
# OUTPUT
# trigger result = anything non-zero suppresses default chat behavior. Server will not even broadcast messages to clients.
# result string = changes message text for default chat behavior (if not suppressed).
("wse_chat_message_received", [
    (store_script_param, ":player_no", 1),
    (store_script_param, ":chat_type", 2),
]),


Then use str_contains operation to check if chat message contains X string.

What do you mean use str_contains ?. I am not sure how to do it... In which file i should put this code and what to do next?
 
Upvote 0
What do you mean use str_contains ?. I am not sure how to do it...

Python:
 #(str_contains, <string_1>, <string_2>, [<case_insensitive>]), #Fails if <string_1> doesn't contain <string_2>


In which file i should put this code and what to do next?
module_scripts.py

However, If you don't know this, you will have to learn basics first.
I am not gonna do that, there is plenty of tutorials on forum.
 
Upvote 0
Back
Top Bottom