Jump to content

scottb613

Member
  • Content Count

    731
  • Joined

  • Last visited

  • Medals

Posts posted by scottb613


  1. On ‎7‎/‎5‎/‎2014 at 7:56 AM, sxp2high said:

    You can sleep in called code, but it will pause the scope, while spawn will create a new virtual machine (VM).

     

    
    call { sleep 5; };
    hint "hello world."; // Hint will be shown after 5 sec.
     

     

     

    
    [] spawn { sleep 5; };
    hint "hello world."; // Hint will be shown without delay
     

     

     

    Example: I think you would want to use [call] vs [spawn] ???

     

    Regards,
    Scott


  2. 33 minutes ago, RoryRothon said:

    Maybe this instead of sleep?

     

    
    _timer = time + 2;
    waitUntil { time > _timer };

     

     

    Hi Rory,

     

    I think I'm not explaining it well - here is an excerpt from KK's blog:

     

     

    Quote

    Today I’d like to talk a bit about scheduled and non scheduled environment in Arma.

     

    Remember when you were a kid and you were playing your favourite video game and your mum told you to go do something and you were like “leave me alone” like you had a choice? This is how it works in Arma. Non scheduled environment is just that: script calls that need immediate attention, such as event handler calls. What good is event handler if you get notification of an event sometime after it happened and not immediately when it happens? At this point Arma will suspend its regular scheduled execution and give priority to those non scheduled events.

     

    This is also the reason why you cannot use sleep or uiSleep or waitUntil commands in non scheduled environment. These scripts have to complete as fast as possible to let Arma return back to scheduled environment. This is also the reason any while loop in non scheduled environment will exit after 10,000 iterations. Using sleep command in a script is a good way to test what environment the script is running, in case you don’t know how it was originated. Non scheduled environment will throw an error. How can you not know? With many scripts calling scripts calling scripts it is easy to lose track of the origin. If you call a script from scheduled environment, called script will also run in scheduled environment and so on. With non scheduled environment all scripts will be non scheduled.

     

    Non scheduled environments: CfgFunctions with preInit = 1, all event handler scripts including object init fields, onXXXXXX events (onEachFrame, onMapSingleClick etc.), Arma 3 debug console exec, FSM scripts. Scheduled environments: CfgFunctions with postInit = 1, various event scripts such as initPlayerLocal.sqfinitPlayerServer.sqf etc., and of course the init.sqf. You can start scheduled environment inside non scheduled by using spawn or execVM commands. Because none of them is expected to come back to the script they are executed from, the engine doesn’t wait. If you use call command, then the engine has no choice but to wait for its return. So be wise choosing which command to use when.

    The scheduled environment does not guarantee the order or priority of execution of queued scripts. The engine will simply do it when it is feasible and possible. If you have too many non scheduled calls and they also take time to complete, your scheduled scripts can be delayed significantly, we are talking minutes! For the same reason non critical scripts should be run in scheduled environment so that a) they do not get on the way of urgent executions, b) give engine more flexibility for rescheduling when needed.

     

     

    Regards,

    Scott


  3. Hi Rory,

     

    LOL - glad you figured it out... Globals are easy - just leave the "_" off the beginning - then it's available not only in your current script but any other script you might use... As I assume you've gathered - the script runs in sequential order - so you can't use variables you haven't declared until you get to them... If you write any functions - same deal - I usually place them in the very beginning so they are immediately available...

     

    I'm no expert - but - if you use [spawn] I don't think your [sleep] will work - [spawn] is scheduled to run only when there is time available in the game engine - so [sleep]'s don't work - you might want to look at [call] as that's sequential - everything needs to be done in order - and the script processing will wait for [sleep]'s to process before moving on... I'm probably not explaining it 100% - but I think that's the gist... [spawn] is something you fire off when you don't need the result to continue...

     

    If you're new to this - hope your editing with something that gives you the ArmA Syntax color coding - something like Notepad ++ with an ArmA script plugin... If you need more info just shout...

    http://killzonekid.com/arma-2-arma-3-hybrid-syntax-highlighter-for-notepad/

     

    Here's some great background info on variables:

    http://killzonekid.com/arma-scripting-tutorials-variables-part-2/

     

    Bookmark that site as there is a TON of very useful scripting help...

     

    Best of luck...

     

    Regards,

    Scott


  4. Hi...

    If you've noticed ArmA sceneries are a bit small compared to real life - the runways are a bit shorter - FOV seems a bit off as runways seem to rush by entirely too fast - the normal view distances aren't that far - I believe ArmA jet speeds have been adjusted accordingly to compensate for this - you need to take the flight models with a grain of salt... While many seem to enjoy flying jets - I'm a real pilot and and avid flight simmer - I don't think flight is modeled all that well - personally - I stick to flying helicopters in ArmA for the most part and leave the jets for AI to fly... There are afterburners - I don't recall if you you need to bind a key... Just my two cents - take it for what it's worth...

    Regards,
    Scott


    Sent from my iPad using Tapatalk

    • Thanks 1

  5. Hi Folks,

    Maybe this is obvious to everyone but I've found using the "windows clipboard" really helps/speeds my script debugging efforts... I just call my logging function from critical areas of code passing it whatever respective string is needed... This allows me to track the codes execution step by step - or -  variable by variable if necessary... It doesn't vanish like a hint - it's not microscopic text like in the chat dialog - and I don't have to wade through the full log file... Simply open a new text document and hit paste after your codes execution... The only issue I haven't been able to figure out is - I can't pass the clipboard a carriage return - therefore the file output is delimited... It's easy in Notepad ++  to globally substitute carriage returns for your delimiter - a couple of keystrokes...

    // FUNCTION - Log to Clipboard //

    _fcLogger = {params ["_logEnt"];

    private ["_logHld","_logSpc","_logPut"];

    _logHld = copyfromclipboard;

    _logSpc = " ## ";

    _logPut = _logHld + _logEnt + _logSpc;

    copytoclipboard _logPut;

    };


    Regards,
    Scott


  6. Hi Folks,

     

    Obviously we need ( 0 == 0 ) to continue from the [waitUntil] loop...

     

    I was confused on how you were making the "unit is alive" and "unit is not in Helicopter" a condition of [count]... Up until now I thought [count] only had one parameter - the array you were counting...

     

    As usual - wiki - has the answer and shows the alternative syntax which applies here and adds a "condition" to the mix:

     

    [Count]
    
    Syntax: condition count array
    
    Parameters: condition: Code that must return true for the tested element to be counted. 
    
    The variable _x will contain the currently tested element. 
    
    array: Array
    
    Return Value: Number

     

    Regards,

    Scott


  7. LOL - I caught that myself...

    :f:

     

    The number of groups per helicopter can vary... Possible (4) helicopters with possible (4) infantry groups per helicopter... Just wanted to insure everyone was loaded prior to commencing with engine start... I tried starting the engines before the chalks completed loading - but I couldn't hold them on the ground - they just popped up an hovered like 20 meters off the ground - even with flyinHeight set to 0...

     

    My implementation (I can't test until weekend):

     

    // (CHALK) waituntil each chalk loaded as cargo //
    {
    	_slkUnt = slick1;
    	_chkGrp = missionNamespace getVariable [_x, objNull];
    	waituntil { sleep 2; ({alive _x && !(_x in _slkUnt)} count (units _chkGrp)) == 0 };
    	
    } foreach _chk1Arr;
    
    {
    	_slkUnt = slick2;
    	_chkGrp = missionNamespace getVariable [_x, objNull];
    	waituntil { sleep 2; ({alive _x && !(_x in _slkUnt)} count (units _chkGrp)) == 0 };
    	
    } foreach _chk2Arr;
    
    {
    	_slkUnt = slick3;
    	_chkGrp = missionNamespace getVariable [_x, objNull];
    	waituntil { sleep 2; ({alive _x && !(_x in _slkUnt)} count (units _chkGrp)) == 0 };
    	
    } foreach _chk3Arr;
    
    {
    	_slkUnt = slick4;
    	_chkGrp = missionNamespace getVariable [_x, objNull];
    	waituntil { sleep 2; ({alive _x && !(_x in _slkUnt)} count (units _chkGrp)) == 0 };
    	
    } foreach _chk4Arr;

     

    Regards,

    Scott

     

     


  8. Hi Folks,

     

    Normally I can find something to help me get through each task I need to complete - although it might not be the most efficient method... I'm struggling a bit with this one...

     

    I have an array of infantry group names - I want to "waitUntil" all infantry units are loaded into cargo...

     

    This is where I'm at - the example below doesn't work - just illustrates my thought process...

     

    Any suggestions or help appreciated...

     

    {
    	_vehicle = slick1;
    	_infGroup = missionNamespace getVariable [_x, objNull];
    	_infUnitArr = units _infGroup;
    	{
    		_cargoIndex = _vehicle getCargoIndex _x;
    		waitUntil { _cargoIndex != -1 }; 
    	} foreach _infUnitArr; 
    } foreach _infGroupArr;

     

    Thanks...

     

    Regards,
    Scott

     


  9. I wonder if anybody has the xml file still from this awesomeness. Lost mine and just cannot find it again. Older but definitely the best IMO in terms of syntax highlighting, I can even add the newer commands and reserved words if needed. The author's bitbucket is closed. :down:


    Sorry - I don't - my favorite is the one from Killzone Kid - I have that one and it's still available...

    Regards,
    Scott



    Sent from my iPad using Tapatalk
    • Like 1

  10. IRL there are also IR and IIR variants of Mavericks.

    Anyway, for more info you can check
    https://community.bistudio.com/wiki/Arma_3_Sensors
    and
     


    Hi Oukej,

    A wealth of information but on a quick perusal - I don't see a usage guide - stuff like how do I change the missile tracking mode from Visual to IR (if the weapon is capable) - how do I use my onboard laser to laze my own target - an actual demonstration of how to setup an attack run using these great new features with the various weapons - is there anything like that floating around ?

    Regards,
    Scott


    Sent from my iPad using Tapatalk
×