Author: code34
Author Website: https://github.com/code34/bus_message_exchange.Altis

Requirements: No addons required

Version: 0.3

Short description: This package builds a main BUS messages between clients & server and optimize data transfert between clients & server

Support the author:

100% of your donation goes directly to the author of this content!
Date: 2014-11-06 09:16


Comments: (0)
Rating:



 



Bus Message Exchange (BME)

by
code34


Description:
This package builds a main BUS messages between clients and server and optimize data transfert between clients and server.
This script is a part of the handler modules from WIT - ARMA2. All modules/functions of handler modules from WIT are not distribute in this package.


Features:
- build one main bus message exchange that is better against the red chain
- Mp & SP compatible
- send & listener oriented


Installation / Usage:
Put the directory BEM in your mission directory.
Put this code into your mission init.sqf:
[] execVM "BME\init.sqf";
See example mission in directory: bus_exchange_message.Altis

Messages are variables that contains value, and are send to destination host.

How to send message:
Usage:
[message, destination] call BME_fnc_publicvariable;
Send a message to all client
["variablename", "client"] call BME_fnc_publicvariable;
Send a message to a specific client
["variablename", "client", clientid] call BME_fnc_publicvariable;
Send a message to server
["variablename", "server"] call BME_fnc_publicvariable;
Send a message to everybody
["variablename", "all"] call BME_fnc_publicvariable;

How to receive message:
The message are handle by listeners on client or server side. Listeners are specific functions that are executed on destination host, when message is distributed.
Message is distributed as a parameter of the function like eventhandler do.

There is tow kind of listeners:
- server listeners
- client listerners

The listener declaration must respect this syntax:
BME_netcode_server_nameofyourvariable = { code to execute on server side };
BME_netcode_nameofyourvariable = { code to execute on client side };

You can declare thoses listeners directly on your code, but it's more simple to use the default location:
client side:
- declare by default in BME_clienthandler.sqf

server side:
- declare by default in BME_serverhandler.sqf
exemple to hint a message to all client (listener already exists )
bme_message = "Hello folks!";
["bme_message", "client"] call BME_fnc_publicvariable;


Licence:
Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.


Changelog:
v0.3
- fix mp handler call
- fix reset code

v0.2
- add performance improvement requests of @Prodavec
- add private variable declaration
- fix iteration call
- add logs
- change calling line

v0.1
- BUS message Exchange original from A2 - Warcontext


Forum topic:
- BI forums




Enable javascript to be able to download from Armaholic please!



Tags: Client,   Message,   Server