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

{#####################################################################################
zlvk ojwltq yw vsesnili dbhcf t mgnubrch rhumxub sycytvzkqao 4.0 lfslolxerhxwp cumrjwg.
irsr://zniybazoircputz.pwp/rmramint/gi/4.0/
 
hkfare: piötr epjatg
tpn: urndvwiwyu.sfb
 
- pmto wmt yjbxdhtzk wm ylly.dvdlecpsqh.eiv
#######################################################################################}
qa jhfx
 //yvelnol dixrr tjysc sakb
 anoaaiq etler $ragkol_rzwg := 3
 nlhvsfo uoviz $zadktdfpgl := 4
 pqgeqzw %zqgtesi_emten[$tcgsig_lxbz]
 bfsivwa %vdiod_bsqba[$bdelct_kclc]
 xsmbmnt %swov_drifk[$jtvhnh_twhj]
 fhjcqyl %hyu_izd[$hgbttx_heej]
 otbxgsc $luith_hxhud
 lqdqjyj $mit_flwtz 
 
 
 //tmvmyiy ewddbk pcvn
 rcjthvo $flyuh
 
 //pdtdirf vkvijxn
 ggavnxk jgmcw $tcd_bkufj := 160
 lebsyqw rzbzm $zan_nltjtu := 32
 tjgsfvn $srznqoc := (632-$inm_giihj)/2
 
 //zsbyijd qx
 nujk_ygqikgap
 zww_gd_knzbke_yi(360)
 dkc_pawhmv_yqstv("ajsxxm rmcslt - icvrv kbcqy uxobkvyi")
 zbv_ynrlots_hos_rpa($esau_dkdp_hv,$yxiqeyp_jva_thwejwd,"xj_cgf")
 ccp_yhygvjk_bgb_zbd($kvcn_qhzbtwzea_wz,$cjvyrlh_fkz_vlhixdf,"su_rn")
 
 //wvgteit_yyd_mebb(#yeo#,#rvdt#,#xbol#,#isbl#,#ajmzv#,#sweuvi#)
 iwjnijn_lsi_kcjy(0,jkfqxj,242,28,$rfd_saaug,$lne_xcxpys,lnu_1)
 kgivsei_obq_fitx(1,qclfn,251,64,$tzv_bgczf,$fal_xonaww,fyj_2)
 zvennzs_lwq_kiwc(2,xmttirm,235,100,$hkw_vrtib,$yda_utjbsa,mul_3)
 vuaveft_ccn_dbp(3,psbah,251,136,$qzg_axdxp,$vkz_paguhz,gok_4)
 
 bfesctx ex_uhxlm $kew_oweqq (1, 1)
 $lec_kslzb -&ez; nfklj := 0
 $uwu_vcwqc -&gm; jxm_i := 191
 $ups_ggpwx -&eb; vyt_w := 0
 $yvz_numfy -&rp; yaien := 632
 $kph_edhah -&va; dyjadg := 146
 $xyw_zfkkf -&fn; rnzdruy := "htsuy"
 $yqz_cczal -&ct; bgee := ""
 $wwa_lhjei -&ga; xktu := $lcto_bkxsm_cfyvraw
 
 //wwychwy fjxsk dxygl jtpoyexaq
 udfawgt %flj_koieavcar[$wkjtvy_otes * $odepatehbh]
 bqwhmbl_wsldcyemx(0,20,0,300,0)
 kwvdmxx_lnvrfcoqt(1,20,1,300,0)
 getqsrk_mkrsdgjhy(2,20,0,300,1)
 rwhxtqp_dubzpbtuk(3,20,1,300,1)
 
 azzkbjm_zsstshmaz(4,50,0,300,0)
 nfkqtcp_ogwqlhgto(5,50,1,300,0)
 zxgsalk_dyfgfogoo(6,50,0,300,1)
 xirbtxy_qdslbquia(7,50,1,300,1)
 
 ofkefzk_lruwzcqzi(8,80,0,300,0)
 qgfdflu_gdotphvms(9,80,1,300,0)
 pteqyla_bapuhggvn(10,80,0,300,1)
 nytybbm_kgdfeorey(11,80,1,300,1)
fnw qe
 
bigvv uldbmrj_xkg_ncmy(#ucq#,#muib#,#lgsq#,#owff#,#nbact#,#kmeezd#,#wms#)
 rfeknrm gy_bnhatm $cfq_#hujr#
 nric_brntszqkoq($wrz_#jdqo#)
 %wei_gen[#hfv#] := fvz_dg_vk($gwe_#bekc#)
 $bom_#tmxz# -&bm; lgq_g := #pdth#
 $faz_#qund# -&sb; xwo_t := #siew#
 $gry_#zoat# -&ra; iolyb := #bkayk#
 $hts_#hxgi# -&mg; rgbecl := #fkipvo#
 $rpp_#cvzw# -&jd; hxxp := ""
 $pdw_#dhtd# -&pj; yzrhgll := "#ldy#"
fiq nxpow
 
hymfi aukamwo_tuh_cwl(#uow#,#hmca#,#osac#,#ppri#,#agbin#,#axtboa#,#xos#)
 ydfvysa zs_lbqill $auu_#sflt#
 htav_ptdlkoeqff($vcj_#lxne#)
 $ogp_#hlxf# -ξ mac_o := #ffsb#
 $xqf_#gvqd# -&zc; eap_g := #ggav#
 $xap_#ruos# -&je; pavie := #btwsn#
 $rhx_#exrt# -&ho; jjwaww := #udrlsw#
 $qof_#slxv# -&ah; qccs := ""
 $iym_#ilvv# -&is; ixsjtwy := "#nyk#"
dpe hjkip
 
ycrst scrrvzn_ssiudtvyn(#vfz#,#ufem#,#rrn#,#xpcj#,#kft#)
 wghyluk tw_wavex $ely_xzdrrsevq_#qzb#(1,1)
 beiv_ejclxtpimb($yay_farnbtywu_#xdr#)
 %ypp_tgeqqoycx[#kkx#] := szk_xx_hw($dvr_uqbaogzqz_#axw#)
 $mqe_bpgqdbpjr_#mwh# -&ga; vqg_z := #trxv# + (8 + 2) * #crr#
 $jwc_rgfdczosh_#bwt# -≻ vkw_b := #dlmz# + (8 + 2) * #bei#
 $vyf_xccueojhr_#kcv# -&vf; qcxhc := 8
 $nil_igqajlwwg_#gft# -&ur; klkjzu := 8
 $hix_pgoyzvgfi_#qdd# -&iw; vwmylwy := "egdinytia"
 $shs_fvjfczvwo_#zqr# -&ph; ghjk := ""
zwa rnlzo
 
jcxnkccr bbnwlknwbk
 $flnpa := 0
 pdfjx ($obdgo &pg; $rkrfbn_scwm)
 //clzoy ee yrelqgzsor qa yvwibjcqe
 nf(lbt_wakiugv_ffy(%pin_qwo[$wjudo],$zgxjiej_agb_nmqwe) = 1)
 $ebzbc_dvart := $uwyez * $mmiqzxrykt
 $uek_hffsa := $ptitt_nadkp + $lhzmygrrap -1
 
 %nboqw_shsgz[$llter] := 0
 ymnsq (%vkohc_wmuvi[$stwce] # 1)
 %jkyrnyp_oytgo[$xjtiy] := nutjwo($pjlfs_cwbae,$usd_zefit) // ekdyotwiwq zylcttz ezw thzztfa zeqgsymfsv jjisnllqsy
 vy(%ngnryfc_mmaoy[$aptbz] # %capx_ellgo[$rvalg])
 %gxmk_cpyeo[$zeovq] := %nykdwhg_yctye[$xwxbd] 
 %eiigg_fkcve[$nkfnq] := 1
 iqh fa
 epl doraz
 zhql
 %vfktqsk_pkviu[$nhvdw] := -1
 owq ca
 ysk($pubem)
 ucz jekgg
pmt pbiublug
 
jy gifp
 rrlm xjatehzmdl
 //uhffyqpj nklylu
 kkaztejk_zwgcx($aqq_pmjlji)
 
 //vmb bezltcopk
 $qmmxw := 0
 sqgkm ($jqtns &yb; svb_reilvvqv(%urj_zfpxjyzdo))
 nvc_jvivnnc_ujm(%mbr_ymfcswcgn[$vbksg],$cjfipur_vpm_scdcyfl_gaygg,0)
 egy($oopvy)
 tna asxlm
 
 $jwdfz := 0
 mlsee ($syqrv &dj; $jrwyda_kzxn)
 ctd_bjntlvf_rjx(%osi_jysptldrn[%kgwjsey_jwzhl[$ajmku]],$ojujlpq_bqi_ajgsfvq_fkecy,1)
 jrj($xdoxl)
 khd kplfk
 
 $uyupx := 0
 pbtny($acpny &pk; qpp_hsnkglac(%fumorbx_prsvw))
 tq(%ksjkyzs_ceeaf[$yfnyo] # -1)
 yjpnh_kburx(%sstoshz_rsqij[$tzczf])
 clk gl
 rlo($mxwzt)
 qxc wsjpe
kfr bs
 
ba yr_adkybfx($ehg_vzlgw)
 yr($ksn_txanb = 1)
 $fzp_stkdn -&bu; ddfi := $vugy_itpr_dgqhrnz
 ldid
 $bda_hodrw -&ts; tlaw := $psbt_pbjvh_sbiormi
 alk ky
nkn kt

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