Jump to content
pierremgi

custom slider issue

Recommended Posts

Hi all. I hope you're fine.

I'm about to issue a new module but for some reasons I can't customize the min max value of sliders.

All other controls are OK Edit, combo, checkbox...

To make it short, I'm using some existing cfg3den / attributes:

- a dynSimDist slider but it's hard coded from 50 to 5000 m as I'd like to make it for 0 to 1000 m

- a sliderTime  but it's hard coded from 0 to 3600 (1 hour) as I'd like to make it for 30 (sec mini) to 7200 (2 hours)

 

Here is the part of my hpp:
 

Spoiler

 

class CfgVehicles
{
    class Logic;
    class Module_F: Logic
    {
        class AttributesBase
        {
            class Default;
            class Edit; // Default edit box (i.e., text input field)
            class Combo; // Default Combo box (i.e., drop-down menu)
            class Checkbox; // Default checkbox (returned value is Bool)
            class CheckboxNumber; // Default checkbox (returned value is Number)
            class FormationGroup;
            class BehaviourGroup;
            class CombatModeGroup;
            class SpeedModeGroup;
            //class slider;
            class DynSimDist;
            class sliderTime;
            class ModuleDescription; // Module description
            class Units;
        };
        // Description base classes, for more information see below
        class ModuleDescription
        {
            class AnyPlayer;
        };
    };

 

class MGI_newModule: Module_F
    {
        scope = 2;
        displayName = "spawn something";
        author = "Pierre MGI";
        icon = "\MGI_Modules_test\Images\MGImodules_GRP_ca.paa";
        category = "MGI_Mods";
        function = "MGI_fnc_ModulenewModule";
        functionPriority = 7;
        isGlobal = 0;
        isTriggerActivated = 0;
        isDisposable = 0;
        is3DEN = 1;

        class Attributes: AttributesBase
        {
.....
            class radiusGo
              {
                property = "MGI_ModulenewModule_radiusGo";
                displayName = "radius area";
                control = "DynSimDist";
                //sliderRange[] = {0,1000}; // doesn't work
                tooltip = "if synced trigger area, the trigger area applies. Small area can be overridden as units/vehicles will spawn in convenient places. Default 0, max 1000";
                typeName = "NUMBER";
                defaultValue = "50";
                expression = "_this setVariable ['%s',_value];";
            };

.....

