Results 1 to 7 of 7

Thread: [Request] slider and DOTASettingsSlider documentation or example

  1. #1
    Basic Member
    Join Date
    Nov 2011
    Posts
    236

    [Request] slider and DOTASettingsSlider documentation or example

    There's an element, DOTASettingsSlider, that is used in the Dota 2 options menu, but it is not documented (or maybe not intended to be used?). If you add one to your layout, it creates a slider with a value that's always '1' and it's unclear how to use it (which event?)

    Someone on ModDota managed to use DOTASettingsSlider with a bit of a javascript hack, but it would be nice to have this type of element built in, with perhaps a OnSliderChanged, or OnChanged type of event call back.
    https://moddota.com/forums/discussio...istance-slider

    Thanks!
    Training Map for Last Hitting Under a Tower:
    http://steamcommunity.com/sharedfile.../?id=531587903

  2. #2
    Basic Member
    Join Date
    May 2015
    Posts
    30
    Slider control camera distance
    Code:
    <DOTASettingsSlider convar="dota_camera_distance" min="1000" max="2000" text="Camera distance" />

  3. #3
    Basic Member
    Join Date
    Nov 2011
    Posts
    236
    Interesting, thanks. However, I'd still like to be able to read the value from the slider whenever it changes.
    Training Map for Last Hitting Under a Tower:
    http://steamcommunity.com/sharedfile.../?id=531587903

  4. #4
    Basic Member
    Join Date
    May 2015
    Posts
    30
    "DOTASettingsSlider" based on "Slider" panel. I dont know event name, but you can read parameter "value" with little period
    Code:
    <Slider class="HorizontalSlider" direction="horizontal" id="Slider1" />
    Code:
    var slider = $.GetContextPanel().FindChildInLayoutFile( "Slider1" );
    var lastValue = 0;
    
    function OnValueChanged(slider)
    {
    	$.Msg(slider.value);
    	GameUI.SetCameraDistance( slider.value );
    }
    
    function  Check()
    {
    	if (slider.value != lastValue)
    		OnValueChanged(slider);
    	lastValue = slider.value;
    	$.Schedule(0.03, Check);
    }
    
    (function()
    {
            slider.min = 1000;
            slider.max = 2000;
    	slider.value = 1300;
    	lastValue = slider.value;
            $.Schedule(0.03, Check);
    }

  5. #5
    Basic Member
    Join Date
    Nov 2011
    Posts
    236
    Ah, thanks!
    Training Map for Last Hitting Under a Tower:
    http://steamcommunity.com/sharedfile.../?id=531587903

  6. #6
    Basic Member
    Join Date
    Mar 2013
    Posts
    42
    There is a function for slider "SetDirection" -- any idea what the value it takes to make it a horizontal slider is?

  7. #7
    Basic Member
    Join Date
    Nov 2011
    Posts
    236
    I would try using "horizontal", or 0, 1, and 2
    Training Map for Last Hitting Under a Tower:
    http://steamcommunity.com/sharedfile.../?id=531587903

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •