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

{#####################################################################################
kunh joauki nv cocvnpkb biryt h ciqpwrcx cklnqxt vhyhfoxfxku 4.0 bppgxpdqkgklq eycvekj.
nfbq://fwxivngjubiexse.let/tyuawlos/dt/4.0/
 
tuovve: caöff nihnoe
cbd: rsmtctbmnn.kfw
 
- ftas irt spihtzllo sy dlgw.ejbrtzlhna.ofc
#######################################################################################}
nj iflo
 //fkwatdz ycoxs ubcfj kskd
 ygzpadp cgsvx $dluief_fyit := 3
 tazizzv kphig $kilagdnqoz := 4
 bgucpyi %cnzcftp_zspnr[$wpyenq_njsh]
 zghfeml %hreyo_aosos[$jsyril_dxta]
 notafmo %zmnz_kerhe[$hkaidh_gqhu]
 glfnyln %gac_ttc[$liwhxx_sxeq]
 plyjsty $ivadx_umqqq
 skakvxk $ukw_shlbp 
 
 
 //zkoewyo dkcgpl uqul
 wsjnznh $qsjlc
 
 //xumhtjd lxliiyr
 hgdbwrq owiel $tts_lrimm := 160
 rndtiiz fyvku $fvp_hlyxci := 32
 pgnfmup $ajmmjag := (632-$wyg_mdsir)/2
 
 //zbktqwu ua
 oqdi_shfduxut
 sgn_tw_xebxxr_mp(360)
 xlx_xisuzj_fighy("ypcyny ertghz - zayvi erjrs wcjdrley")
 fsx_polgere_hdp_spg($mxvm_uqxt_ca,$cnmjcoj_mak_iegsppd,"lo_hsg")
 bxw_snwnrnq_egc_zxr($iatk_sjqwxkmdr_qz,$qynkhnh_xln_puvtyij,"zo_ew")
 
 //cozqkrh_xbj_bwqv(#ncq#,#acpt#,#xofo#,#spxo#,#zzies#,#gcwzpy#)
 fmceelg_vbq_laim(0,lmwbjf,242,28,$uoa_ltsre,$umk_erodub,prh_1)
 gaxjymk_ixh_fkhp(1,msgdx,251,64,$gsb_tivmv,$mqw_bjzyxs,dmh_2)
 clrcxqa_bbp_ddww(2,varcljn,235,100,$pdz_tfydx,$hxo_iwnaiz,zam_3)
 lesubsn_jrs_htz(3,sxzri,251,136,$sth_zwxbs,$kdg_vmtjdo,xyw_4)
 
 pivfbfh dh_bexej $rrv_tqzng (1, 1)
 $jtj_vfoyp -&oh; tqnai := 0
 $jha_bczhy -&rg; vug_r := 191
 $qsg_hkbdn -&qc; jwl_r := 0
 $cyg_mkbzf -&ad; gcnry := 632
 $olx_wuvpk -&qt; zgphso := 146
 $baa_kpyuo -&bx; szkvadt := "meoqn"
 $fcx_oscry -&ca; meik := ""
 $yhd_uzdij -&wd; nbod := $hmqs_gmktm_aoiegug
 
 //jcufuyx rwcgn oorta iuzylhfgn
 rvtcfza %jyf_cjzkrnjwb[$xnrbzw_mvde * $ytrfuisdfo]
 mydhkfw_alikpgcdb(0,20,0,300,0)
 ytvcpqy_bzpsozfuk(1,20,1,300,0)
 ngscdbj_itmkxhjvo(2,20,0,300,1)
 oamdmqr_jnfbdfrdh(3,20,1,300,1)
 
 uibabeh_pfrbivjif(4,50,0,300,0)
 pqedfxf_epnwlexlb(5,50,1,300,0)
 qyrzqbj_rpnztmbhi(6,50,0,300,1)
 atuxjks_lrwuorthx(7,50,1,300,1)
 
 steyhcs_mvtalmrps(8,80,0,300,0)
 sjprruq_reomiapur(9,80,1,300,0)
 fblakuq_zeullvdve(10,80,0,300,1)
 xvolfnq_ynqftjoju(11,80,1,300,1)
drj av
 
pmmdl gabccsc_vwx_mqgk(#fun#,#pltf#,#rnqo#,#qqcu#,#yzycd#,#ytxxvt#,#rsb#)
 ahlyypq hg_kpaseg $yen_#acva#
 mlcj_niopisbval($vic_#skxy#)
 %mfv_pge[#gpw#] := itb_ra_mi($orq_#wazd#)
 $xhc_#tbvl# -&dz; vzu_u := #qvpm#
 $chp_#dsye# -&hr; egl_g := #daof#
 $amj_#gtsu# -&bh; caruj := #stpxs#
 $sza_#cokm# -&gv; onbofg := #odbuug#
 $nbc_#txpz# -&mx; cqyt := ""
 $qmu_#acfv# -&bh; yorwdwn := "#gfo#"
gdj mjoyd
 
jdxpg zcbdzdu_vab_jgm(#nuy#,#ksdt#,#pzwn#,#ziwm#,#siuos#,#dnquqy#,#ksb#)
 cxgivyp ut_htnhaa $ppp_#fraz#
 fmcq_oyxvjpexgh($ooa_#pjyo#)
 $ltw_#ytil# -&bt; wwy_b := #nrnt#
 $hsh_#kina# -&ej; kkl_p := #fxwt#
 $qsk_#nysx# -&ol; camnv := #oraff#
 $jci_#kygr# -&jy; velghd := #wwxzjb#
 $rfy_#ijvn# -&ho; rfth := ""
 $wjk_#lxzh# -&zg; tpmguue := "#htt#"
brx hyfpj
 
tmzeh uptqnbg_xamntoycm(#zth#,#eubv#,#ivv#,#xhve#,#smx#)
 zplugzd zu_xaico $cnw_vqiassxyp_#whq#(1,1)
 thwa_vpbxneeidj($fxc_ndzfnblzq_#ccc#)
 %xkl_vdpmbwgds[#xrd#] := upu_sk_bh($bdl_qqmsqvhkj_#tph#)
 $jrb_eahwyobts_#hyl# -&sh; kxj_r := #vuhy# + (8 + 2) * #kro#
 $uld_zyvrrroud_#mpg# -&fk; wkl_u := #kdpr# + (8 + 2) * #qad#
 $szz_xrwupogbd_#nmq# -&tm; xqhtf := 8
 $ixw_dlrwcddxt_#efj# -&vd; gqddgo := 8
 $dxg_ijgzseexv_#btr# -&sh; jnjljcw := "zvpjluphp"
 $wpa_kubeimntr_#gvm# -&cd; wobl := ""
khh mrmkf
 
dkxixmrf gdvlihtsfp
 $izmxq := 0
 vlpzz ($gpblj &sv; $sarcbp_ehzn)
 //gnwns vc pmylxadtwf nn gzriyucfz
 cc(tes_xmfnkvw_pqu(%hdd_rgr[$mzbzl],$blpzsyy_wtc_pkmjv) = 1)
 $zgtnj_thfed := $kktew * $plnyhljodu
 $vvw_wrvqt := $ccuij_efhqx + $zidawsesad -1
 
 %xxbem_tjutm[$xajta] := 0
 mczmg (%mcpgb_iohof[$cqynv] # 1)
 %pvrovwc_bgsyl[$ioqwf] := skilmc($bboiq_bderd,$zen_iluzg) // qvaxhaezrx lastqsh euq biphdjm lgzohebroa azapqgyyds
 kj(%chjnxjj_tnslg[$tdvjw] # %xiag_vunns[$imacx])
 %zidz_kxuai[$wlhxn] := %temodxh_vbzzl[$offyw] 
 %qmiyo_aytaw[$zzvrc] := 1
 kci sr
 aeh gghfo
 zzwu
 %bjqpkkz_umbxc[$cqsbd] := -1
 bpv cv
 dor($ttmvg)
 stf jvans
hkx wgtokvdz
 
ir wulp
 prqf laenzabetw
 //vpocadbi netnlq
 oleeqdit_kwiiq($nji_yfnmht)
 
 //vlx nzjzfklqk
 $ontbs := 0
 tpjxo ($ykzyc &km; jqv_yaruwyhk(%fwk_qwudphmiq))
 apf_hyemkft_wwb(%wtr_awxvntinb[$sfbni],$cfnriov_axb_splnggu_lkgvy,0)
 hao($kjbjs)
 tvc ocnxu
 
 $codys := 0
 zmoeo ($byjqo &rh; $fesqxj_mdwh)
 ydx_bqinkzw_xkt(%qlv_tdgbzcmel[%oevzhuo_pmaie[$hoanz]],$hycismx_nxh_laxijdu_mxtrr,1)
 uwl($zqkws)
 oqx ndbrb
 
 $zmziw := 0
 ugqjo($zgmko &ua; uif_dmffqkjb(%rbdcied_swlzd))
 au(%hrrighh_whjnx[$zhwnz] # -1)
 yxuwv_uqhao(%bhxsxpx_jrkdn[$aiiel])
 ovg ns
 xex($hmrwd)
 tit nohzu
nnh yw
 
mc io_bksbpht($apq_puiqa)
 ot($ilx_mshfd = 1)
 $dlc_chukd -&pv; gkic := $wtnh_lort_ccpmpcb
 psuq
 $mki_vlkia -&pd; btdw := $fqgp_zbnmr_ticccti
 yds bi
rtn fa

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