Jump to content

Search the Community

Showing results for tags 'hashmap'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • BOHEMIA INTERACTIVE
    • BOHEMIA INTERACTIVE - NEWS
    • BOHEMIA INTERACTIVE - JOBS
    • BOHEMIA INTERACTIVE - GENERAL
  • FEATURED GAMES
    • Arma Reforger
    • Vigor
    • DAYZ
    • ARMA 3
    • ARMA 2
    • YLANDS
  • MOBILE GAMES
    • ARMA MOBILE OPS
    • MINIDAYZ
    • ARMA TACTICS
    • ARMA 2 FIRING RANGE
  • BI MILITARY GAMES FORUMS
  • BOHEMIA INCUBATOR
    • PROJECT LUCIE
  • OTHER BOHEMIA GAMES
    • ARGO
    • TAKE ON MARS
    • TAKE ON HELICOPTERS
    • CARRIER COMMAND: GAEA MISSION
    • ARMA: ARMED ASSAULT / COMBAT OPERATIONS
    • ARMA: COLD WAR ASSAULT / OPERATION FLASHPOINT
    • IRON FRONT: LIBERATION 1944
    • BACK CATALOGUE
  • OFFTOPIC
    • OFFTOPIC
  • Die Hard OFP Lovers' Club's Topics
  • ArmA Toolmakers's Releases
  • ArmA Toolmakers's General
  • Japan in Arma's Topics
  • Arma 3 Photography Club's Discussions
  • The Order Of the Wolfs- Unit's Topics
  • 4th Infantry Brigade's Recruitment
  • 11th Marine Expeditionary Unit OFFICIAL | 11th MEU(SOC)'s 11th MEU(SOC) Recruitment Status - OPEN
  • Legion latina semper fi's New Server Legion latina next wick
  • Legion latina semper fi's https://www.facebook.com/groups/legionlatinasemperfidelis/
  • Legion latina semper fi's Server VPN LEGION LATINA SEMPER FI
  • Team Nederland's Welkom bij ons club
  • Team Nederland's Facebook
  • [H.S.O.] Hellenic Special Operations's Infos
  • BI Forum Ravage Club's Forum Topics
  • Exilemod (Unofficial)'s General Discussion
  • Exilemod (Unofficial)'s Scripts
  • Exilemod (Unofficial)'s Addons
  • Exilemod (Unofficial)'s Problems & Bugs
  • Exilemod (Unofficial)'s Exilemod Tweaks
  • Exilemod (Unofficial)'s Promotion
  • Exilemod (Unofficial)'s Maps - Mission Files
  • TKO's Weferlingen
  • TKO's Green Sea
  • TKO's Rules
  • TKO's Changelog
  • TKO's Help
  • TKO's What we Need
  • TKO's Cam Lao Nam
  • MSOF A3 Wasteland's Server Game Play Features
  • MSOF A3 Wasteland's Problems & Bugs
  • MSOF A3 Wasteland's Maps in Rotation
  • SOS GAMING's Server
  • SOS GAMING's News on Server
  • SOS GAMING's Regeln / Rules
  • SOS GAMING's Ghost-Town-Team
  • SOS GAMING's Steuerung / Keys
  • SOS GAMING's Div. Infos
  • SOS GAMING's Small Talk
  • NAMC's Topics
  • NTC's New Members
  • NTC's Enlisted Members
  • The STATE's Topics
  • CREATEANDGENERATION's Intoduction
  • CREATEANDGENERATION's HAVEN EMPIRE (NEW CREATORS COMMUNITY)
  • HavenEmpire Gaming community's HavenEmpire Gaming community
  • Polska_Rodzina's Polska_Rodzina-ARGO
  • Carrier command tips and tricks's Tips and tricks
  • Carrier command tips and tricks's Talk about carrier command
  • ItzChaos's Community's Socials
  • Photography club of Arma 3's Epic photos
  • Photography club of Arma 3's Team pics
  • Photography club of Arma 3's Vehicle pics
  • Photography club of Arma 3's Other
  • Spartan Gamers DayZ's Baneados del Servidor
  • Warriors Waging War's Vigor
  • Tales of the Republic's Republic News
  • Operazioni Arma Italia's CHI SIAMO
  • [GER] HUSKY-GAMING.CC / Roleplay at its best!'s Starte deine Reise noch heute!
  • empire brotherhood occult +2349082603448's empire money +2349082603448
  • NET88's Twitter
  • DayZ Italia's Lista Server
  • DayZ Italia's Forum Generale

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Yahoo


Jabber (xmpp)


Skype


Biography


Twitter


Google+


Youtube


Vimeo


Xfire


Steam url id


Raptr


MySpace


Linkedin


Tumblr


Flickr


XBOX Live


PlayStation PSN


Origin


PlayFire


SoundCloud


Pinterest


Reddit


