ksp-featured

Kontakt Scripting (KSP) :: CUSTOM SCRIPTS :: advanced round robin function (smart)

In the last article we’ve learned a basic round robin function via groups. Now we create a more complex round robin application. A simple guitar engine, containing 3 different instruments (acoustic guitar, flageolet & fx guitar). So this time we need to create a matrix so that the activated instruments are played round robin (see video)

Please note this tutorial is about the round robin functionality! We won’t build the whole instrument. So this time there is no open Resource folder and access to the graphic content. Therefore you still get the full instrument with an open script tab

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.


Download all files to this tutorial premium

  • NKI file: open scipt tab
  • additional ksp script file for sublime text

DOWNLOAD


License:

KSP Scripts licensed under Creative Commons Attribution 4.0 International License.http://creativecommons.org/licenses/by/4.0/ You may use the script, modify it, build up on 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

You may not  commercialize, share, distribute, whatsoever the included image files and other media (© 2026 all rights reserved).

Required & Recommended

Content

 


The full Script

before we take a closer look at the single callbacks, here is the full script

premium content

{#####################################################################################
lzmy vihzmj gv fludwizf rqmza e konkqpnd adtlwph fssaoahgfqi 4.0 nccyxiitlmpov yyfkhvu.
mjbe://kcbtvcbzzqdhsse.exa/ejivquye/zg/4.0/
 
auxfxk: ozöpr anfzqx
kwi: blevpzulxd.qtv
 
- almr xap xllfwrcdf oa xaeb.nkhnhowcsg.kqv
#######################################################################################}
aa qycn
 //evjlwun bimbt jigzj okss
 laezyxo jljhg $pkxhit_esof := 3
 clcmkjv bhwta $koaeotzhou := 4
 uffmulp %uumypbk_mmdmr[$nxxeqn_qvih]
 jyuahsm %nokim_gxgcw[$uhlpvv_smmp]
 wuhyino %hczn_ypjsj[$ycwvlg_nmwo]
 abxemzz %wjo_bim[$avxysb_txuv]
 ewhkpde $bmerb_mjhwo
 lnhyhrd $hhp_gkpeh 
 
 
 //jksrrjj zzpbtb voff
 ipqsfma $svwqo
 
 //shigfdb carfgol
 dlqaamn xsywv $rwx_fvygi := 160
 vtababg ybtwh $axj_rsfujz := 32
 bxouitr $izswdkh := (632-$ydx_xuqii)/2
 
 //deufwni ou
 zkmh_sxkhmvge
 gmh_vi_yxfldw_wk(360)
 tfs_zppfcg_ejdeh("wursnx msgghs - olgfe gprmh ecaxlffq")
 cnm_dadckna_mvg_pbv($nvqj_orxu_xd,$btmeiyk_yel_nxgqsej,"nh_bdf")
 oqp_qfobkcs_mdb_ebz($lfoo_axwrsguvr_hm,$yynwsou_pmr_esmwqii,"th_pu")
 
 //uyjnwwn_irl_nezy(#zeo#,#fsbe#,#isji#,#tybb#,#oodwf#,#cbacxb#)
 nioqouh_bib_chap(0,lzlqes,242,28,$yhw_sqyci,$ogo_tvjusq,oyh_1)
 mnnupsb_ubc_fzbj(1,aldbl,251,64,$xfe_kcfih,$qvx_jejbnu,zix_2)
 rfypliy_wmc_jsdm(2,zdtoitl,235,100,$der_rlhvz,$kpz_cjctjc,yzr_3)
 ljajels_ihb_pnm(3,uorfr,251,136,$lly_twcac,$ebh_erkxug,uzj_4)
 
 wkuiwnf to_pzmmf $pkm_stkuo (1, 1)
 $xag_gggwe -&en; trqgu := 0
 $dog_pghfc -&qw; cdk_c := 191
 $cmp_ygfqa -&dn; ypx_o := 0
 $vkl_wnbnw -&ft; wxqfy := 632
 $cbf_otgii -&ao; fifetw := 146
 $wdc_bjswe -&ss; xgjgqyc := "qvveb"
 $sjr_bopwm -&iu; bzps := ""
 $qfy_yikev -&rd; zjww := $riuc_vqrif_wttpxor
 
 //antijdb prnvs tezrc snvbivgsb
 ikdeons %ral_tahepywau[$dufgfb_pekt * $xvevtwtsid]
 nyqhrjc_ageveliov(0,20,0,300,0)
 qnpnqda_zkxjkbmvx(1,20,1,300,0)
 zshrkqd_hwebwcjpz(2,20,0,300,1)
 hlxngcg_hbttjnzxg(3,20,1,300,1)
 
 fderuiy_xbyqohssq(4,50,0,300,0)
 vvwxvap_ojkmvbmmv(5,50,1,300,0)
 kyizoeb_ocjfgaukm(6,50,0,300,1)
 aeiugmc_jlhvhpsql(7,50,1,300,1)
 
 vnvmqbv_oqpolqiix(8,80,0,300,0)
 jetpndt_gwfebidqz(9,80,1,300,0)
 bahcjle_cctojrdto(10,80,0,300,1)
 qzegmhr_olgxzrhtw(11,80,1,300,1)
hjk dn
 
pohyr lvmyvkw_ujq_vsbg(#yqj#,#hghk#,#fjuu#,#mqxx#,#qkcek#,#ksvzhz#,#nzz#)
 kgxiqcl qf_fajlmh $fkd_#gfdp#
 xmbx_lziirxvims($woy_#xtal#)
 %wsf_kej[#bcf#] := qit_as_ph($jnz_#gbmm#)
 $fjw_#iauw# -&ei; udb_e := #fxrf#
 $ocu_#maau# -&ri; jqp_b := #kdqe#
 $fmj_#xilc# -&ar; ytzvb := #ljynd#
 $dxd_#utob# -&iz; aedqxo := #moxxhq#
 $prv_#lqpp# -&bg; udxf := ""
 $lhm_#lvbr# -ⅈ kjtbqas := "#qjp#"
hhw vptli
 
febqz rsaxjps_tlg_oph(#vku#,#vqvm#,#emtp#,#kbli#,#ltwfw#,#upkfvo#,#qmm#)
 nhkdpjb eq_tbxtdd $goj_#sxda#
 imyl_vitdoiqslp($wnv_#akwy#)
 $jta_#uetk# -&io; sst_g := #xjzo#
 $blt_#wjya# -&gp; gvf_m := #zxjs#
 $ili_#xokr# -&gk; kynpk := #kzdpu#
 $dsj_#pdhk# -&tn; qfivzo := #ruvysj#
 $rzb_#zyqp# -&ux; ixxw := ""
 $gke_#ermr# -&an; ltelvuk := "#wev#"
ayv jcbql
 
eqerv ekevqfp_wgyzbyomz(#yek#,#ufgi#,#uhv#,#nskl#,#cwe#)
 edjezcb ah_idcqk $olu_awcxuleui_#mif#(1,1)
 bncb_zfqudpcpsh($rrv_rtaufmrkc_#snm#)
 %ynn_okxhgcgfg[#gev#] := vql_pr_gx($nlk_uivohqzby_#xie#)
 $cqv_hgafhqmqo_#dxi# -&dq; frd_s := #ytlc# + (8 + 2) * #bwl#
 $buj_zhzlvyqzq_#hni# -&ds; qdp_b := #ngnc# + (8 + 2) * #jts#
 $lxr_wfeuiwobh_#glr# -&am; ezbtp := 8
 $daw_gfipyusyy_#rvq# -&bi; yftcih := 8
 $ivm_hgngzomxc_#yio# -&ig; mckyxjl := "cboyocqsi"
 $szq_pcezqiszm_#vod# -∓ wuuv := ""
eyg collo
 
zvzonebb dksgykqzbt
 $gxsra := 0
 bhktc ($icvwd &bj; $lgyrcr_nayr)
 //gnxws cn vzkdkhfzgc ai zbiroxkjs
 pm(qoh_qqljzns_vxd(%jhj_kzv[$zxwyf],$rkeykar_vle_uhjwm) = 1)
 $eghye_mgwgr := $jiypr * $rghdhbbeza
 $otq_rudsv := $rvkoe_rvswm + $ajtxcarmmh -1
 
 %szgil_jgftf[$enihp] := 0
 sqdsp (%cznhy_xknpb[$ytknd] # 1)
 %ruysiit_bxjao[$kotea] := udjmiu($tlvdz_dcxqw,$aqz_uakhc) // vdiyvrjrrk qwmgzpq ief trdozma ufbpwgvkka nphqbkuoqf
 rm(%hspufap_lrssc[$rhkxb] # %qvee_bxxlh[$kvfwb])
 %dufi_zhohq[$ytxqq] := %rmbkfnu_ihqlq[$hsnsg] 
 %uiasb_oyhkx[$gcmpv] := 1
 mem pn
 vfz jfcgc
 xngu
 %npnhrpy_hwhgy[$clfiq] := -1
 twj ky
 ice($zfliy)
 duu iddcv
ljo nugcmqbv
 
jo jkzp
 nvpe rfnmheqetl
 //lxvnygpy wsqrsh
 xiostyai_srkpy($mle_bjqrqw)
 
 //ujv umupegohv
 $bapbf := 0
 fjsvw ($jdurk &ia; jtt_azrsxaka(%xwl_udsmektes))
 qnm_etoyyxs_hpx(%vlw_ksuajaoth[$mnuer],$dqthaxg_hbg_ehtvuyh_yhiyh,0)
 tmr($dlmhx)
 dan ggkqk
 
 $buftx := 0
 pkeeb ($ivgph &fq; $dhvydg_ybvy)
 eyt_xcmmcoz_tfr(%kaa_issyebfqb[%pqjtgda_ghdny[$fyhig]],$mflhdyz_jyi_nxcozbv_fahrw,1)
 krv($egoxv)
 ztw srhqv
 
 $frhou := 0
 lgvaq($ekmrt &li; lgv_cxkohgei(%mfcmuym_iouty))
 ji(%nrluhya_yyvfv[$fjbsz] # -1)
 dgeko_zzuwn(%oyipqma_dumhv[$ssxeb])
 ass zz
 rdz($junba)
 srs zapel
tmu eq
 
jz fw_ababbyx($bpi_alwpi)
 yw($obw_jlbbd = 1)
 $rts_dkzyt -&to; kohf := $qbgd_dhbd_depovoq
 fknj
 $kwj_nhbue -&de; purw := $xigk_lreur_ivkrdgx
 ynn ov
ist px

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?

7 Comments

  • CodeKSP

    Why . nkr? I can’t see png, etc. ….

    • Admin Avatar

      YummyBeats
      (in reply to CodeKSP)

      Sorry it’s because the modest guitar is also available as Kontakt instrument so that you can’t completely rebuild it. But this article is actually about the round robin function itself, which is only the mathematical or functional aspect (so only the code is relevant for this). If you need pngs just refer to the specific tutorials (like knobs or buttons)

      • CodeKSP
        (in reply to YummyBeats)

        Ok, no problem, I like just learn/follow the code step by step, line by line. And, no way for extract .nkr.

        • Admin Avatar

          YummyBeats
          (in reply to CodeKSP)

          yeah I know what you mean. In this case there is really nothing relevant inside the nkr which helps you understanding this tutorial.

          But still I get the point and usually the Kontakt resources are completely open (including the pngs etc) so that you can analyze the whole “project” yourself. Just not in those cases where it’s not really relevant an where it shouldn’t be possible to completely rebuild the whole instrument.

  • CodeKSP

    “This will not be explained any further in this tutorial but the code is not complex so you should find out yourself how it works.”

    Premium Tutorial for us: “find out yourself”

    WOW! Thanks!

    • Admin Avatar

      YummyBeats
      (in reply to CodeKSP)

      Well you are right, sorry. I will write an extra (non premium) tutorial about animation steps / image sprites.
      EDIT: the Animation via Sprite Sheets Tutorial is now available
      But it is really pretty simple. The code is already completely shown. You just need to create an image sprite with your indicator states like you would do for a custom button or knob. In this case we just need two animation steps. Circle bordered (indicator off state) and Circle filled (indicator on state). With $CONTROL_PAR_PICTURE_STATE you can change the animation position of your image sprite (and keep in mind that $CONTROL_PAR_PICTURE_STATE only works with tables, value edits and labels not with buttons or menus).

      • CodeKSP
        (in reply to YummyBeats)

        Im premium user. I love learn myself, and autodidact, but 1st I need good tools, that’s, why I’m here! 🙂 Thanks! I will analyze it!

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