Execute scripts/code via chat commands
Description:
A little mini-project I worked on, which allows you to intercept and use text, that was typed in the inGame chat-box.
Any text, that starts with the special intercept character (by default "!"), will be passed on to a function and checked against all available chat-commands.
If it matches one of the defined commands, the associated code for the command is executed. Any text after the initial command will be passed as an argument to the called function.
Intercepted text is not sent to other clients and wont clutter up the chat history.
The script folder comes with some examples, that show you how the commands are defined. ("module_chatIntercept\commands.sqf")
The current version of the script does not have any extra functions included, apart from the example ones.
It rather serves as a base to include your own functions and ideas, if you can come up with something interesting or practical.
Usage:
Simply execute the init.sqf inside the script folder on a clients machine.
[] execVM "module_chatIntercept\init.sqf";
Inside the script folder are two files, which allow further configuration.
The "config.sqf" (fairly empty atm) allows you to change the intercept-character.
pvpfw_chatIntercept_commandMarker = "!";
"commands.sqf" defines the array of all available commands. (Edit this one or define the array somewhere else to customize the usable commands)
The format is:
pvpfw_chatIntercept_allCommands = [
["command1",{/*code1*/}],
["command2",{/*code2*/}],
["command3",{/*code3*/}]
/* etc */
];
Download:
Example mission: https://www.dropbox.com/s/ijnzhhd5gv104l3/pvpfw_chatIntercept_v02.Stratis.pbo
Script folder: https://www.dropbox.com/s/lk2mq4yjt5242z2/module_chatIntercept.zip