Twitch.Tv


Ustream.Tv


Duxter


Instagram


Location


Interests


Interests


Occupation

Found 3 results

  1. How can I read a specific variable name (and not its content) between two or more files? File 0: Calling all files by THY_TAG_functions.hpp File 1: [] spawn { _team_snipers = ["classname_unit_1", "classname_unit_2"]; [_team_snipers, ...] call THY_fnc_file_2; }; File 2: THY_fnc_file_2 = { params ["_grpType", ...] // _team_snipers will be here through the parameter _grpType. // If the _grpType has the same name "_team_snipers", then... if ( _grpType == "_team_snipers" ) then {...} // return: true; }; I'm used with publicVariables like the examples below, but only for checking the public variable's content and not its name, literally: // File 1: THY_team_snipers = ["classname_unit_1", "classname_unit_2"]; publicVariable "THY_team_snipers"; // File 2: // If the _grpType has the same name "_team_snipers", then... if ( _grpType isEqualTo THY_team_snipers ) then {...} // doesnt work because other teams can got exactly the same content of team snipers.
  2. Hi all, You'll not find too much topics about hashmap (see Halek's post) and I thought that could be useful to open this specific topic on this command group. Hashmap is a very powerful tool, not so difficult to script. You have full explanation on links but roughly, you're creating a table (hashmap) in which any call (get) for entry (key) is almost immediate and doesn't depend on the rank of what you're searching. The hashmap creation can take some times in process, as any other table creation. There is an added value if once in game you need to grab lines repetitively. I give you a little example: Let's say you want to grab compatibles mags for some primary weapons. There are different way for that. The first good question is to determine if you need these info repeatedly (for multiple units, events... as example): So, as practical example, for Arma vanilla (there are 376* primary weapons): 1st method (no need to create anything) use BIS_fnc_compatibleMagazines (or similar ones): Let's test some primary Weapons in debug console performance button: "srifle_DMR_01_F" call BIS_fnc_compatibleMagazines; // found in 0,0243 ms: ["10rnd_762x54_mag"] "sgun_HunterShotgun_01_sawedoff_F" call BIS_fnc_compatibleMagazines; // found in 0,0316 ms: ["2rnd_12gauge_pellets","2rnd_12gauge_slug"] "arifle_MXM_Hamr_LP_BI_F" call BIS_fnc_compatibleMagazines // found in 0.0716ms: ["30rnd_65x39_caseless_mag","30rnd_65x39_caseless_khaki_mag","30rnd_65x39_caseless_black_mag","30rnd_65x39_caseless_mag_tracer","30rnd_65x39_caseless_khaki_mag_tracer","30rnd_65x39_caseless_black_mag_tracer","100rnd_65x39_caseless_mag","100rnd_65x39_caseless_khaki_mag","100rnd_65x39_caseless_black_mag","100rnd_65x39_caseless_mag_tracer","100rnd_65x39_caseless_khaki_mag_tracer","100rnd_65x39_caseless_black_mag_tracer"] So, each time you need these mags, you must call the function then wait for the result. The delay depends on multiple factors: rank in cfgWeapons, muzzles, mags... I guess Now, let's "prepare tables": First of all, primary weapons: primWpns = ("getNumber (_x/'type') == 1 && {getNumber (_x/'scope') == 2}" configClasses (configfile /"cfgWeapons")) apply {configName _x}; Note*: some weapons don't have picture in gear (inventory) but are playable. Scope =1. You can add them if needed. then: CompatibleMagsTable = primWpns apply {[_x, _x call BIS_fnc_compatibleMagazines]}; As result, you'll obtain something like: [["srifle_DMR_01_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_ACO_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_MRCO_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_SOS_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_DMS_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_DMS_snds_F",["10rnd_762x54_mag"]], ["srifle_DMR_01_ARCO_F",["10rnd_762x54_mag"]],...and so on] Of course, it takes a long time (27 ms without any mod) to draw this table but you need to do that once, at mission start. So, that doesn't really matter in game. Then, during game: 2nd method - use the ready table finding the elements for the entry (weapon): CompatibleMagsTable select ( primWpns find "srifle_DMR_01_F") select 1 // found in 0.0009 ms CompatibleMagsTable select ( primWpns find "arifle_MXM_Hamr_LP_BI_F") select 1 // found in 0.038 ms CompatibleMagsTable select ( primWpns find "sgun_HunterShotgun_01_sawedoff_F") select 1 // found in 0.059 ms Truly, the result depends on the rank of the tested primary weapon inside the result for configClasses (primWpns). The code exits as soon as the weapon is found and there is no difficulty for grabbing the mags. BUT, if you compare the results for 1st and 2nd methods, is there a great added value in term of average performance ? Probably yes if your table is more complex, (with multiple things to grab for an entry)... Anyway, forget this 2nd method. Now, the core of the topic. Hashmaps are introduced since Arma 2.01. 3rd method - Let's create a hashMap, as we created a table above: Starting with the primary weapon classes as reference: primWpns = ("getNumber (_x/'type') == 1 && {getNumber (_x/'scope') == 2}" configClasses (configfile /"cfgWeapons")) apply {configName _x}; Now the hashmap where all these classes will be keys of entry: MGI_Hash_Mags = primWpns createHashMapFromArray (primWpns apply {_x call BIS_fnc_compatibleMagazines}); It's very similar to the former table and it takes also 27 ms for preparing it. But... Now you have a hashmap and you can call what you need like this: MGI_Hash_Mags get "srifle_DMR_01_F" // found in 0.0007 ms MGI_Hash_Mags get "arifle_MXM_Hamr_LP_BI_F" // found in 0.0007 ms MGI_Hash_Mags get "sgun_HunterShotgun_01_sawedoff_F" // found in 0.0011 ms Performance friendly isn't it? Have fun.
  3. Object Oriented Hashmap Lastest version: 0.4 by Code34 Like to Donate ? Donate with paypal Github: https://github.com/code34/oo_hashmap.Altis Reference: http://forums.bistudio.com/showthread.php?167980-Object-Oriented-SQF-Scripting-and-Compiling Description OO HASHMAP is a class (object oriented) that permits to replace arma array with an hashmap object :) Features: Implementing the java hashmap interface http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html Licence: Under Gpl, you can share, modify, distribute this script but don't remove the licence and the name of the original author Readme: /* Author: code34 nicolas_boiteux@yahoo.fr Copyright (C) 2014 Nicolas BOITEUX CLASS OO_HASMAP OBJECT Interface reference http://docs.oracle.com/javase/7/docs/api/java/util/HashMap.html 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 an hasmap object Usage: put the "oo_hashmap.sqf" and the "oop.h" files in your mission directory put this code into your mission init.sqf call compilefinal preprocessFileLineNumbers "oo_hasmap.sqf"; See example mission in directory: init.sqf Licence: You can share, modify, distribute this script but don't remove the licence and the name of the original author logs: 0.3 - OO HASHMAP - use key string now - use missionnamespace instead entryset array - remove useless code - fix test init code & add some use cases - fix function names typo - remove slow searchindex function 0.2 - OO HASHMAP - add documentation - add performance improvements - fix clear function 0.1 - OO HASHMAP - first release Functions clear() Removes all of the mappings from this map. containsKey(key) Returns true if this map contains a mapping for the specified key. containsValue(value) Returns true if this map maps one or more keys to the specified value. entrySet() Returns a Set view of the mappings contained in this map. get(key) Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. isEmpty() Returns true if this map contains no key-value mappings. keySet() Returns a Set view of the keys contained in this map. put(key, value) Associates the specified value with the specified key in this map. remove(key) Removes the mapping for the specified key from this map if present. size() Returns the number of key-value mappings in this map. Examples call compilefinal preprocessFileLineNumbers "oo_hashmap.sqf"; private ["_map", "_size", "_i", "_key", "_value"]; _map = ["new", []] call OO_HASHMAP; _return = "isEmpty" call _map; diag_log format["isempty %1", _return]; ["put", ["toto", [3,7]]] call _map; ["put", ["tata", "turlututu"]] call _map; ["put", ["jp", "test du hashmap"]] call _map; _return = ["containsKey", "toto"] call _map; diag_log format["contains key toto %1", _return]; _return = ["containsValue", ["bullshit"]] call _map; diag_log format["contains value bullshit %1", _return]; _return = ["containsValue", [[3,7]]] call _map; diag_log format["contains value [3,7] %1", _return]; _return = "entrySet" call _map; diag_log format["entryset %1", _return]; _return = ["get", "toto"] call _map; diag_log format["get toto %1", _return]; _return = "isEmpty" call _map; diag_log format["isempty %1", _return]; _return = "keySet" call _map; diag_log format["keySet %1", _return]; _return = "size" call _map; diag_log format["Size %1", _return]; ["put", ["toto", [8,8]]] call _map; ["put", ["toto", [4,1]]] call _map; _return = "keySet" call _map; diag_log format["check for toto doublon, keySet %1", _return]; _return = ["get", "toto"] call _map; diag_log format["after toto setting, get toto %1", _return]; ["remove", "tata"] call _map; diag_log "remove tata"; _return = ["containsKey", "tata"] call _map; diag_log format["contains key tata %1", _return]; _return = "keySet" call _map; diag_log format["after tata remove, keySet %1", _return]; _return = "entrySet" call _map; diag_log format["after tata remove, entryset %1", _return]; "clear" call _map; _return = "size" call _map; diag_log format["Size %1 after clear", _return]; _return = "IsEmpty" call _map; diag_log format["isempty %1", _return];
×