Is there a way to bypass the function of a ui_slider?

treynterrio
treynterrio Member Posts: 64 Member

Hi there, Is there a way to bypass the function of a ui_slider with a button?

When the Button is active the function of the slider works when the Button is deactivated the slider function doesn't work.

I tried this but it has no function:

on init


declare ui_slider $COS(0, 795000)

  make_persistent($COS) 

declare $k_COS

$k_COS := get_ui_id($COS) 

  set_control_par_str($k_COS,$CONTROL_PAR_PICTURE,"cos") 

set_control_par($k_COS,$CONTROL_PAR_POS_X,512)

set_control_par($k_COS,$CONTROL_PAR_POS_Y,141)

set_control_par($k_COS,$CONTROL_PAR_MOUSE_BEHAVIOUR,$mouse_resp)


declare ui_button $GRAPE

declare $slider_disabled

  declare $CONTROL_PAR_DISABLE

  $GRAPE := 0

make_persistent ($GRAPE) 

declare $k_GRAPE

$k_HAZE := get_ui_id($GRAPE) 

  set_control_par_str($k_GRAPE,$CONTROL_PAR_TEXT,"")

  set_control_par_str($k_GRAPE,$CONTROL_PAR_PICTURE,"GRAPE")

set_control_par($k_GRAPE,$CONTROL_PAR_POS_X,521)

set_control_par($k_GRAPE,$CONTROL_PAR_POS_Y,117)

set_control_par($k_GRAPE,$CONTROL_PAR_MOUSE_BEHAVIOUR,$mouse_resp)


end on


ui_control($GRAPE)

$slider_disabled := get_control_par($COS, $CONTROL_PAR_DISABLE)

if ($slider_disabled = 1)

set_control_par($COS, $CONTROL_PAR_DISABLE, 1)

$slider_disabled := 0

else

set_control_par($COS, $CONTROL_PAR_DISABLE, 0)

$slider_disabled := 1

end if

end on


Comments

  • noY_T
    noY_T Member Posts: 37 Member

    Here's the basic idea. In the slider callback allow whatever it is supposed to do only when the button is 1:

    on ui_control ($slider)
     // only let slider do what it is supposed to do then button is 1
     if ($button = 1)
        //set_engine_par(...) or whatever
     end if
    end on
    
  • treynterrio
    treynterrio Member Posts: 64 Member

    maybe you could help me with this:

    that's what the slider do:

    ui_control ($COS)

    set_engine_par($ENGINE_PAR_VOLUME, $COS,2, -1, 0)

    and then?

  • treynterrio
    treynterrio Member Posts: 64 Member

    on ui_control ($cos)

    if ($grape = 0)

    set_engine_par($ENGINE_PAR_VOLUME, $COS,2, -1, 0)

    $grape := 1

     end if

    end on

  • treynterrio
    treynterrio Member Posts: 64 Member
    edited September 2023

    on ui_control ($cos)

    if ($grape = 0)

    set_engine_par($ENGINE_PAR_VOLUME, $COS,2, -1, 0)

    $grape := 1

     end if

    end on

  • noY_T
    noY_T Member Posts: 37 Member
    on ui_control ($cos)
      if ($grape = 0)
        set_engine_par($ENGINE_PAR_VOLUME, $COS,2, -1, 0)
       end if
    end on
    
  • treynterrio
    treynterrio Member Posts: 64 Member

    this one works perfect now thanks 🙏🏼

Back To Top