Search the Community
Showing results for tags 'java'.
Found 5 results
-
Intercept: A library for writing Arma Addons in native C++
noubernou posted a topic in ARMA 3 - ADDONS & MODS: DISCUSSION
Intercept is a C/C++ binding interface to the Arma 3 engine (internally referred to as the Real Virtuality or RV engine). It's goal is to provide easy to use library for addon makers to develop addons in a native language, or to develop language extensions for the Arma 3 engine. In a nutshell, Intercept provides a full C/C++ binding system for calling the base C++ functions which are declared in RVEngine for SQF functions. All SQF functions within the RVEngine are actually native code, which is called by SQF via the function names. Intercept bypasses SQF entirely, allowing native C++ plugins to seamlessly interact with the game engine. In essence, Intercept allows for expansions of the game engine, calling internal functionality of the engine which has been exposed via SQF functions. This was the idea behind the intended Java implementation by Bohemia Interactive in Take On Helicopters and was planned for, but never implemented in Arma 3. Intercept not only completes the intended functionality of what Java was meant to provide but has gone much further, including returning data to SQF and multithreaded addons. Intercept works on a host/client based system, in which the host, Intercept itself, hosts client DLLs that implement the Intercept library. The Intercept host handles access to the RV engine by clients through a layer that provides thread concurrency, memory handling, and event dispatching. Client DLLs are then able to be written in a way that can safely ignore most internal nuances of handling data in the RV engine and work with standard C++ STD/STL data types, and only a few specialized objects specific to the game engine. The Intercept library also provides raw C bindings to the C++ versions of SQF functions, so it is entirely possible to use Intercept as the basis for writing in additional scripting languages to the RV engine, such as Python or Lua. You can find more information on our GitHub project page. Technical Details Intercept works by making direct calls to the SQF functions in the RV engine. These functions are themselves C++ functions which are then exposed to SQF for allowing interaction with the underlying game engine; Intercept completely bypasses SQF and allows C++ plugins to interact with the engine directly. User created threads can even be created and by properly using the provided thread concurrency functionality it is possible to execute game functionality safely and concurrently. Intercept clients are able to invoke through the host these commands by provided wrapper functions that replicate and emulate the SQF command namespace (minus some unneeded functionality, like arrays or control structures). These wrapper functions take standard inputs, such as simple primitives like float or bool, and standard std::string arguments and convert them into the proper SQF command variables, providing a seamless layer to the clients. An example of a very simple client that invokes nular, unary, and binary SQF functions (aka functions that take no arguments, a right side argument only, and both a left and right side argument respectively) is demonstrated below and a more examples can be found here. #include <Windows.h> #include <stdio.h> #include <cstdint> #include <sstream> // the Intercept library, only one include required. #include "intercept.hpp" // required exported function to return API version int __cdecl intercept::api_version() { return 1; } // This function is exported and is called by the host each frame. void __cdecl intercept::on_frame() { // get the player object and store it intercept::types::object player = intercept::sqf::player(); // get the post of the player intercept::types::vector3 pos = intercept::sqf::get_pos(player); // build a string... std::stringstream side_chat_msg; side_chat_msg << "Hello Arma World, here is the player pos: " << pos.x << "," << pos.y << "," << pos.z; // send it to the binary SQF sideChat command intercept::sqf::side_chat(player, side_chat_msg.str()); } // Normal Windows DLL junk... BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; } Completion Status As of now (3/13/16) Intercept is over 82% language feature complete. You can view the progress of wrapper completion here. Almost all normally used SQF functions are available to the end user, and with the added ability of writing inline SQF code, you can call any function that has not had a wrapper written for it yet (though with a small performance penalty). We will post a release thread when we start releasing builds of the host. Contributions Feel free to contribute as much as you want to this project in terms of time and code. The goal of this project is to be a tool for the community to provide better performing and more complex addons for the Arma 3 platform. If you would like to contribute or want more information please join our Slack channels and get involved! License Intercept is licensed under the MIT license. You can find the full license in the LICENSE file. Prior to commit f9fe4d5 the project was licensed under the GNU/GPL v2 license and continues to be for any commit prior to that.- 52 replies
-
- 31
-
Hi fellow scripters, Initially we had hoped to release the major upgrade to our scripting technology with Patch 1.03, but we were not able to get it fully implemented in time. Therefore we're pushing the ability to use Java to the next patch Java is available since beta patch rev. 89707 (documentation) Why is this awesomeâ„¢? Using a widespread, proven and robust language with loads of documentation and tutorials. Using IDEs such as NetBeans and Eclipse for development and debugging. Using Object-Oriented programming architecture and design. Using generally much higher performance script execution. Using many standard Java libraries instead of reinventing the wheel. Note: this will not replace SQF scripting, so the transition should be smooth.
-
Hello everyone, I made a Discord Bot which starts /stops / changes config /etc. from my Arma 3 Server. It is written in Java and works. However I want to know if there is a way of grabbing the Console Output of the Arma 3 Server. I hope this is the right section for this - if not please move it. Thank you! Greetings HB
-
mdhClassReplace.jar is a simple javaprogram to replace classes in all ext, sqs, sqf, sqm files in the folder and subfolders of the toollocation. Set classnames in the mdhClassReplace.cfg file. i wrote it to replace all the A2 classnames of my arma 2 missions with the CUP ones. So the tool scans all ext, sqs, sqm, sqf files and replace the classnames with the ones set in the mdhClassReplace.cfg. mdhClassReplace.jar Source: how does it work: 1. create and write log messages into the mdhClassReplaceLog.txt 2. read the mdhClassReplace.cfg to get the old and new classnames for the replacement 3. check every ext, sqs, sqm, sqf file in the folder and subfolders of the toollocation for the old classnames and replace them with the new one how to use it, example to port A2 mission to A3 with CUP: 1. download the mdhClassReplace.7z 2. extract it to an empty folder 3. put your arma 2 missions into the same folder 4. doubleklick the mdhClassReplace.jar file 5. check the mdhClassReplaceLog.txt file to see what the tool has done 6. copy your arma 2 mission into your arma 3 missions folder and open it in the 3D editor (hopefully it works :D) attention, use this tool/mdhClassReplace.jar on your own risk Download: http://moerderhoschi.bplaced.net/public/tools/arma3/mdhClassReplace.7z my A2 -> CUP ClassnameMSExcelWar :D -> http://moerderhoschi.bplaced.net/public/tools/arma3/ArmAClassnames.png updates: v1.1 - fixed issue with case sensitivity at classname replace -> now the class replacement is case insensitiv - added more classes to replace to the mdhClassReplace.cfg v1.2 - added more replacements to the mdhClassReplace.cfg - update of Javaprogram .sqs and .ext files now also checked along with .sqm and .sqf kind regards moerderhoschi
- 12 replies
-
- 2
-
- moerderhoschi
- java
- (and 4 more)
-
selectWeapon & respawn problem
wiggum2 posted a topic in ARMA 2 & OA : MISSIONS - Editing & Scripting
Hi ! I use this script to respawn players with the same loadout they died with and it works. As you can see i already have a "selectWeapon" part. private ["_unit","_corpse","_w","_m","_b","_bm","_bw","_structure","_type","_muzzles"]; _unit = _this select 0; _corpse = _this select 1; // Get weapons from corpse _w = weapons _corpse; _m = magazines _corpse; _b = typeOf unitBackpack _corpse; _bm = getMagazineCargo unitBackpack _corpse; _bw = getWeaponCargo unitBackpack _corpse; deleteVehicle _corpse; // Structure of action text _structure="<t font='EtelkaMonospaceProBold' size='0.8' color='#885555ff'>"; // Give the unit the weapons back removeAllWeapons _unit; removeAllItems _unit; removeBackpack _unit; { _unit addmagazine _x } foreach _m; { _unit addweapon _x } foreach _w; if(_b != "") then { _unit addBackpack _b; clearWeaponCargo (unitBackpack _unit); clearMagazineCargo (unitBackpack _unit); for "_i" from 0 to (count (_bm select 0) - 1) do { (unitBackpack _unit) addMagazineCargo [(_bm select 0) select _i,(_bm select 1) select _i]; }; for "_i" from 0 to (count (_bw select 0) - 1) do { (unitBackpack _unit) addWeaponCargo [(_bw select 0) select _i,(_bw select 1) select _i]; }; }; sleep 0.1; // Select a correct weapon if (count weapons _unit > 0) then { if ((primaryWeapon _unit) != "") then { _type = primaryWeapon _unit; _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles"); if (count _muzzles > 1) then { _unit selectWeapon (_muzzles select 0); } else { _unit selectWeapon _type; }; } else { _type = ((weapons _unit) select 0); _muzzles = getArray (configFile >> "cfgWeapons" >> _type >> "muzzles"); if (count _muzzles > 1) then { _unit selectWeapon (_muzzles select 0); } else { _unit selectWeapon _type; }; }; }; Now the problem is that after respawn the player has to press the F key (switch weapons) twice to select a weapon. He always respawns with no weapon selected (regardless of which weapon) Is this a ArmA bug or did i miss something ?