gor3Splatter 0 Posted September 17, 2023 With 2.14, the newly introduced HashMapObject functionality seems broken. I observed that `_self` in an object's constructor does not seem to be an actual `HashMap` object. Using 2.14.150957 and the actual example code on the Biki (Example 4 [https://community.bistudio.com/wiki/createHashMapObject]): private _temporaryVehicle = [ ["#create", { params ["_vehicleType", "_vehiclePos", "_lifetimeSeconds"]; // handle constructor arguments private _newVehicle = _vehicleType createVehicle _vehiclePos; _self set ["MyVehicle", _newVehicle ]; // Store the vehicle inside the object for later // because _self is passed as parameter, it will be referenced by the spawned script until it ends. [_lifetimeSeconds, _self] spawn { params ["_lifetimeSeconds", "_self"]; sleep _lifetimeSeconds; }; }], ["#delete", { deleteVehicle (_self get "MyVehicle"); // delete the vehicle when we go away }], ["MyVehicle", objNull] // placeholder, this is not needed ]; // create a temporary RoadCone, at player position, that will delete itself after 5 seconds. createHashMapObject [_temporaryVehicle, ["RoadCone_F", getPos player, 5]]; Results in this error: 22:11:41 Error in expression <leType createVehicle _vehiclePos; _self set ["MyVehicle", _newVehicle ]; [_li> 22:11:41 Error position: <set ["MyVehicle", _newVehicle ]; [_li> 22:11:41 Error Type String, expected Number 22:11:41 File mpmissions\scripting-test.Tanoa\initPlayerLocal.sqf..., line 5 Using `_self` in actual methods, however, seems to work fine. Share this post Link to post Share on other sites
pierremgi 4940 Posted September 18, 2023 That works without error, for me. I just placed the code in a radio trigger, without any comment. Should work also in initPlayerLocal... so, not sure to understand. Sorry. Share this post Link to post Share on other sites
gor3Splatter 0 Posted September 18, 2023 Well, it doesn't work in initPlayerLocal.sqf either. I did, however, work in the console. See this minimal Stratis map. The server log (no mods) is included in the ZIP file. Share this post Link to post Share on other sites
gor3Splatter 0 Posted September 21, 2023 Moved to Feedback Tracker. That seems more appropriate. Share this post Link to post Share on other sites
crashdome 3 Posted September 24, 2023 Noticed you also asked about having access to a parent class. I am working on a project that is based wholly around HashmapObjects and some AI related things. I haven't publicly announced it yet but, I have been working on it since dev announcement of HMOs. I make parent class methods a thing you can do now. I also have preprocessing of the definition arrays where you can even validate code, make methods and properties 'private' through obfuscation and introduce a formal interface class. Interested in your thoughts or if you find cool things that could be added. Basically, arrays are defined in an sqf file, read in at load via config (similar to functions) and preprocessed where they are finally turned into a global var (type definition) that can be used to create objects. And Cached similar to how CBA handled caching Interfaces are declared as only Method/Property declarations that are checked if they exist and return the type expected on a Type Parent methods generated so for example if you have TypeA and a TypeB that inherits from TypeA, you can reference the parent method (for example "Method") by calling the "TypeA.Method" on the TypeB object. There's also attributes you can add as a third element in the [key , pair] that the preprocessor will do extra stuff when compiling the type definition. Feel free to check out the source on github and the brief notes in the wiki. Def check out the wiki first. 1 Share this post Link to post Share on other sites