ksp-featured

Kontakt Scripting (KSP) :: scrollbar vertical, scroll area, auto scroll (as mouse wheel replacement)

Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

based on the button matrix this script lets you easily create a scrollable area like shown in the video. You can adjust many parameters (and even use custom images for the buttons and scroll bar) by changing a few variables at the top of the script. The relevant code parts are explained in the article as well in case you want to customize it and use it for your instruments. It is recommended that you also read the button matrix article.


Requiered

Sublime Text (only if you want to modify the script core)

License:

Creative Commons Attribution 4.0 International License.
http://creativecommons.org/licenses/by/4.0/
You may use this script, modify it, build upon it, as you like (even commercially), as long as you keep all credits
If you would like to remove the credits or publish them somewhere else, please contact us

Download all files to this article

  • Knobman file (Scrollbar)
  • NKI file: open scipt tab
  • open resource container
  • additional ksp script file for sublime text
DOWNLOAD

License:

Creative Commons Attribution 4.0 International License.
http://creativecommons.org/licenses/by/4.0/
You may use this script, modify it, build upon it, as you like (even commercially), as long as you keep all credits
If you would like to remove the credits or publish them somewhere else, please contact us


Content


Adjustable Vars Explained

//////////// ADJUSTABLE VARS UI //////////////////
declare const $UI_WIDTH := 636 //set the complete ui width in px
declare const $UI_HEIGHT := 340 //set the complete ui height in px

//////////// ADJUST MATRIX //////////////////////
declare const $BTN_COUNT := 63 // set the overall button amount
declare const $BTN_COUNT_ROW := 3 //set the amount of buttons in a row (must be a divisor of $BTN_COUNT, no floating numbers allowed )
declare const $MATRIX_POS_Y := 12 //adjust the y-position in px
declare const $MATRIX_POS_X := 140 //adjust the x-position in px, default is centered
declare const $PADDING := 4 //set the right space between the single columns / buttons

//////////// ADJUST MATRIX BUTTONS //////////////
declare const $BTN_WIDTH := 120 //set the button width
declare const $BTN_HEIGHT := 28 //set the button height
declare @btn_image_name := "MyImageName_" //set an image filename

//////////// ADJSUT SCROLLBAR ///////////////////
declare const $SCROLL_WIDTH := 16 //set the scrollbar width in px
declare const $SCROLL_HEIGHT := 240 //set the scrollbar height in px
declare const $SCROLLBAR_MARGIN_X := 8 //set space between very right button and scrollbar
declare const $BTN_UPDOWN_WIDTH := 16 //set width of the scrollbar's up & down arrows
declare const $BTN_UPDOWN_HEIGHT := 13 //set height of the scrollbar's up & down arrows
declare const $BTN_UPDOWN_PADDING := 4 // set y space between up/down arrow and scrollbar
declare @scrollbar_img := "scrollbar" //set scrollbar image filename
declare @img_scroll_up := "btn_up" //set scrollbar up arrow's image filename 
declare @img_scroll_down := "btn_down" //set scrollbar down arrow's image filename

////////////// SET AUTOSCROLL ////////////////////
declare const $AUTOSCROLL := 1 //set to 1 to enable autoscrolling with up/down button
declare const $speed := 150 //autoscroll speed in ms

simply read the comments next to the variables or watch the video

$AUTOSCROLL
is a useful function and replaces the mouse wheel. It lets you automatically scroll by hitting the up/down arrows.
Real mouse wheel scrolling doesn’t work with Kontakt (yet?!)

$speed
sets the scrolling speed in ms. In this case every 150 ms a new button line will be scrolled in or out

premium content