              class delayForRepeat
              {
                property = "MGI_ModuleSpawnAttack_delayForRepeat";
                displayName = "delay for repeat";
                control = "sliderTime";
                attributeLoad = "sliderSetRange [100,30,3600]";  // doesn't work
                //expression = "(_this controlsGroupCtrl 100) sliderSetRange [30,3600]";  // error because _this is an object
                //sliderRange[] = {30,3600};  // doesn't work
                tooltip = "mandatory if repeat is enabled. Can't be less than 30 sec. Default=1200";
                typeName = "NUMBER";
                defaultValue = "1200";
            };

......

}

 

// don't focus on {} that's not the problem. It's an extract. The slider are OK, the default values are OK, The problem is the hard coded min max values.

If you have any idea on how to set these values, while in 3den of course.. Thanks.

 

I tested for far:

sliderRange[] = {0,1000};  but I guess it's not at the right place. So I tested also in sub-classes: class controls {class value { sliderRange[] = {0,1000}; };};... No joy

I tested as shown sliderSetRange,  in attributeLoad (or onLoad) codes, with idc 100 which the right one for slider... no success.

 

Share this post


Link to post
Share on other sites

I'd say you need to define your own attribute slider control with custom slider range and use that (defined under Cfg3DEN > Attributes). 🤔
 

AFAIK attributeload/save only work inside those control classes themselves, not in the module attribute classes.
And if you modify the attributeload/save you most likley need to include BI original code in them or you might get non-working attributes in the module.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks little progress.

 

I added:

class cfg3DEN
{
    class Attributes
    {
        class DynSimDist;
        class Controls;
        class Edit;
        class Title;
        class Value;
        class slider;
        class ctrlXSliderH;
        class ctrlXSliderV;
        class ctrlDefault;
        class MGIDynSimDist: DynSimDist {
            class Controls: Controls {
                class Edit: Edit{};
                class Title: Title{};
                class Value: Value {
                    access = 0;
                    arrowEmpty = "\a3\3DEN\Data\Controls\CtrlXSlider\arrowEmpty_ca.paa";
                    arrowFull = "\a3\3DEN\Data\Controls\CtrlXSlider\arrowFull_ca.paa";
                    blinkingPeriod = 0;
                    border = "\a3\3DEN\Data\Controls\CtrlXSlider\border_ca.paa";
                    color[] = {1,1,1,0.6};
                    colorActive[] = {1,1,1,1};
                    colorDisabled[] = {1,1,1,0.25};
                    default = 0;
                    deletable = 0;
                    fade = 0;
                    h = "5 * (pixelH * pixelGrid *     0.50)";
                    idc = 100;
                    lineSize = 50;
                    onCanDestroy = "";
                    onDestroy = "";
                    onKeyDown = "";
                    onKeyUp = "";
                    onKillFocus = "";
                    onMouseButtonClick = "";
                    onMouseButtonDblClick = "";
                    onMouseButtonDown = "";
                    onMouseButtonUp = "";
                    onMouseHolding = "";
                    onMouseMoving = "";
                    onMouseZChanged = "";
                    onSetFocus = "";
                    onSliderPosChanged = "";
                    show = 1;
                    sliderPosition = 0;
                    sliderRange[] = {0,1000}; // The only change I'd like!!!
                    sliderStep = 50;
                    style = 1024;
                    thumb = "\a3\3DEN\Data\Controls\CtrlXSlider\thumb_ca.paa";
                    tooltip = "";
                    tooltipColorBox[] = {0,0,0,0};
                    tooltipColorShade[] = {0,0,0,1};
                    tooltipColorText[] = {1,1,1,1};
                    tooltipMaxWidth = 0.5;
                    type = 43;
                    w = "(    82 - (    10 + 1)) * (pixelW * pixelGrid *     0.50)";
                    x = "48 * (pixelW * pixelGrid *     0.50)";
                    y = 0;
                };
            };
        };
    };
};

 

But that doesn't work.

I obtain:

Spoiler

11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.type'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.style'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.y'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.colorBackground'.
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.colorText'.
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.font'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: Custom font  is not present, it was replaced by the default Arma3 font.
11:03:19 Warning Message: 'font/' is not a class ('fonts' accessed)
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: 'font/' is not a class ('spaceWidth' accessed)
11:03:19 Warning Message: 'font/' is not a class ('spacing' accessed)
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.sizeEx'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/slider/Controls/Value.text'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.type'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.style'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.y'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.colorBackground'.
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.colorText'.
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: Size: '/' not an array
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.font'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.sizeEx'.
11:03:19 Warning Message: '/' is not a value
11:03:19 Warning Message: No entry 'bin\config.bin/Cfg3DEN/Attributes/SliderTime/Controls/Value.text'.
11:03:19 Warning Message: '/' is not a value
11:03:25 Error in expression <        _ctrlSlider slidersetposition (_value / (sliderspeed _ctrlSlider select 1));        >
11:03:25   Error position: </ (sliderspeed _ctrlSlider select 1));        >
11:03:25   Error Zero divisor

 

So the fact is, if you glance at cfg3DEN/ attributes/ DynSimDist,  some classes are double!! like HScrollbar, some classes are same as sub-classes like Value...

It's totally in-understandable for me. I guess I'm messing with a lack of declaration for parent classes (I don't have the stuff in my Value) but I don't know how to do that properly.

 

Share this post


Link to post
Share on other sites

I have never been able to get rid off those kinds of errors myself by any other method than just copy/pasting the whole class I'm inheriting from so that you basically redefine everything in it.
I'm assuming there is some better method, just never got any of that inheriting stuff working properly myself..

Share this post


Link to post
Share on other sites

Well, at this time, No success in making my own inherited slider, DynSimDist like,  just because I can't understand all the parent classes I need, and where. Just instance, Value (in working BI DynSimDist attributes (configfile >> "Cfg3DEN" >> "Attributes" >> "DynSimDist" >> "Controls" >> "Value") has for parents: ["Value","Value","ctrlXSliderH","ctrlXSliderV","ctrlDefault"]

That is to say 3 "Value"????

 

I'm looking for the control(s) involved in such 3den Edit custom module. Is there any solution for hitting this cursor (idc 100) in the display (315 ? or 313) but inside a control group if i'm right?


 

Share this post


Link to post
Share on other sites

Trying to find and affect the controls when opening an attribute is also doable, completely forgot about this because I've mostly needed much more complicated customization so have elected the custom attribute route..
You have to have some sort of per frame handler to detect opening attributes (display 315), then search allControls for that display and find the class name of the slider and it's control with idc 100.
Something like:

onEachFrame { 
	if (!isNull (findDisplay 315) && {typeOf (get3DENSelected "Logic" # 0) == "<mymoduleclass>"}) then {
		(((allControls (findDisplay 315) select {ctrlClassName _x == "Slider"}) # 0) controlsGroupCtrl 100) sliderSetRange [0, 1000];
		onEachFrame {};
	};
}


For the custom slider config, you don't need to worry about the sub classes etc, just copy paste everything from the default slider control (remove all the access = 0 lines though) and change the sliderRange[] = {}; in the topmost Value control which should come right after (not inside) Title class.
The value class inside the topmost value class is for the output shown at the end of the slider, like 500m, 50% etc.

Share this post


Link to post
Share on other sites

Thanks

Finally the first custom slider works after copying/pasting all the lines of all the stuff, just for modifying the limits of this cursor!

 

Now, I'm struggling with a slightly different slider because it's a timeSlider based (so with HH:MM:SS) at right.

Same method: copied/pasted all the stuff, modified the range... and the reference in attributeLoad (MGISliderTime instead of sliderTime )
For... works... but all values are multiplied per 3! all returned values in all controls of the slider.  Perhaps something to do with a repeated code in Hours, minutes, seconds classes...

I didn't find to problem.

And, cherry on the cake, if I try to add:

#include "\a3\3DEN\UI\macros.inc"

in front of my cfg3den, I get a message at addon built: code = 1; cfgConvert task failed error reading config file: c:\..path...\moduleFolder\config.cpp

I checked the integrity file, the 3den pbo is ok ui\macro.inc is present. So???? Another time spilling for some hidden subtlety.

 

  • Like 1

Share this post


Link to post
Share on other sites

Be glad you don't have the awesome STATUS_ACCESS_VIOLATION 0x00000000000005 ctd without any clue to what might be causing it..

Sounds to me that the code in the time sliders fiddle with your output, the code in the onSliderPosChanged event in the slider class value control 🤔
 

Quote

And, cherry on the cake

Assuming you have the a3 folder on your P-drive  you need to "cd" as many steps backwards as it is required to reach P root from your addon folder, like #include "..\..\..\a3\3DEN\UI\macros.inc".
So if your mod stuff is set up on P like x\mytag\mymod\addons\addon.pbo you need like 5 "steps" back to find the a3 folder, first ..\ is addons, second ..\ is mymod, third ..\ is mytag, fourth ..\ is x and lastly the fifth ..\ is then P root. At least if I calc'd this correctly 😄
Although if you're using BI Tools I have no idea does that even understand this :shrug:

Share this post


Link to post
Share on other sites
3 hours ago, h - said:

Be glad you don't have the awesome STATUS_ACCESS_VIOLATION 0x00000000000005 ctd without any clue to what might be causing it..

Sounds to me that the code in the time sliders fiddle with your output, the code in the onSliderPosChanged event in the slider class value control 🤔
 

Assuming you have the a3 folder on your P-drive  you need to "cd" as many steps backwards as it is required to reach P root from your addon folder, like #include "..\..\..\a3\3DEN\UI\macros.inc".
So if your mod stuff is set up on P like x\mytag\mymod\addons\addon.pbo you need like 5 "steps" back to find the a3 folder, first ..\ is addons, second ..\ is mymod, third ..\ is mytag, fourth ..\ is x and lastly the fifth ..\ is then P root. At least if I calc'd this correctly 😄
Although if you're using BI Tools I have no idea does that even understand this :shrug:

 

Interesting

I didn't find an explanation for the triple value. The vanilla code is same but I presume there is some macros running in this case.

I must change time slider for a simple slider. Less visual but a mod is supposed to run for every subscriber.

The \a3\... path was supposed to work as a recognized path from Arma folder and that's the first time I see that failing. But perhaps, this kind of inclusion is not possible from pboed mod to pboed mod. Anyway, I can't specify my own folder path. It's a public release, so the code have to match with all configurations.

I'm using BI Arma3 tools but I didn't mount any P drive (I did it for a trial of a custom map with terrain builder, years ago).

Thanks and Happy New Year!

Share this post


Link to post
Share on other sites
3 hours ago, pierremgi said:

so the code have to match with all configurations.

It would work as it's relevant only to the moment of "packing", at least should be, I can only speak from the experience with using pboproject though.
But since you have not set up P-drive this is a bit moot. You could try the include without the first \ to see if that makes any difference.
 

Quote

I didn't find an explanation for the triple value.

That is a bit peculiar.
There seems to be some pageSize value there in at least some of the time related sliders, maybe that has something to with it :shrug:

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×