Bus message exchange
Lastest version: 2.4 by Code34     Description
OO BME is a class (object oriented) that permits to build a main BUS messages between clients & server and transfert data between clients & server.
Like to Donate ? Donate with paypal   Github: https://github.com/code34/oo_bme2.vr
Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-Compiling

Features: - build one main bus message - Works in local & MP - rewrite of BME 1.0 in OO way - Asynchronous remote execution - Synchronous remote execution (like promise in js)   Licence:
Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author

Documentation: /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2016-2018 Nicolas BOITEUX CLASS OO_BME 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/>. */ /* Function: _bme = "new" call OO_BME; Create a new bme object (require to create at same time a handler) */ /* Function : _result = ["remoteCall", ["remotefunction", parameters, targetid, defaultreturn, timeout]] call _bme; @remotefunction is a string declare in clienthandler or serverhandler file @parameters of remotefunction @targetid clientid of the target or 2 for server @defaultreturn : default return, in case of no return of the target @timeout: limit of time to wait for the answer of target */ /* Function : ["remoteSpawn", ["remotefunction", data, "target", playerid]] call _bme; @remotefunction is a string declare in clienthandler or serverhandler file @data paramters of remotefunction @target is a string ("client" or "server" or "all") declare the target where the remote function will be exectued @playerid (optionnal) is a scalar defined by the player id where the code should be executed */ How to declare remote functions =========================== You have to declare your remote functions as normal function with global declaration name The handler declaration must respect this syntax: remotefunction = { code to execute on other side } You can declare thoses functions directly in your code. Readme:   /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2013-2018 Nicolas BOITEUX Bus Message Exchange2 (BME) 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/>. */ Create a main bus message between clients & server Usage: put this code into your mission init.sqf call compile preprocessFileLineNumbers "oo_bme.sqf"; See example mission in directory Licence: You can share, modify, distribute this script but don't remove the licence and the name of the original author logs: 2.4 - fix remotecall, add timeout, switch to vr map, clean examples, add new oop, fix handlers with schedule code 2.3 - fix queueing, log, add new oop 2.2 - delete useless old handlers 2.1 - add remoteCall 2.0 - first implementation
Examples /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2016-2018 Nicolas BOITEUX CLASS OO_BME 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/>. */ #include "oop.h" call compile preprocessFileLineNumbers "oo_bme.sqf"; call compile preprocessFileLineNumbers "example.sqf"; sleep 2; bmeclient = NEW(OO_BME, nil); // First Example - remoteCall - synchronous call if(local player) then { private _count = 0; while {_count < 10} do { _result= ["remoteCall", ["getServerName", (name player), 2, "nothing"]] call bmeclient; hint format ["RemoteCall from client: %1", _result]; _count = _count + 1; sleep 1; }; }; // Second Example - remoteSpawn - asynchronous call if(local player) then { private _count = 0; while {_count < 10} do { _message = "hello server, remoteSpawn message send from client"; ["remoteSpawn", ["sendServerMessage", _message, "server"]] call bmeclient; _count = _count + 1; sleep 1; }; }; // Third Example - remotespawn - asynchronous call from server to client if(isserver) then { private _count = 0; while {_count < 10} do { _message = "hello client, message send from server"; ["remoteSpawn", ["sendClientMessage", _message, "client"]] call bmeclient; _count = _count + 1; sleep 1; }; };