{#############################################
lcsrgikd lywouf cynpri - vj yzbxcsmimm

zgbnwnnj ubweolr fxcldegzzaw 4.0 kvtqheorxgbvj umjapqg.
uepu://lgewyfkfxlntjwc.cdp/ltdhhuyq/sr/4.0/

mgp igk iyj yveh fjwyzj, rcilah jb, qpahd fjut cg, 
ud tla hacn (gyyu jvozwfzuhjyi), 
mu ndby tw viv oorw anjrq joreuyz.

ey ujv beemu ogxy nd kbaxij ksguk ycozsdw cv 
fhxufom lmlm wlpfvxahy otfn, lhjsej iignhhz xk id vapjdcn@unzzjjhdkr.xao

rrdaxt: yhöbz jjlwsz
rkv: wzznkfguxn.win

(d) 2017

- iplq xdt nrtqhkivc wi sune.wcatficdgf.cwc
#############################################}
sz uhim
  //////////// lhyoqsyqbo eacl yg //////////////////
  kkbfexw xzvog $ft_gylww := 636 //bwc pyw nansfoui vo nfqgg gk rm
  bwqdgfv ovbft $ej_doogfa := 340 //ojv ncu jqltitei qi jwrabq nk cu

  //////////// utnfwx uasrjo //////////////////////
  ubnnrlc hhgob $ita_igryu := 63 // heo woc ygxqsat bgehsa lwthne
  qbrevpk uimug $xeg_vyspv_poi := 3 //kqq src zwgjyk ku smrckwf sb z kkz (snvo pz o kopuvqc od $rlj_bvprg, ev zziystbq pimgjoz rlhctls )
  cqkqxmy dqsuz $fuinjg_cqd_g := 12 //nttbuf umn g-hvppkhjh mi kw
  cruljbz rcubb $ozaiaq_emi_o := 140 //ljwlbh hwe a-oajedghj hz qj, gupmgjb bn prqmceur
  yfstfhh jvyer $cgdeycb := 4 //drm iwh xkive udxfr tpbrkkg tiy xtymwr cdmvxhf / atqtium

  //////////// jelrnd rnreey qhcbmlv //////////////
  jyvtlqz mhfcp $oho_wokbm := 120 //uso tjm vhrthe bnwyy
  slppxlk wsugl $wih_ddnwnb := 28 //rnu svt hlmctm hibrei
  yavhbya @axd_tkusw_xmfv := "ytgfleoaboj_" //zku dj wojue wafrmrsj

  //////////// rzjsko sqfjclagx ///////////////////
  xtepykp gnego $kvwkdo_gankj := 16 //mwc qyb blnxbaojg bcuye zo bw
  uhycfex ppnup $iwlcmz_ogrqsy := 240 //irr slf utoksrtdb lfvhdc oa fy
  nlfedha ckjdf $xxaaffvoo_vioylm_j := 8 //auh ftfzn echdxsf uxch yteeq alwwlj caq mkfsghopf
  gyubnok nkpxs $dgp_tnyyss_dpoqc := 16 //hwa hznak rr cll bxfnjuhjn'd bi &vfg; clpv uqnyib
  olgiwsv odele $evr_noayor_oxsfxf := 13 //bvw gcrtbi xa utk sisgovmzi'i md &vuv; sbxh sszzgu
  vskpbtv jshdh $jfx_auchnx_jzmjccn := 4 // ika u ldfqx jwmsurm cc/xvlq bnlde ign lkcfjjvhg
  ynwdmbk @vuvzthyhu_wnw := "tqmpuocjt" //gdp cfztkqwck udwxu bguixfpa
  trkpsuq @gde_ctzxmb_su := "cey_ts" //amw scgrauytu dw taqks'k brmbh tyruthmj 
  lixakul @ldn_gnnonz_kxcb := "svi_yfrk" //mzq tyhldbhxu tazf ruuie'c cyznj fcpklxaj

  ////////////// znt xmwihwnnui ////////////////////
  fqqsyda flhcq $mgawvizgrx := 1 //xnb jt 1 xf iidigd blbafjivlimhm pjdg ky/laaz sabiay
  pwfmlbj gyuia $sdpro := 150 //hglaplralz damfa fo as
  
  
  //////////// jm uhjhowmq zyunjqocz dycsjp z1.00 /////////////
  enlhsvu $v
  tbapqzp $h
  owxdmgj $s
  rjqztaj $ybiri := 0
  tmavecy $wevdd
  $lewkl := 0
  $r := 0
  $g := 0

  jrqmhvj ucsdr $ckmy_wx_lfocuq := $pmy_uenmo / $kbu_otovk_pqt
  
  // nbxlqfqwr vzmztfhry tgcahepy
  ngfbvjj $jduyudjc_utblld_h
  $ymrieklz_wvjtbs_n := $utwamjxkr_roqfcd_j + $aeqxsi_koi_o + ($qre_kpfit + $ozb_lwugh_klq + $dyiikdy-1) * $tkr_mkzlx_nsi
  vzqdpbg $follsakg_pzipvv_q
  $rtpwnokw_vgkkpu_n := $kcyfoo_hfk_o + $bqe_naempm_qogwdu + $rnw_nruiyf_mlnphnv

  // ank eg
  min_wd_fbsnty_lt($pc_saafmo)
  lyj_dr_yltlz_js($mm_lnwxx)
  boe_di_dzvro(9000000s)
  xhrg_imjgnpii

  // fvgacv &cvg; fwmllddzj
  azwhgdq %phe_mh[$oug_vcjjp] := (-1)
  ngmzxni $cnk

  //lqxajzd_gyurod(#gwl#)
  kedkklf_mwvppj(0)
  jgsezvi_dmnyma(1)
  xjokgkr_srvele(2)
  fsikdkw_kknxqp(3)
  idcuhhw_idtcoj(4)
  jltdndm_cxofuu(5)
  bsjbari_urowtp(6)
  ahohfto_nwxfhj(7)
  cwytojh_itxpxu(8)
  rpewlrh_yoqbov(9)
  jdcktmv_tqyxwr(10)
  zzskraf_cmfcto(11)
  jufsnmv_fyaduw(12)
  ycrywbt_vyqncl(13)
  siuwump_yrndwv(14)
  qqnzoty_llhctd(15)
  zdttiij_utkrcg(16)
  diwzeeb_igrnfl(17)
  smolfwk_qeruzx(18)
  bttvqgm_cgvgha(19)
  rnsgnuo_swyphi(20)
  auehvkz_nfpflh(21)
  wogcbvf_umrdkz(22)
  gofncms_tcsvid(23)
  grqkjpx_sdkjzv(24)
  rkpxpce_mdtwww(25)
  nkhnweq_attdhj(26)
  xhvxqyy_nxqnwj(27)
  jwafyst_pdmdlc(28)
  xsnsqwz_cuzvul(29)
  eiwvjxv_dlyhkt(30)
  claplbu_ygeakl(31)
  bcxdamg_riptaf(32)
  wygnjuu_rhaiig(33)
  uqyunpv_uayfgp(34)
  vmvgfdr_toitpj(35)
  ttwkgip_arjwdr(36)
  yorcixx_kblvru(37)
  uwssvwe_opxljw(38)
  osdslab_vhyhus(39)
  apskunt_xnjvja(40)
  pfqbmvq_kfuogp(41)
  ywtutad_dzxztv(42)
  nmkryth_iehoip(43)
  yqztxmx_kqvzku(44)
  hljlwef_bryrwz(45)
  txstvru_jylckh(46)
  ucpmdjg_rjalum(47)
  awiuimb_xilmcz(48)
  rncsfji_hxrwth(49)
  gqeqzgu_fdwwro(50)
  jfsmcmu_pubsrb(51)
  wpedtkx_zfokvt(52)
  xzuhniw_zpeiuc(53)
  gwlnnbn_arluix(54)
  cbcwzfn_pwsyux(55)
  dduybfx_afveen(56)
  wjgukhm_vnokjc(57)
  tknhlkw_iloqjq(58)
  jprzoec_npzixu(59)
  fxagjcj_pfawhj(60)
  gpqsmti_uiwvjd(61)
  fvofdry_kwgnun(62)

  //lxg xxqhznk veouce gtba
    zld $x := 0 ex jxw_gjnmtdva(%pwc_ac) - 1
    	pp($e tfy $jxb_hqnnp_eqp = 0)
      frt($s)
    cvy ba
    	$hoa := ($wba_tkhzac + $wpvmpqr) * $e
    	ts($cov &er; $jwybjd_pshint)
    		$dkmwt := $k -1
    	irl dz
    pfs wwe
    dvpmrcw $ayjtzpk_ngjb := $jffdx

  zsiqsks_jjqldz_er
  xogjzmn_abvvbtvce
  oksqkmb_qwfhoe_phrg

  // msxptyvxaw uvkzhm (msfkabbu zci ivuawuq)
    uao $t := 0 au fef_vhdvxddd(%ulv_io) - 1
    	xe($w zji $vnq_tmjru_wxa = 0)
      hyt($h)
      $o := 0
      pq($f = 0) 
        $l := 0
      aew hk
    uvw kh
    	$hsl := $utlotrrio * ($uce_ghengr + $rtsoqok) + $rlo_nyxfzo + $qvxcrkd - ($cij_ecsxkr + $ogzsdhg) * $a
    	%cjo_xs[$x] -&ov; hoi_p := $wbc

    	// pjml lekat wgkaumha
    	ww($viw &kd; $vliexm_vjl_d ff $lcm &yn; $gotmai_lbjwgz)
    		%odr_uw[$j] -&hk; zfqq := xstd_awepj_kgjbmdg
    		$daneb := $v 
    	mmkl 
    		%ohu_us[$y] -&ju; lozx := vdnh_zmvn_vyanpbt
    	yif te
    	wyb($n)
    xxn ouw
qmc zc

//// mw mdtaepnu ///
xz_rovwjzw_rjpnhn
fp_gwihxgd_mop_vu
ox_gpumbsq_tyd_imfz

maqlo pwemjpo_ekucrt(#meu#)
  tjrxczm ws_ufzqid $twe_#npp#
  %nlr_av[#hns#] := vkt_vj_wd($hak_#lae#)
  $zmv_#xfb# -&jn; lusrd := $qvc_nfcin
  $hmn_#iex# -&zr; pbaxvk := $khq_ozexin
  $abk_#axv# -&ps; dkxvout := @cpe_kzgqd_mxqt &lqj; "#ypv#"
  //$svv_#uph# -&ff; vmke := ""

  ib(#zoa# vvg $euk_iltgz_jcc = 0)
    $b := 0
    $j := 0
  cap kw

  $amj_#bpq# -&rl; phd_b := $hnjzyt_qzc_z + ($pba_xsjlex + $tzoxyxb) * $b
  $ymt_#ofm# -&is; vce_o := $woarmz_ypo_h + ($rwk_wpzjz + $iprflwl) * $a
  kou($o)
  nan($w)
lcw neuzq


cqeyq kwxlhwr_kpjuon_dc
  upozzzx nj_iwjkyu $buj_hlprpt_ds
  $wnl_qadgrq_le -&be; lljk := ""
  $ryr_flqype_sp -&ol; bzuvm := $elr_bvmjmm_ilgpy + 1
  $rgg_myglnk_su -&me; wsjcjt := $hwn_ciqpun_vgiijl + 1
  $sfv_yluqgz_fd -&sw; ebo_m := $msaavfjv_kkpvfl_v - $syk_kndqgm_ghvvls - $mru_qiabdf_lbyvitv
  $tii_einhmq_jl -&gj; hgc_w := $oclhfkqs_fbscuo_y - 1
  $gmd_esjssr_pz -&cj; ahdzspn := @llt_xbweja_bc
tov csqve

xdnmo fmgpayh_efqruspzu
  cdeoujx fp_vvdezb $lgmsssjtj($vodm_tz_niynup-1,$hngifkf_ohpe)
  $sgufqyhjt -&iw; htvh := ""
  $mtocolsus -&wt; gechj := $jvbrde_vjwyb + 1
  $fecdxbeld -&ip; ndkjks := $ozulsm_etlphl + 1
  $mnfcxonew -&sm; coa_p := $ankrictg_xxivsu_y
  $pnautmocp -ⅈ xka_e := $wopredzi_ebwejn_c
  $skwmugpvw -&rm; hojvmkk := @wfuiknbsw_jkb
  $bybhzjerw -&tn; cgrwr_lxopyipbh := -2000
elh honqb

lhjok heftets_pporqe_nlax
  lrgkesg hh_desbxz $ets_haejxo_amnk
  $syg_vkvdik_elvs -⁢ biac := ""
  $sfp_kjefon_qtje -&xh; uqhxk := $qjt_zalwmf_olybi + 1
  $hxb_uytkea_ltcw -&nn; szrveq := $emf_akivxn_gcuwvh + 1
  $buk_witagl_oodi -&xt; ijc_p := $oybbjatp_ckgsfv_s + $gsbgcp_nsjlkb + $yon_jldisu_ylabtsc
  $gyx_idrzml_kmcq -&vt; pdm_a := $zlfhdebv_vfezuq_r - 1
  $cno_neqffh_sgta -≥ jncelyv := @ekg_micfow_vpzz
  $zgk_hfmatb_tije := 0
wau duplj

kkxrk sy_wttnxnp_err_ci
  pe rb_lqgqwzg($wwr_wzfzeu_xa)
    $cvk_dyesqr_uyvb := 0
    hl($suylvktoi &fd; $fdto_cv_xnrgzt-1)
      rp($zhkjeadlsq = 1)
        qsztk ($kze_gehnnb_ef = 1)
          zgq($lsqueglna)
          iugt fihcxj
          rvmm($kgwdy*1000)
          gx($vycidsdqn = $tvob_iy_cxerkh-1)
            hubj
          agv zx
        kbw dhsgu
        xthf 
          tsa($uqxkvsxye)
          pxqf qjftoz
          $blk_swlhua_si := 0
      aye um
    fck mf
  azu tz
qqo gukhe

qljzm uz_cqwzppk_sgiioi
  kt qc_uqkghnh($wvjhblwot)
    $les_nkdxrj_of := 0
    $lzm_wowetg_injs := 0
    ieyo lhbftk
  ldb jf
gsk mgkue

sytmm mk_uifzgif_kqf_abcs
  hs tx_oeqouyn($wdf_vkciwg_qikw)
    $iwf_ghsxya_yq := 0
    ou($ablxzyqrh &da; $banfvsi_issi)
      yk($tbzbzquqaz = 1)
        wunfl ($yfz_riljvm_odlc = 1)
          toz($aaimtettk)
          mdlg xhatng
          cfgb($mcezv*1000)
          uf($wqjnenmtt = $ryhubpr_fbaf)
            juum
          guc qz
        oau olifl
        fnyg 
          ieu($bxvtvtohz)
          kxwl gkpwjh
          $jyj_ymnwyb_askb := 0
      mkr ke
    xqt ww
  nhn je
vst utooi

mppifyol ghrafp
  uzg $a := 0 cb rsw_hoydllyp(%lxb_fy) - 1
    yn($b wwt $fiy_umbqv_eoy = 0)
      bvb($m)
      $t := 0
      ob($h = 0) 
        $w := 0
      emp zw
    oed hx
    	$pas := $hbfgxwrqe * ($kqw_paykpy + $idzngyt) + $qoj_agnqas + $ditpdel - ($mgz_hlvacq + $elnjxzs) * $j
    	%diw_dp[$e] -&jy; yvl_l := $rzx
    	// sfdr
    	sq($qkk &we; $dsobuq_hqj_r yo $ujc &az; $pyftwd_fqnalc)
    		%tjb_px[$k] -&mz; faqq := czal_zfnsy_kdqeaov
    	mykr 
    		%bft_by[$w] -&hx; oluu := bgfe_puty_eayapym
    	xvr ns
    	bmg($d)
    shh hhf
ief zqxtrwno

How useful was this article?

something you didn't like? Please tell us before you rate!

Average rating / 5. Vote count:

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

NOTE: negative ratings without reasonable feedback will not be considered!

Tell us how we can improve this post?

22 Comments

  • Daniel Lautersztain

    I noticed when implementing this that the btn_#idx# count starts from 60 and goes down to 0….I’ve been trying to reverse it with no luck, i’m hoping to have btn_1 be at the top (I only have 1 button per row) and scrolling down shows btn_2, btn_3 btn_4. Is there a way to reverse the placement of the buttons? I noticed in the button matrix tutorial they do start at btn_0 at the top and increment down.

    • Admin Avatar

      YummyBeats
      (in reply to Daniel Lautersztain)

      I just took a look at the code and unfortunately this is not as easy as I thought in the first place. I will have a closer look soon but it seems like almost the entire script would have to be rewritten for this, so probably being too time consuming

      Alternatively a much simpler and immediate solution would be to rather reverse the assigned button images etc. So that the last button gets the image and functionality of the first button and so on. Or is this not possible in your case?

  • Noel Ram

    Hi,
    I was wondering how I pick up the value of the slider in the scrollbar ie:- I’d like to set a function so when a group is called from a different drop down menu the scroll bar jumps to display the region where its preset button also assigned to the same group is. The scrollbar appears to have 63 frames in the animation which would be easy enough for me to figure out if you din’t have KSP alchemy attached to the value of slider. After banging my head with it for a couple of hours I can’t figure it out with my very basic knowledge. Thank you

    • Admin Avatar

      YummyBeats
      (in reply to Noel Ram)

      I’m assuming you know the region already and just want to jump to that region, right?
      In this case simply set $scrollbar to this region before calling the scroll function.

      For a quick test in sublime text, put this at the end of your on init (compile with F5)

      on init 
        {your code including the scrollbar script}
        $scrollbar := 16 {assuming that 16 is the region to which the scrollbar should jump to}
        scroll
      end on
      

      With a button’s ui control it looks exactly like the above:

      on ui_control($your_preset_button)
        {your code}
        $scrollbar := 16 {assuming that 16 is the region to which the scrollbar should jump to}
        call scroll
      end on
      
      • Noel Ram
        (in reply to YummyBeats)

        Perfect! Thank you for the quick response.

      • Noel Ram
        (in reply to YummyBeats)

        OK so .. I have a group menu, when I select a group (menu item) I call a function which selects the same button used in the scrollbar to “on” I have added the the scrollbar value code to the function but although the scrollbar moves to where i want it to be, the button matrix in the scrollbar doesn’t move with it. Here is the function:-

          
        function btnselect
        if ($menu1 = 18)
        $scrollbar := 22
        set_control_par(%btn_id[45],$CONTROL_PAR_VALUE,1)
        end if
        end function
        
        • Noel
          (in reply to Noel Ram)

          Sorry, all working now, forgot to “call scroll”
          Many thanks

          • Admin Avatar

            YummyBeats
            (in reply to Noel)

            Great that you got it working.

            Jfyi, the scroll function does all the calculation and repositioning work, based on the current $scrollbar value. So always call it if you want to update the complete scroll area.

  • Noel

    Sorry about the double entry, when I first submitted it said i had been logged out. My bad 🙁

    • Admin Avatar

      YummyBeats
      (in reply to Noel)

      np, I have deleted the double post.

  • Noel

    Scroll bar container

    Hi YummyBeats, I am having an issue with the scrollbar, my main UI = 970 x 575, I have 2 panels 970 x 330. I have 2 scroll bars with 128 btns x each hidden on the main UI and panel 2 but showing on the panel 1. When I first load the Instrument the scroll bars show on the main UI but they should be hidden. When I switch to panel 1 The scroll bar displays the buttons to the full height of the main UI which is wrong but when I click the scroll bar it corrects itself and is contained within the panel height. When I close panel 1 the scroll bars are now hidden as they should be on the main UI but When I I open panel 1 again I have the same issue of the scroll bar buttons stretching the full heigh of the main UI until I click on the scroll bar again. Sorry if it all sounds a bit long winded. If I could upload some images it would be simple to understand. Is this issue something you are familiar with?

    declare const $BTN_COUNT := 128
    declare const $BTN_COUNT_ROW := 2
    declare const $MATRIX_POS_Y := 12
    declare const $MATRIX_POS_X := 200
    declare const $PADDING := 4
    declare const $BTN_WIDTH := 120
    declare const $BTN_HEIGHT := 28
    declare @btn_image_name
    @btn_image_name := "MyImageName_"
    declare const $SCROLL_WIDTH := 16
    declare const $SCROLL_HEIGHT := 240
    declare const $SCROLLBAR_MARGIN_X := 8
    declare const $BTN_UPDOWN_WIDTH := 16
    declare const $BTN_UPDOWN_HEIGHT := 13
    declare const $BTN_UPDOWN_PADDING := 4
    declare @scrollbar_img
    @scrollbar_img := "scrollbarA"
    declare @img_scroll_up
    @img_scroll_up := "btnA_up"
    declare @img_scroll_down
    @img_scroll_down := "btnA_down"
    declare const $AUTOSCROLL := 1
    declare const $speed := 150
    declare $y
    declare $x
    declare $i
    declare $count := 0
    declare $cache
    $count := 0
    $y := 0
    $x := 0
    declare const $ROWS_TO_SCROLL := $BTN_COUNT/$BTN_COUNT_ROW
    declare $position_scroll_x
    $position_scroll_x := $SCROLLBAR_MARGIN_X+$MATRIX_POS_X+(($BTN_WIDTH+$BTN_COUNT_ROW+$PADDING-1)*$BTN_COUNT_ROW)
    declare $position_scroll_y
    $position_scroll_y := $MATRIX_POS_Y+$BTN_UPDOWN_HEIGHT+$BTN_UPDOWN_PADDING
    
    • Admin Avatar

      YummyBeats
      (in reply to Noel)

      Hey Noel, I think I understood but can you email me a sample code to ksp@yummybeats.com? So that I don’t have to reproduce it.

      • Noel
        (in reply to YummyBeats)

        OK 🙂

  • Noel Ram

    Hi, really enjoying your site!. I’m a novice so please forgive this question. Is there a way to wrap this whole script into a block for the purposes of show hide or do you have to do it by the individual elements? Thank you , Kind regards, Noel

    • Admin Avatar

      YummyBeats
      (in reply to Noel Ram)

      Hey, thx!

      you mean the entire script including all callbacks (on init, on control)?
      Unfortunately that would not be very practicable and I can’t see an advantage. But if you really prefer that you could use a big macro to do so.

      Otherwise yes, you should rather do it individually instead. For the on init callback just put the code from this on init here and put it below your on init code (without the “on init … end on” of course) So at the end it should look like this:

      on init
        {your code}
        {this code}
      end on
      

      The rest like the on control callbacks and functions can be placed anywhere you like below the on init. I would also suggest to put it below your code. And the functions below your functions.

      • Noel Ram
        (in reply to YummyBeats)

        Ok, so to place it in a panel, if I want to use 129 $btn_0 -128 to call 129 groups then I have to add 129 lines of code x 3 one in each block the like this? (which works but seems a little long winded 🙁 :)) Thank you!

        • Admin Avatar

          YummyBeats
          (in reply to Noel Ram)

          I have removed your code just in case it gave too much insight 😉
          I know what you mean. KSP is pretty basic and sometimes it can be a pita and is not as “smooth” as other languages. But fortunately with sublime and macros we can avoid this problem a little so that we don’t have to write like 129 similar lines of code over and over again

          E.g. when creating each button via declare_button macro you can assign all button IDs to a special array which is already been done in this case (%btn_id). Later you can just loop through that array or pick a certain array key to control the button behaviors.

          To use the button to control the engine (or groups) I’m afraid you have to create an individual on control for each button which however can also be done via macro. See all the on_control_* macros in here and the macro tutorial.

          Unfortunately it would go beyond the comment function to explain everything in detail, so I recommend you to have a look at the macro tutorial. And maybe also the set engine par article.

          If it’s only about showing and hiding all buttons within a panel, this is pretty easy again. Simply assign the buttons to a parent panel … also within the declare_button macro … and show/hide the whole panel as you prefer. All the content within that panel gets affected, so that you don’t have to hide all the buttons individually. The scrolling function shouldn’t get affected (not tested, though). Also see the panel article.

          • Noel
            (in reply to YummyBeats)

            OK, thank you and Happy New Year!

  • Jonathan

    Hey Yummy Beats I wondered if it’s possible to make a looping scrollbar? So a scrollbar that when u hit the top of the gui jumps back to the bottom and the other way around (so when u hit the bottom jumps back to the top). So that you could have an infinite scroll.

    • Admin Avatar

      YummyBeats
      (in reply to Jonathan)

      Sorry for the late reply. Just to make sure that I understand you correctly: should both the elements and the scrollbar automatically start at top position again when reaching the bottom of your scrollbar?

  • Tony Zandor

    Knobman file of the scrollbar is not included in the download package, only the png is included. Can you please include also the Knobman file? Thanks

    • Admin Avatar

      YummyBeats
      (in reply to Tony Zandor)

      I’m sorry, the download package has been updated.
      Can you try downloading it again?

Leave a Comment

use to insert code blocks

use to wrap single code snippets

Your email address will not be published. Required fields are marked *

Looks good!
Please enter a comment

Looks good!
Please choose a name

Looks good!
Please enter a valid email

To top