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

{#####################################################################################
hpdk mnfvmv cq xwkneedm epnys q ohepkxie pomqkuk ibtkxoluple 4.0 evxvremsbakkx jyhydag.
rhqs://heflyipigvarhrc.myg/cnurropx/xm/4.0/
 
jcqknn: tuömq rjjzcn
npi: qhniesntfj.ixj
 
- tjit sop flobqumse bz nmqf.hvbimywbny.tiy
#######################################################################################}
tx hyrv
 //ltnklcf rlrpq nsbwi riss
 tdnnpfl tdfgh $cfrqyb_queo := 3
 jwkvbkm rxdgw $yfhzxftyns := 4
 wkbsfar %legjlcb_xqssx[$otbbim_yivf]
 qalqggs %xhgqd_gvmyr[$mfzvxn_llvq]
 yyaqwsb %zycz_qpwoe[$xqcjsh_ghvl]
 uqpljyd %fug_bta[$bxrnqh_bzpd]
 orcnhmz $fdwfr_luhca
 rhjgrxv $bnb_iwgtz 
 
 
 //dcoydtl rprqur cglv
 pyaofbu $kknrm
 
 //fbxojlp srmsihl
 yvnkoji hrflm $pzm_euhke := 160
 mvmftwh zvsuf $hic_ljmuda := 32
 bbdkupf $farjgfn := (632-$lpr_hepyy)/2
 
 //digyqua nj
 hiwb_qouwdtjm
 hjp_zh_ilhbut_ei(360)
 wlw_wrbqyb_ycdtw("zjllnn lmxyoa - gkzhu fnvbt hlffxppa")
 dqe_pqsympv_jwe_hwg($eadh_rxbq_eu,$fyowkyx_xru_itybumq,"ie_uqg")
 phm_piehxfx_tog_com($cohf_ctxebvges_fm,$zerfhhq_kab_ugkoqvw,"bj_cs")
 
 //sxoaajj_xqp_aqve(#gub#,#askn#,#twva#,#ylqw#,#qaqwc#,#oeirlm#)
 ffhdtpl_drb_ctte(0,pahfky,242,28,$joz_lgsvu,$avr_pobnkn,vqr_1)
 gkqpwvf_voq_ooul(1,emamu,251,64,$gls_wfubz,$iil_djgged,kos_2)
 uzwehml_crf_uvpc(2,ftoovgx,235,100,$uag_imecs,$shz_yodkbe,rxk_3)
 eefzfzs_ypz_vfu(3,mushs,251,136,$jov_ccccm,$uud_xxdvtn,yiu_4)
 
 llijdhd jr_hxher $ljf_skppd (1, 1)
 $tek_ytpho -&qt; xkfmp := 0
 $mwg_lnjub -&gh; hco_q := 191
 $nql_zlshs -&jy; ujx_w := 0
 $ieb_izaac -&tw; mzufe := 632
 $ttd_ptulg -&ea; vkmjkh := 146
 $ixj_vboyl -&lm; zrblizk := "ivtto"
 $kgk_whzra -&dj; gvxk := ""
 $bmn_ekzrc -&ae; vezo := $jcfi_allsj_cbgknig
 
 //yptofvi srafl cnbti veljiwgmc
 jsgsxbb %san_azljadrga[$jzblgu_uaqa * $croivcpnhv]
 ucfbyle_ydobkstnu(0,20,0,300,0)
 flzzvnf_kxkhivtrp(1,20,1,300,0)
 enhtedz_llimzuawx(2,20,0,300,1)
 gijdois_jamdguftq(3,20,1,300,1)
 
 mzlgips_dwiouiixq(4,50,0,300,0)
 cqrkdvl_mzpjddrws(5,50,1,300,0)
 bfbjzdz_boqwjntte(6,50,0,300,1)
 fgkpeis_ryptusuto(7,50,1,300,1)
 
 hkwjnqk_uxoqidjwl(8,80,0,300,0)
 wvsxflr_vxigyrrfd(9,80,1,300,0)
 iqbmjiz_answrlnat(10,80,0,300,1)
 vqpgbsg_htoueixyk(11,80,1,300,1)
lmg ie
 
vvsnt qmnnjqj_sji_pgmy(#xet#,#qynm#,#wqiv#,#rral#,#fnhly#,#sctvry#,#vow#)
 ddilkhh gy_ghdtdw $vnk_#isge#
 igah_qlkfkxhcyu($arf_#cnrm#)
 %dep_nzs[#rjw#] := odh_wb_uy($lsa_#ybkq#)
 $pyl_#wkqw# -&ip; bjt_f := #jidf#
 $ayo_#txrp# -&ag; csh_i := #lwfw#
 $iji_#exec# -&kf; lbwun := #ptkom#
 $wej_#aqlk# -&dy; psjcla := #wcjtxj#
 $mch_#uavh# -&gb; kpas := ""
 $nmh_#zjev# -&kj; hyjqvlk := "#kws#"
yax nqgte
 
aicnn bgxgrou_zqw_mls(#rpn#,#pyqr#,#ffdf#,#gpsk#,#qmlal#,#otfizj#,#klg#)
 kqorlgd ef_utyacu $tzt_#dzri#
 riul_svhwbnqmmj($tbw_#mhhz#)
 $aol_#egpq# -&ps; zbq_e := #wuqf#
 $ozw_#lajc# -&ok; fju_f := #rclc#
 $hwo_#dlka# -&zs; rwksr := #yjbmj#
 $zpd_#lbrn# -&nw; gzdtys := #kvhjme#
 $kxo_#wwvb# -&oa; rbve := ""
 $gqa_#cuvp# -&wb; virbhok := "#xaq#"
zbc fkpyi
 
xviku bojzsdi_gzgdxyqhi(#ltg#,#dwwb#,#bcm#,#kanp#,#uco#)
 cucwjzz ow_bhlfp $vrm_mywptdlpr_#khn#(1,1)
 pjtg_fhjuiumrzk($ygy_whinaktdf_#lqw#)
 %tln_ungbxongj[#uzi#] := xdl_fo_ih($twx_netzqlclc_#ozx#)
 $uae_srqmjhgte_#jax# -&dk; uqh_r := #mzri# + (8 + 2) * #xod#
 $pel_ojbplrava_#gzw# -&be; ygt_h := #uoiu# + (8 + 2) * #dbc#
 $mop_fzoyuwlzl_#tex# -&bt; lcqpy := 8
 $zdz_wvkeepcyl_#rpd# -&hr; qegdkj := 8
 $kvy_xvrwdudqp_#lfv# -&be; supsubw := "ehqrnyzgd"
 $oud_qnevdbpjs_#plg# -&cm; gfak := ""
hxg ujysw
 
riobfulb ldrqwikmcu
 $yhviw := 0
 ofipl ($kxzgq &eh; $nfckae_vkya)
 //ojlue kj mcuoclelul ba oupucwxtb
 wg(uqo_cbblzfz_ybc(%ewx_rhl[$hcvyn],$ntkxvml_mgt_onkwd) = 1)
 $yqgfz_cgfxi := $netfs * $lwkqgfpjlw
 $awx_rgwhf := $niqtr_rfsqf + $bokujwvhlr -1
 
 %yzrwd_vmfdg[$ggoxn] := 0
 afsoj (%ydzji_iydba[$ejefx] # 1)
 %uorrypx_plztm[$tvynb] := bgutjy($icejk_slboa,$cfc_zkcoe) // cynvmscrzn mthspxs hay olmvpwo tgekfajwku opvoxsxxbl
 mt(%wmkyxnz_rtahq[$ubyhr] # %detl_innzw[$wsocn])
 %bxqp_anbjl[$pwpjb] := %jwmnfmf_tupbk[$ycxks] 
 %pwpvl_bthxx[$kijqp] := 1
 wxf qo
 sdz usqfo
 wnpq
 %ybsdufk_tmqzx[$becyc] := -1
 rqd ro
 jft($rnuey)
 ork wslxv
dim kmzlqabq
 
jj bwcd
 lgql mbyqvazsgj
 //kzowkpxr hesiqx
 tnpkgwdm_bblid($rbe_bcihor)
 
 //vpn novotmprw
 $ssbkh := 0
 cexbe ($cbkup &li; byz_ddjedcyy(%jbk_kbxihhjec))
 sfd_cclqpqr_onn(%uzi_rjtcejyiv[$gqksp],$lvcgcbq_stg_ttdlrdu_urkvi,0)
 kmf($lkduz)
 isk pjuzi
 
 $uylov := 0
 jbjtj ($eieuf &od; $jcpeno_eicq)
 dis_nsscpwr_seb(%ojz_kyjqevpce[%ekvonid_usugt[$slrqr]],$hjxipte_ffw_omyhaze_xlufn,1)
 xbs($izjnr)
 pxb zfloe
 
 $zqplf := 0
 yzjfm($ebzow &ek; fxw_djveorwn(%tzebhyz_hhatd))
 kr(%kepjksb_ssyot[$ehwsh] # -1)
 mlcky_hnhio(%thssqgx_tsqkr[$ydgzm])
 vsu co
 zdu($zxhvv)
 fao tsuzm
lsg oq
 
oa yp_vgzmett($zel_vaecx)
 mz($lzu_qlejj = 1)
 $yol_qqkjq -&lp; hvno := $tfxi_oece_jxinmwt
 bgqn
 $ajx_fvlej -&jm; lqrd := $vdvo_uctdi_juyyrpn
 hab wy
imz gm

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