-
Content Count
1224 -
Joined
-
Last visited
-
Medals
Everything posted by dreadedentity
-
SQL : character ":" causes error
dreadedentity replied to raptor2x's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Definitely an issue with the extension, you should contact the writer of extDB for a fix. I doubt there's anything you can do in .sqf that will fix this. You will need to rewrite the extension, or get the original writer to rewrite it. It seems you're going to have to scan input for any colon's and reject it, or scan and scrub all colon's from input. -
[SOLVED] GUI : How to remove the area border of RcsText
dreadedentity replied to raptor2x's topic in ARMA 3 - MISSION EDITING & SCRIPTING
You can also add 512 to the style for no border -
Problem for good coders/people with logic skills
dreadedentity replied to Dreadleif's topic in ARMA 3 - MISSION EDITING & SCRIPTING
_comparedMarker = _this param [0, "NULL", [""]]; _markerList = _this param [1, [], [[]], 1]; if (_comparedMarker == "NULL" || (count _markerList < 1)) exitWith { ["Invalid Parameters, param1 must be of Type-String, param2 must be of Type-Array with at least 1 element"] call BIS_fnc_error; }; //seed data with the first marker in the list _nearestMarker = markerList select 0; _distance = (markerPos _nearestMarker) distance2D (markerPos marker0); { _calcDistance = (markerPos marker0) distance2D (markerPos _x); if (_calcDistance < _distance) then { _distance = _calcDistance; _nearestMarker = _x; }; } forEach markerList; //return array with the nearest marker and it's distance [_nearestMarker, _distance]; save as function -
It looks like you need to switch the player's view to the camera. Try switchCamera. _cam switchCamera "Internal"; Might work. To be honest I don't know that much about cameras, but I have to learn soon for something I'm working on.
-
Problem for good coders/people with logic skills
dreadedentity replied to Dreadleif's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I am very confused by your description of the problem and your picture. -
[CODE SNIPPET] Extracting full classes from config
dreadedentity replied to dreadedentity's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Going to start soon! It really was a headache trying to understand what was going on! The bit about cancer was more tongue-in-cheek :P . You always take shots in stride though. I do have one question for you, I think I have noticed a few scripts/functions of yours that are written recursively with a unique parameter and a switch for functionality. Is there any reason you make them this way? Any other benefits other than keeping the code to one file? I'm always in one teamspeak or another, PM me, I'd love to chat sometime -
[CODE SNIPPET] Extracting full classes from config
dreadedentity posted a topic in ARMA 3 - MISSION EDITING & SCRIPTING
Hello! It has been a long time since I have made a code snippet! I am going to start making a GUI tutorial soon (maybe a series) but I don't like several of the things I had to do when I started learning about GUI's in Arma. Like many, I read and followed Iceman77's guide (and even had the privilege of having him in my teamspeak server multiple times), and bangabob's video tutorial. However, these required you to download/copy some files that had been already created for you. For a long time while I was learning, I did not realize the freedom that was available to me. Of course, a fair amount of my misunderstanding was probably due to naivete with the engine. However, in my tutorial series I want to express how much freedom one has and teach people not to be scared of searching for information and trying new things, not just follow a guide. So to prevent having to provide some file(s) that won't teach the viewer anything, I wanted to write a function that will allow them to "export" a config straight from the game, using BIS's default values. Note: This function must be compiled using the functions library with the Tag "DREAD" and the name "copyConfigClass" to work properly. As it is a recursive function, if you want to compile it with a different name, you will have to edit the self-call within the function yourself. The easiest way to use this script is to compile it using the functions library, using the names I have listed previously. So without further delay, here's my script: fn_copyConfigClass.sqf /////////////////////////////////////// // Function file for Armed Assault 3 // // Created by: DreadedEntity // // // // MUST BE COMPILED WITH THE // // FUNCTIONS LIBRARY // //Tag = DREAD Name = copyConfigClass// /////////////////////////////////////// /* TO USE: _partialClass = [config] call DREAD_fnc_copyConfigClass; INPUT: config: TYPE - Config | Anything that is not a config class is rejected. OUTPUT: _partialClass: TYPE - STRING | USED BY THE FUNCTION TO CREATE OUTPUT, DO NOT OVERWRITE HOWEVER, it is possible to save the result outside of the function, to run it multiple times ex. _textBoxClass = [configFile >> "RscText"] call DREAD_fnc_copyConfigClass; _listBoxClass = [configFile >> "RscListBox"] call DREAD_fnc_copyConfigClass; _buttonClass = [configFile >> "RscButton"] call DREAD_fnc_copyConfigClass; TO CLIPBOARD: Outputs a full class definition, even returning subclasses and their attributes, and it's nicely formatted with tabs. I'm such a god. */ private ["_parents","_numTabs","_numParams","_param","_newConfig","_params"]; _MAKE_TABS = { _tabs = ""; for "_t" from 1 to _this do { _tabs = _tabs + (toString [9]); }; _tabs; }; if (!isClass (_this select 0)) exitWith {"Input Was Not A Class"}; _newLine = toString [13, 10]; _parents = [_this select 0] call BIS_fnc_returnParents; _numTabs = _this param [1, 0, [0]]; _output = _this param [2, "", [""]]; _output = _output + (_numTabs call _MAKE_TABS) + "class " + (configName (_this select 0)) + _newLine + (_numTabs call _MAKE_TABS) + "{" + _newline; _params = []; { _numParams = (count _x) - 1; for "_i" from 0 to _numParams do { _param = configName (_x select _i); _newConfig = (_this select 0) >> _param; if (isClass _newConfig) then { _output = [_newConfig, _numTabs + 1, _output] call DREAD_fnc_copyConfigClass; } else { _newParam = _param; _data = nil; switch (true) do { case (isNumber _newConfig): { _data = getNumber _newConfig; }; case (isText _newConfig): { _data = str(getText _newConfig); }; case (isArray _newConfig): { _newParam = _newParam + "[]"; _data = str(getArray _newConfig); _data = "{" + (_data select [1, (count _data) - 2]) + "}"; }; }; if (_params find _param == -1) then { _output = _output + ((_numTabs + 1) call _MAKE_TABS) + format["%1 = %2;%3", _newParam, _data, _newLine]; _params pushBack _param; }; }; }; } forEach _parents; _output = _output + (_numTabs call _MAKE_TABS) + "};" + _newline; copyToClipboard _output; _output; Lastly, I'd like to thank the person who wrote the code for the Splendid Config Viewer; whose code was so bloated and unreadable I experienced the greatest headache of my life from reading it, and probably got cancer. -
Spawning Objects to buildings
dreadedentity replied to seed's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Great! Whenever I start working on that project again, be on the lookout for a forum post asking for help! -
GUI - RscStructuredText over RscPicture layer in GUI editor?
dreadedentity replied to DeltaSierraDS's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Also it's worth noting that you don't have to save and reload. Just one or the other is enough -
Spawning Objects to buildings
dreadedentity replied to seed's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I missed your first question because I was too excited somebody wanted to do exactly the same thing as something I worked on in the past. I'm not sure if preprocessing can do what you want, have a look at the Functions Library. When you define a function here, you have several attributes you can apply and one of them, preInit, will cause the function to run before objects (ie players) get created/initialized. Look through that page to get an idea of how to add your custom scripts to the functions library, it's a small amount of description.ext work -
Spawning Objects to buildings
dreadedentity replied to seed's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Good luck with this project. I started working on something exactly like this over 2 years ago. I gave up because nobody wanted to help make building layouts (the system would have been capable of choosing a random list of items for each room to spawn, allowing every single building on the map to be populated differently and give an actual "lived-in" feeling that altis is severely lacking, but I can't remember how far I got it working). I may work on this again sometime, but I've got something else I'm trying to finish, so might as well do a code dump and see if somebody wants to work on it. Download "Miscellaneous Housing" (Dropbox) edit: all you have to do to use that is put the .rar in your missions folder, unpack, then load the mission in the editor. -
Say / Say2D / Say3D change distance??
dreadedentity replied to commanderx's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Well it's like I wrote in my feedback ticket, all of the sound commands have their strengths, but they all have weaknesses. There is no perfect sound command available to us -
Say / Say2D / Say3D change distance??
dreadedentity replied to commanderx's topic in ARMA 3 - MISSION EDITING & SCRIPTING
can't -
GUI - RscStructuredText over RscPicture layer in GUI editor?
dreadedentity replied to DeltaSierraDS's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Do you need the text to change? After this much trouble you might as well just overlay the text in MS paint or something -
If you are using execVM you can run scripts that are in the Arma 3 steam folder by putting a \ in front [] execVM "\myScript.sqf"; No idea if this still works
-
Say / Say2D / Say3D change distance??
dreadedentity replied to commanderx's topic in ARMA 3 - MISSION EDITING & SCRIPTING
you can do this with playSound3D but that comes with it's own issues. I made this ticket a few days ago and no responses http://feedback.arma3.com/view.php?id=27454 -
Well since this thread got revived, I noticed something a little incorrect (at least for today, it might have been true in 2014) in an above post I got ImageToPAA in Arma 3 Tools to work when using a picture that was 256x256, but it failed every other time I tried to use it. After a little research it seems to only work correctly on pictures that are square and who's side measurements are a multiple of 2, starting at 24(16). @Dreadleif Before I answer your question I'm going to ask you another question. Why? The way your dialog looks has literally nothing to do with the way the mission works during the development phase. You'd be much better off just using an addAction to run the scripts, rather than relying on dialog elements, until you get the mission finished. Appearance is part of the polishing stage, where you make things look pretty. Basically, if you're worried about making things look nice, after you get things looking the way you want them to, you better be typing up a forum post because you're in the distribution stage, baby. Now, you need to read the wiki. Your "buttons" don't work because they aren't buttons, they are a textbox and a picturebox, and changing the RscButton class definition will not help because you do not use RscButton. Picture boxes (and alternatively text boxes) do not have an "action" member that they use, so that will not work 100% of the time, guaranteed. However, they do have another event handler that you want to use, onMouseButtonDown or onMouseButtonUp, you use it the same way as action. Here's an example from a dialog that I'm working on: class RscButton_1600: RscText { idc = 1600; style = ST_PICTURE; fixedWidth = 0; text = "myPicture"; //--- ToDo: Localize; shadow = 2; x = 0.967496 * safezoneW + safezoneX; y = 0.0159797 * safezoneH + safezoneY; w = 0.0262433 * safezoneW; h = 0.042 * safezoneH; onMouseButtonDown = "call ACSCE_fnc_closeEditor"; onMouseMoving = "if (_this select 3) then {(_this select 0) ctrlSetTextColor [0.96,0.62,0,1]} else {(_this select 0) ctrlSetTextColor [1,1,1,1]};"; };
-
Bullet Cam - Slow Time
dreadedentity replied to Ranwer135's topic in ARMA 3 - MISSION EDITING & SCRIPTING
player addEventHandler ["Fired", { _bullet = (_this select 6); _bullet spawn { hint "Shot fired\nBegin Collecting Data"; _lineBreak = toString [13, 10]; _data = "----------" + _linebreak + "BEGIN SHOT DATA" + _linebreak + "----------" + _linebreak; _startTime = time; while {speed _this > 1} do { _data = _data + (str (velocity _this) + _linebreak); }; _endTime = time; _data = _data + "----------" + _linebreak + "END SHOT DATA" + _linebreak + "----------" + _linebreak + "Start Time: " + (str _startTime) + " | " + "End Time: " + (str _endTime) + _linebreak + "Total Time: " + (str (_endTime - _startTime)); copyToClipboard _data; hint "Shot stopped\nEnd Collecting Data"; }; }]; Enjoy your data! Hope you're good at math!* *Also, I recommend you shoot one at a time -
GUI - RscStructuredText over RscPicture layer in GUI editor?
dreadedentity replied to DeltaSierraDS's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Press ctrl+s and save as "GUI Editor" (this action will save your dialog into the clipboard), then paste the output into a text file (you should be keeping a backup of your dialog anyway, I even keep incremental backups for when I add new controls). Find your picture control (default is (1199+number_of_RscPicture's), so if you just have one it will be default 1200) and change it to something invisible like an RscFrame (idc 1800). Now copy everything inside the multi-line comments, but not those1, and then open the GUI editor again. It will auto-load from the clipboard. Also, I believe rendering order is determined by order in the dialog class. So when you want to save your dialog (ctrl+s -> "config (controls as class)"), just paste the output into your dialog class, then you can manually edit the class order by using cut->paste or copy->paste->delete. You can also edit the order in your backup "GUI Editor" file the same way. 1 Example: /* #Mineze //do not copy $[ 1.063, ["test_dialog",[[0,0,1,1],0.025,0.04,"GUI_GRID"],0,0,0], [1800,"",[1,"",["0.491144 * safezoneW + safezoneX","0.383333 * safezoneH + safezoneY","0.0524866 * safezoneW","0.07 * safezoneH"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]], [1200,"",[1,"#(argb,8,8,3)color(1,1,1,1)",["0.388466 * safezoneW + safezoneX","0.528 * safezoneH + safezoneY","0.0524866 * safezoneW","0.07 * safezoneH"],[-1,-1,-1,-1],[-1,-1,-1,-1],[-1,-1,-1,-1],"","-1"],[]] ] */ //do not copy //copy everything except the two lines marked "do not copy" -
init.sqf Help
dreadedentity replied to epicgoldenwarrior's topic in ARMA 3 - MISSION EDITING & SCRIPTING
The formatting is really bad so let's fix that first: _monitorStats = [] spawn { while {true} do { hintSilent format["Supplies: %1", supplies]; }; }; sleep 10; //there is a small break in this loop to reduce the cost of this thread on the CPU. // Also, the player doesn't need 100% accuracy anyway. //THIS IS WHERE STUFF GOES WRONG, IM SURE. Generally this area at least. _buildstatus = [] spawn { while {true} do { if (supplies >= 5) then { player addAction [format ["Build", localize "STR_FS_OpenBuilder"], {createDialog "BuildMenu";}, [], 8, false, true, "", ""]; }; }; You have several problems. The first and most important is that if you actually do reach 5 supplies, that while loop just keep adding the action over and over, infinitely. The best thing to do would be to change the while loop condition to (supplies < 5) so it will terminate. You can also save the return value of spawn into a global variable, then use that to terminate with scriptDone. I don't see any place where you change the value of supplies so I'm just assuming that's done elsewhere. The sleep command you have for the first monitoring loop is not inside the loop. Did you try waiting for 10 seconds to see if the next thread would spawn? It won't anyway because you did not close the spawn. There is a closing bracket missing You have used format incorrectly. Even though you localized the string, it will not be added to "Build" Also the very last parameter of addAction is actually a condition check, so that whole thing can be simplified to just one use of the command: player addAction [format ["Build", localize "STR_FS_OpenBuilder"], { createDialog "BuildMenu"; }, [], 8, false, true, "", "supplies >= 5"]; -
I believe I read a few updates ago that setVariable can now broadcast namespace variables, so honestly, if you actually read davidoss' links, you'd have seen that's exactly what you are looking for. Pseudocode: First Player: Here is my array Now I will broadcast my array Second Player: I need to use that array for something, let me grab it Actual code: //First player _myArray = [0.90, 0.23, 0.58]; //here is my array missionNamespace setVariable ["MyArray", _myArray, true]; //now I will broadcast my array //Second player _myArray = missionNamespace getVariable "MyArray"; //I need to use that array for something, let me grab it If that fails, then barbolani's publicVariable method will work just as well. Also, not sure if that switch statement will ever do what you want it to. You'd be much better off with nested if's (this game really needs "else if")
-
Dialog encountered error with constants
dreadedentity replied to Steezy's topic in ARMA 3 - MISSION EDITING & SCRIPTING
Dialogs and defines are completely separate things, it looks like you're just having an issue with the preprocessor and specifically the #define command. When you define something, the preprocessor goes through the script and replaces the keyword with your definition no matter what it is. So this: #define COLOR_SLD_DARKRED {0.6,0.2,0.2,1}; class MainTitle: RscText { idc = 1001; text = "Choose your character"; //--- ToDo: Localize; x = 0.29375 * safezoneW + safezoneX; y = 0.225 * safezoneH + safezoneY; w = 0.4125 * safezoneW; h = 0.044 * safezoneH; colorBackground[] = COLOR_SLD_DARKRED; sizeEx = 0.8 * GUI_GRID_H; }; ends up looking like this: class MainTitle: RscText { idc = 1001; text = "Choose your character"; //--- ToDo: Localize; x = 0.29375 * safezoneW + safezoneX; y = 0.225 * safezoneH + safezoneY; w = 0.4125 * safezoneW; h = 0.044 * safezoneH; colorBackground[] = {0.6,0.2,0.2,1};; sizeEx = 0.8 * GUI_GRID_H; }; Notice you have 2 semicolons on one line, but I guess after a semicolon the game is expecting either another member definition or the end of the class, thus it is checking for an =. The game cannot compile these files because of unexpected input and to prevent any possible damage to your computer it shuts down, removing any way of running the files.- 9 replies
-
- Error
- Preprocessor instructions
-
(and 1 more)
Tagged with:
-
getVariable penformance
dreadedentity replied to Ilias38rus's topic in ARMA 3 - MISSION EDITING & SCRIPTING
I would even avoid using it on the server, as server simulated fps ties into ai control and movement and can also have an effect on client fps. Just avoid using the command at all. There are better ways to do things. The array is absolutely the best way to do it and it is completely dynamic, not sure where you got that from. In your scripts you already have control over when units spawn, literally all you need is _obj = createUnit/createVehicle [INFO]; myUnitArray pushBack _obj; _obj addEventHandler ["killed", {myUnitArray = myUnitArray - [(_this select 0)]}]; -
getVariable penformance
dreadedentity replied to Ilias38rus's topic in ARMA 3 - MISSION EDITING & SCRIPTING
nearestObjects does not provide good performance. Especially using it in a while {true} loop. Your best bet is to create and maintain an array of all the objects and iterate through that, adding and removing objects as they are created or killed/destroyed. nearestObjects [player, [], 50] gave me frame stuttering even in VR with 4 objects on the map, so I would avoid it at all costs if you're worried about performance -
initServer.sqf only gets run on the server, so no if (isServer) check is necessary (it really shouldn't be ever anyway, now that this functionality exsists)