Jump to content

cybercoco

Member
  • Content Count

    176
  • Joined

  • Last visited

  • Medals

Posts posted by cybercoco


  1. Hi all !

     

    I have a small problem, I would like to add a trigger and set two conditions for it's activation. _won is the name of the car.

    The first is "this", player is present in the area (cicle 3,3 around _won).

    The second is "!(player in _won)", player is not in the vehicle.

     

    I can't find a way to make it work...

    // _won is the name of the car   
    
    _trg = createTrigger ["EmptyDetector", getPos _won, false];
    _trg setTriggerArea[3,3,0,false];
    _trg setTriggerActivation["WEST","PRESENT",true];
    _trg setTriggerStatements[    
                                "this &&  !(player in _won)",
                                "hint 'yes yes yes'",
                                "hint 'no civilian near wonno'"
                             ];
    

  2. I found AtomicKrypton's Intro Text script on the Forum and I like it very much. I have a quick question I hope someone can answer for me; can you show me how to make all the text yellow?

     

    I know yellow is... color ='#ffff00'

     

    in the following script I would like the color to show as Yellow instead of white. (white washes out too easy).

     

    the script is;

    [ [ ["TEXT"], ["TEXT"], ["TEXT", "<t align = 'center' shadow = '1' size = '0.7' font='puristaMedium'>%1</t>", 70] ] , 1, 0.75, "<t align = 'center' shadow = '1' size = '1.0'>%1</t>" ] spawn BIS_fnc_typeText;

    thank you

     

    This works just like in HTML, it's inline styling. See also https://community.bistudio.com/wiki/Structured_Text#Color for reference.

    You can set those inside the <t> tag. Template : <t color='' align='' font='' size='' underline='' shadow='' >Some text</t>

    Line break is just <br /> and image tag : <img image=''></img>.

    • Like 2

  3. 1. How can i make the Temperature depending from "Daytime" parameters. Would something like the Pseudocode below work ? :

    _var1 =  Temperature;
    _var 2 = Daytime;
    
    switch true do {
    
    case "Morning": {
    			_var2 = _var1 ; // this is a simplified version right ??
    		};
    
    
    };
    

     

    I think this will only check once, when the mission starts. If you want it to be active during the scenario, it will have to be a trigger (which will work more like a "when").

    Because this code will only run on mission start and not twice or more. I need to be verified on that though.

     

    And if you want the temperature to be dependant from the daytime var you will just need to create a math function. For exemple :

    _daytime = 0.5; // this will be known
    _temperature = 0; // this is now a defined variable
    
    // dependency of temperature
    _temperature = (10*(_daytime + 10) - 2);
    

    In this case, because daytime is 0.5, the temperature will be (0.5+10)*10-2 = 1.5*10-2 = 15-2 = 13°


  4. Easiest way to make the animation more fluid is probably to increase the counter, for example, use counter 42 instead of 21 and set sleep to 0.5. Time stays the same but the steps are doubled.

    Yes indeed, I made a small modification to Lala14's code to find the best multiplier for a fluid animation :

    // Quickly and easily testing different multiplier 
    _master = 15;
    _timer = 20*_master;
    _interval = 1/_master;
    
    with uiNamespace do { 
        my_awesome_progressBar = findDisplay 46 ctrlCreate ["RscProgress", -1]; 
        my_awesome_progressBar ctrlSetPosition [ 0.345, 0.3 ]; 
        my_awesome_progressBar progressSetPosition 0; 
        my_awesome_progressBar ctrlCommit 0; 
    }; 
    _counter = _timer; 
    for "_i" from 1 to _counter do { 
        (uiNamespace getVariable "my_awesome_progressBar") progressSetPosition (_i/_counter); 
        // hintsilent format ["%1", _i];
        sleep _interval; 
    }; 
    ctrlDelete (uiNamespace getVariable "my_awesome_progressBar");
    

    Maybe Larrow's solution is more optimized than this loop, what do you think ?


  5.  

    Another option..

    with uiNamespace do {
        my_awesome_progressBar = findDisplay 46 ctrlCreate ["RscProgress", -1];
        my_awesome_progressBar ctrlSetPosition [ 0, 0.3 ];
        my_awesome_progressBar progressSetPosition 0;
        my_awesome_progressBar ctrlCommit 0;
    
        [ "TIMER", "onEachFrame", {
            params[ "_start", "_end" ];
            _progress = linearConversion[ _start, _end, time, 0, 1 ];
            (uiNamespace getVariable "my_awesome_progressBar") progressSetPosition _progress;
            if ( _progress > 1 ) then {
                [ "TIMER", "onEachFrame" ] call BIS_fnc_removeStackedEventHandler;
            };
        }, [ time, time + 20 ] ] call BIS_fnc_addStackedEventHandler;
    };

     

    Thank you Larrow, this is working nicely.

     

    Do you know how to center it ? I tried to center it by changing the values of the start corrdinates and succeeded but if I use this snip for another countdown timer it will need some modifications...

     

    I have noticed that the color of the bar matches the color theme of the game (set in profile preferences).

    Is it possible to change the color and add a border line ?

     

     

    For larrows way to don't need to put my snippet into the description.ext. You basically create a dialog on the fly.

     

    Or you use larrow's way and remove the last line, which deletes the control after the progress bar is full.

     

    I can't get the thing to disappear after it's full. Even after removing "[ time, time + 20 ] ] call BIS_fnc_addStackedEventHandler;"...

    You mean Lala14's code snip : "ctrlDelete (uiNamespace getVariable "my_awesome_progressBar");" ?

    -EDIT- Bar is deleted after completion with the ctrlDelete command.

    ctrlDelete (uiNamespace getVariable "my_awesome_progressBar");

    However, I didn't make R3vo's code work...


  6.  

    Here is an example of my method

    -script-

    with uiNamespace do { 
        my_awesome_progressBar = findDisplay 46 ctrlCreate ["RscProgress", -1]; 
        my_awesome_progressBar ctrlSetPosition [ 0, 0.3 ]; 
        my_awesome_progressBar progressSetPosition 0; 
        my_awesome_progressBar ctrlCommit 0; 
    }; 
    _counter = 21; 
    for "_i" from 1 to _counter do { 
        (uiNamespace getVariable "my_awesome_progressBar") progressSetPosition (_i/_counter); 
        hint format ["%1", _i]; 
        sleep 1; 
    }; 
    ctrlDelete (uiNamespace getVariable "my_awesome_progressBar");
    

    Thank you all for the help, this snip goes in the sqf file, right ?

     

    Do I need this

    class RscProgress
    {
        type = 8;
        style = 0;
        colorFrame[] = {0,0,0,1};
        colorBar[] = {1,1,1,1};
        texture = "#(argb,8,8,3)color(1,1,1,1)";
        w = 1;
        h = 0.03;
    };
    class myProgressBar//dialogue name
    {
        idd = 10;
        onLoad = "uiNamespace setVariable ['my_awesome_progressBar',_this select 0]"; //Save the display in the uiNamespace for easier access
        class Controls
        {
            class Progress: RscProgress
            {
                idc = 11;
                x = 0;
                y = 0.3;
            };
        };
    };
    

    in description.ext ?

     

    I have notived that the dialog can be closed, is there a way to avoid that ?

     

    C.Coco


  7. Strange that I didn't get that error.

    Add

    disableSerialization;

    at the top of the script

     

     

    That's for RscTitles, use createDialog instead, or try the method lala14 explained.

     

    Working fine now, thanks.

     

    actually you could just use ctrlCreate, that will save you with the entries in the description.ext and also people should be able to still move and such.

     

    Do I need to delete something from R3vo's code snip ?


  8. _rand = floor(random 3);
    
    switch(_rand) do {
        case 0: {player addAction ["Let's do some math !", math.sqf, 5];};
        case 1: {player addAction ["Let's do some math !", math.sqf, 50];};
        case 2: {player addAction ["Let's do some math !", math.sqf, 500];};
    };
    

    math.sqf

    _arg = _this select 3;
    
    _number = _arg * 2 + 10;
    
    hint format ["Yay, number is %1",_number];
    

     

    Oh, I am so used to adding just the necessary bit

    unit addAction [title, script];
    
    // More powerful
    unit addAction [
                    title,
                    script, 
                    arguments,
                    priority,
                    showWindow,
                    hideOnUse,
                    shortcut,
                    condition, 
                    positionInModel,
                    radius,
                    radiusView, 
                    showIn3D,
                    available,
                    textDefault,
                    textToolTi
    ]

    I presume "_arg = _this select 3;" takes the third element of the addaction array ? So if I want to pass two vars, do I need to create an array ?

     

    Thank you Harmdhast for enlightening me,

     

    C.Coco


  9. I'm interested in creating a progress bar. At the moment I'm using this simple loop to display a countown.

    _counter = 21;
         while { _counter > 1} do { 
         hint "";
         _counter = _counter - 1;
         hint format ["%1", _counter];
         sleep 1;
         hint "";
         };
    hint "finished";
    

    The progress bar would fill up as the value would approach the value 0.

    I don't understand a thing on this page from the wiki.

     

    Thank you,

     

    C.Coco


  10. Hi, I'm creating a script that will trigger several addactions, which means several files. However I don't want to create all these files because they are very much the same.

     

    Only small modifications need to be made in order to work. Should I use global vars and forget about using local vars and params inside the new files. Or use params ? In that case, I need you help...

    _firstvar = 1; //these values are not set, they are found by a function
    _secondvar = 2;
    
    if ( _firstvar == 0 ) then {lolo addaction ["first possibility", blabla1.sqf]};
    if ( _firstvar == 1 ) then {lolo addaction ["second possibility", blabla2.sqf]};
    if ( _secondvar == 0 ) then {lolo addaction ["third possibility", blabla3.sqf]};
    if ( _secondvar == 1 ) then {lolo addaction ["fourth possibility", blabla4.sqf]}
    

    In other words, can I somehow create an addaction that will, if menu is clicked, send vars to the file executed ?

×