Derbeder |
06-12-2019 12:01 |
Ksp Scriptings (Sublime) Vertical Scrollbar
Bu videoda vertical srcollbar yapıyoruz, enstruman buttonların dizilimini yaparak tam 33 enstruman butonu oluşturmuş oluyoruz, 33 ideal olduğu düşünerek o sayıda bıraktım.
ui sınırlamaları olduğu için belki bilmiyorsunuzdur, bende daha önce bilmiyordum.
Mesela kontakt 5de 255 di herhalde, ui slider 256 olunca devam etmedi, aklıma gelmişken söyleyeyim dedim diğerlei için net sayı bilmiyorum onlarda bu civardadır diye düşünüyorum..
Size tavsiyem sublime ksp kullanarak kodlayın, hem daha kolay hemde uzun kodlar yazmak gerekmiyor..
Kod:
{***********************************************
Vertical Scrollbar v1.0
Author: BYHSNK
Written by: Fatih Korkmaz
*************************************************}
on init
message("")
set_ui_height_px(350)
make_perfview
set_control_par_str($INST_ICON_ID,$CONTROL_PAR_PICTURE,"icon")
set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"st")
set_ui_color(9)
set_script_title("SliderEnstruman")
declare const BTN_SAYISI := 33
declare const PADDING := 16
declare const BTN_POS_X := 310
declare const BTN_POS_Y := 140
declare const MARGIN_POS_Y := 100
declare const BTN_WIDTH := 235
declare const BTN_HEIGHT := 18
declare const MAX_Y := 49
declare const ICON_SAYISI := 33
declare const ICON_POS_X := 565
declare const ICON_POS_Y := 140
declare const ICON_WIDTH := 18
declare const ICON_HEIGHT := 18
declare const $SCROLL_WIDTH := 16
declare const $SCROLL_HEIGHT := 240
declare const scrollbar := 0
declare const scrollpadding := -15
declare paddingautoscroll
paddingautoscroll := 12 {21 den sonra 1.2.3}
declare %Sayidegeri[33]
declare %BTN_ids[BTN_SAYISI]
declare %icon_ids[ICON_SAYISI]
declare $i
declare position
declare %ids [4]
declare ui_switch glides
glides -> text := "None"
glides -> width := 101
glides -> height := 20
glides -> pos_x := 310
glides -> pos_y := 27
glides -> picture := ""
glides -> textpos_y := 2
glides -> text_alignment := 1
declare ui_switch byhsnk
byhsnk -> text := "None"
byhsnk -> width := 100
byhsnk -> height := 20
byhsnk -> pos_x := 409
byhsnk -> pos_y := 27
byhsnk -> picture := ""
byhsnk -> textpos_y := 2
byhsnk -> text_alignment := 1
declare ui_switch legato
legato -> text := "None"
legato -> width := 102
legato -> height := 20
legato -> pos_x := 508
legato -> pos_y := 27
legato -> picture := ""
legato -> textpos_y := 2
legato -> text_alignment := 1
%ids [0] := get_ui_id (glides)
%ids [1] := get_ui_id (byhsnk)
%ids [2] := get_ui_id (legato)
declare ui_label msj(1, 2)
msj -> text :=""
msj -> width :=298
msj -> height :=50
msj -> pos_x := 310
msj -> pos_y := 279
msj -> picture :="nsj"
declare ui_slider scroll(scrollbar+scrollpadding*paddingautoscroll, 160)
scroll -> pos_x := 585
scroll -> pos_y := 60
scroll -> width := $SCROLL_WIDTH
scroll -> height := $SCROLL_HEIGHT
scroll -> mouse_behaviour := -750
scroll -> picture :="slider1"
scroll := 160
declare_button(0)
declare_button(1)
declare_button(2)
declare_button(3)
declare_button(4)
declare_button(5)
declare_button(6)
declare_button(7)
declare_button(8)
declare_button(9)
declare_button(10)
declare_button(11)
declare_button(12)
declare_button(13)
declare_button(14)
declare_button(15)
declare_button(16)
declare_button(17)
declare_button(18)
declare_button(19)
declare_button(20)
declare_button(21)
declare_button(22)
declare_button(23)
declare_button(24)
declare_button(25)
declare_button(26)
declare_button(27)
declare_button(28)
declare_button(29)
declare_button(30)
declare_button(31)
declare_button(32)
declare ui_label Max(1, 2)
Max -> text :=""
Max -> width := 255
Max -> height := 219
Max -> pos_x := BTN_POS_X
Max -> pos_y := 48
Max -> picture :="scrollbg"
{
declare ui_label Komapencere(1, 2)
Komapencere -> text :=""
Komapencere -> width := 285
Komapencere -> height := 85
Komapencere -> pos_x := 25
Komapencere -> pos_y := 48
Komapencere -> picture :="koma"
declare ui_label Komapencere2(1, 2)
Komapencere2 -> text :=""
Komapencere2 -> width := 285
Komapencere2 -> height := 85
Komapencere2 -> pos_x := 24
Komapencere2 -> pos_y := 245
Komapencere2 -> picture :="komaayar"}
for i := 0 to num_elements(%BTN_ids) - 1
position := scroll - MARGIN_POS_Y + PADDING * i
%BTN_ids[i] -> pos_y := position
if(position < MAX_Y or position > $SCROLL_HEIGHT )
%BTN_ids[i] -> hide := HIDE_WHOLE_CONTROL
else
%BTN_ids[i] -> hide := HIDE_PART_NOTHING
end if
inc(position)
end for
for i := 0 to num_elements(%icon_ids) - 1
position := scroll - MARGIN_POS_Y + PADDING * i
%icon_ids[i] -> pos_y := position
if(position < MAX_Y or position > $SCROLL_HEIGHT )
%icon_ids[i] -> hide := HIDE_WHOLE_CONTROL
else
%icon_ids[i] -> hide := HIDE_PART_NOTHING
end if
inc(position)
end for
for i := 0 to num_elements(%Sayidegeri) - 1
position := scroll - MARGIN_POS_Y + PADDING * i
%Sayidegeri[i] -> pos_y := position
if(position < MAX_Y or position > $SCROLL_HEIGHT )
%Sayidegeri[i] -> hide := HIDE_WHOLE_CONTROL
else
%Sayidegeri[i] -> hide := HIDE_PART_NOTHING
end if
inc(position)
end for
declare ui_label textname(1, 1)
textname -> text :=""
textname -> width :=280
textname -> height :=18
textname -> pos_x := BTN_POS_X
textname -> pos_y := 259
textname -> picture :="textnamem"
declare ui_label bilgi(1, 2)
bilgi -> text :=""
bilgi -> width :=610
bilgi -> height :=23
bilgi -> pos_x := 5
bilgi -> pos_y := 0
bilgi -> text_alignment := 1
bilgi -> picture :=""
declare ui_button toggle
toggle -> text := ""
toggle -> width := 18
toggle -> height := 18
toggle -> pos_x := 590
toggle -> pos_y := 259
toggle -> picture :="toggles"
end on
scroll_button_control(0,VL, Violin,Feyyaz Kurt,feyyaz)
scroll_button_control(1,NY, Ney,Ahmet Kaya,ahmet)
scroll_button_control(2,PN,YamahaGrand Piano,Egemen Piyanist,Albumkapakpng)
scroll_button_control(3,CLR,Moss Klarnet,Hayrettin Piyanist Korg Pa900,Albumkapakpng)
scroll_button_control(4,ZRN,Zurna SL,Bergamali Sedat Haci Piyanist - KorgPa800,Albumkapakpng)
scroll_button_control(5,LD,Lead,Piyanist Haci Dayi,Albumkapakpng)
scroll_button_control(6,FLT,Flute,Piyanist Orhan,Albumkapakpng)
scroll_button_control(7,OUD,Ud,Merve Canlı Pro.Studio,Albumkapakpng)
scroll_button_control(8,ZRVS,Zervas Lead,Delikli piyanist,Albumkapakpng)
scroll_button_control(9,ACC,Accordion,Piyanist ibocan,Albumkapakpng)
scroll_button_control(10,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(11,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(12,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(13,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(14,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(15,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(16,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(17,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(18,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(19,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(20,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(21,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(22,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(23,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(24,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(25,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(26,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(27,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(28,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(29,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(30,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(31,--,Empty,Aciklama,Albumkapakpng)
scroll_button_control(32,--,Empty,Aciklama,Albumkapakpng)
macro declare_button(#idx#{,#Kensismi#,#Baslik#,#iconAlbumkapakpng#})
declare ui_label Sayi_#idx#(1, 1)
declare ui_button button_#idx#
declare ui_switch icon_#idx#
%Sayidegeri[#idx#] := get_ui_id(Sayi_#idx#)
Sayi_#idx# -> text := "#idx#"
Sayi_#idx# -> width := 18
Sayi_#idx# -> height := 18
Sayi_#idx# -> pos_x := 311
Sayi_#idx# -> pos_y := 140
Sayi_#idx# -> picture := ""
%BTN_ids[#idx#] := get_ui_id(button_#idx#)
button_#idx# -> text :="#Baslik#"
button_#idx# -> width := BTN_WIDTH
button_#idx# -> height := BTN_HEIGHT
button_#idx# -> pos_x := 335
button_#idx# -> picture := "scrollbtn"
%icon_ids[#idx#] := get_ui_id(icon_#idx#)
icon_#idx# -> text := ""
icon_#idx# -> width := ICON_WIDTH
icon_#idx# -> height := ICON_HEIGHT
icon_#idx# -> pos_x := ICON_POS_X
icon_#idx# -> picture := "#iconAlbumkapakpng#"
end macro
macro scroll_button_control(#idx#,#Kensismi#,#Baslik#,#mesaj#,#reklam#)
on ui_control(button_#idx#)
button_scroll(get_ui_id(button_#idx#))
textname -> text := "#idx# : " & "#Kensismi# : " & "#Baslik#"
bilgi -> text := "#idx# : " & "#Baslik#" &" (#mesaj#)"
msj -> picture := "nsj"
icon_#idx#:=0
end on
on ui_control(icon_#idx#)
icon_scroll(get_ui_id(icon_#idx#))
msj -> picture := "#reklam#"
bilgi -> text := ""
end on
end macro
function button_scroll(scroll_id)
if(toggle=0)
declare y
for y := 0 to num_elements(%BTN_ids) -1
if(%BTN_ids[y] # scroll_id)
%BTN_ids[y] -> value := 0
end if
end for
end if
end function
function icon_scroll(icon_id)
declare y
for y := 0 to num_elements(%icon_ids) -1
if(%icon_ids[y] # icon_id)
%icon_ids[y] -> value := 0
end if
end for
end function
on ui_control(scroll)
for i := 0 to num_elements(%BTN_ids) - 1
position := scroll - MARGIN_POS_Y + PADDING * i
%BTN_ids[i] -> pos_y := position
if(position < MAX_Y or position > $SCROLL_HEIGHT )
%BTN_ids[i] -> hide := HIDE_WHOLE_CONTROL
else
%BTN_ids[i] -> hide := HIDE_PART_NOTHING
end if
inc(position)
end for
for i := 0 to num_elements(%icon_ids) - 1
position := scroll - MARGIN_POS_Y + PADDING * i
%icon_ids[i] -> pos_y := position
if(position < MAX_Y or position > $SCROLL_HEIGHT )
%icon_ids[i] -> hide := HIDE_WHOLE_CONTROL
else
%icon_ids[i] -> hide := HIDE_PART_NOTHING
end if
inc(position)
end for
for i := 0 to num_elements(%Sayidegeri) - 1
position := scroll - MARGIN_POS_Y + PADDING * i
%Sayidegeri[i] -> pos_y := position
if(position < MAX_Y or position > $SCROLL_HEIGHT )
%Sayidegeri[i] -> hide := HIDE_WHOLE_CONTROL
else
%Sayidegeri[i] -> hide := HIDE_PART_NOTHING
end if
inc(position)
end for
end on
function switch_sfx_effect(switch_id)
declare $i
for $i := 0 to num_elements (%ids) -1
if (%ids[$i] # switch_id)
%ids[$i] -> VALUE := 0
end if
end for
end function
on ui_control(glides)
switch_sfx_effect(get_ui_id(glides))
end on
on ui_control(byhsnk)
switch_sfx_effect(get_ui_id(byhsnk))
end on
on ui_control(legato)
switch_sfx_effect(get_ui_id(legato))
end on
|