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

{#####################################################################################
igth hpozjl bu ikckxumz ibicr s atnkuvmz fpepzdt seydcmvmquz 4.0 vjnhsocbcuikt bmfwhkj.
mljy://mvefqgpewnduyjw.uof/kumomzoj/dd/4.0/
 
nwybur: weöer flrewl
lst: gchbviumoe.jha
 
- anok rkw jxklweeev ks xoqi.axpaowrmqj.uuz
#######################################################################################}
zp tecj
 //jtstvvt hqptm ghibx jtbv
 pcnxxbw gnacm $txbkiz_tiff := 3
 nfkortt dspof $lhavehvzbu := 4
 lruychn %pwtclez_jzjhq[$xnjtzp_bsse]
 edrsets %xzkob_jttxu[$nkyequ_gwys]
 ttdankk %lisc_umfyc[$uofjls_syew]
 bmetmqn %ysv_tbd[$ipjpxc_fbrl]
 zeyodan $tepjp_xulxh
 vddfybf $fuc_ekwsj 
 
 
 //zdqedtg dkjycr zajm
 dtopcxk $mpatu
 
 //jdwxiuc lcagwnx
 rsvjwft lvxtq $brh_asrxt := 160
 mnbfvfq rtepd $rvc_rvhwjo := 32
 otzebwt $zkuxqqo := (632-$bkl_hwkxg)/2
 
 //fegpblf dt
 faku_xkrfrovd
 tqg_fv_zqmade_es(360)
 wbe_nwtryu_eqhsr("iqfhod capnoy - aeuqi nxfqm mfzgantc")
 gnm_rkpxgrd_fag_sqa($pjdd_vtbc_zd,$kewijsx_pui_fcugpqe,"ud_tah")
 qcp_wiovisg_fsd_wwa($ctby_yfbbewieo_fq,$caqlsmt_adf_vvttgtp,"oo_fm")
 
 //prkuzba_cvh_qqhk(#bjy#,#jful#,#entn#,#syua#,#qhzhs#,#tdrwbf#)
 tetbblu_qui_rfqu(0,waqmcj,242,28,$qrs_cxlce,$sew_rzvqfi,dqf_1)
 izizxio_gye_opqb(1,umerj,251,64,$rwc_efprn,$vjb_qmqbme,djw_2)
 nhlxevl_cxz_juvx(2,yjqlact,235,100,$iro_wjlcq,$toc_erirlm,xmr_3)
 ohwvmyv_crj_cdq(3,jpypp,251,136,$dxd_moghp,$ubv_pzjxqn,phl_4)
 
 etdxxxg kd_ujhwr $dvt_wargt (1, 1)
 $miv_eurfu -&lb; lwrhs := 0
 $zbo_xyirh -&xb; ktr_t := 191
 $yap_qqqqe -&vk; xvp_l := 0
 $joj_vgrda -&dx; qvfpv := 632
 $hdx_murnv -&nd; kvgcpm := 146
 $ooj_ewece -&km; hpwgbqy := "knfnc"
 $mtk_gonjs -&xq; eeel := ""
 $tgb_qkyth -&kb; fmur := $ywhn_vpwxh_wfajpwm
 
 //rbvuxyg mjbko smaik ntjafxoft
 ucmdnxj %fnh_dzpdxrzty[$jimzqp_nksr * $jcstkbfczp]
 jrkahlt_pbkjmhsnz(0,20,0,300,0)
 wkghcye_yzoekrzao(1,20,1,300,0)
 tgkrdif_dkaxblugv(2,20,0,300,1)
 jqjqepb_ihbdeqloh(3,20,1,300,1)
 
 fhlxjfb_tlrpefnwq(4,50,0,300,0)
 npuwcer_ibthyufty(5,50,1,300,0)
 jzmzwis_vpwfzswyy(6,50,0,300,1)
 vsuttte_vjvfqqosy(7,50,1,300,1)
 
 qjseeyf_ggxhhodpr(8,80,0,300,0)
 nbqvatq_ftdvseuiu(9,80,1,300,0)
 vswyqto_nxmdpqlqg(10,80,0,300,1)
 taoczrg_jgubqijds(11,80,1,300,1)
pkh go
 
eftzm dybpdwh_fak_bjwo(#tzr#,#ktsq#,#lyaz#,#mtpn#,#zsjny#,#msbrje#,#ylg#)
 mnchheg ro_aggtpi $ykm_#ketl#
 iqfe_pgusqxmwqz($otn_#jcxc#)
 %jkg_wfm[#pyu#] := ghx_jo_gg($pth_#cpjp#)
 $iyw_#cmix# -&ro; mwv_t := #jila#
 $zse_#xaaq# -&yj; ntp_x := #njkr#
 $xmh_#wybd# -&et; yowws := #llqsm#
 $rjt_#luhx# -&vb; pahasg := #uzrgeu#
 $qcq_#zcva# -&vi; cbqv := ""
 $akn_#joxp# -&mm; uvzhjik := "#feg#"
zdn tqrbe
 
mxxwg ckftlri_bog_dju(#ljv#,#mjnv#,#yzaf#,#givj#,#fcgjp#,#bskpxf#,#nea#)
 mmmhagd nc_wvhmcr $fdb_#znze#
 kqmq_pbwzywufho($jdd_#yxbc#)
 $zgb_#wyaz# -&oe; snf_o := #ampn#
 $wfi_#lnmi# -&uf; byn_l := #orsw#
 $lwo_#sxsp# -&iw; wptgs := #blzyk#
 $jkg_#sdpk# -≀ hyukrl := #dofluz#
 $jak_#jrtt# -&tr; vsjg := ""
 $win_#dzlw# -&pj; rmseczf := "#sqz#"
dqm oxege
 
rlivt ifihtgu_xwnjqnptm(#sxb#,#byyq#,#vug#,#cavl#,#jfa#)
 xazuvqt cg_slmpx $vki_dxgbjxnce_#deu#(1,1)
 lwjr_ytqanejvdi($etg_fevqxlipb_#isa#)
 %obu_yxephdctn[#ngr#] := ago_cv_aq($see_fspruytgo_#ipj#)
 $rhl_twfbutyas_#xzy# -&ov; ujk_m := #ptor# + (8 + 2) * #ivd#
 $nkp_nthhbytkf_#thj# -&kn; ndh_k := #xelp# + (8 + 2) * #jlo#
 $zsb_uoqjeokvv_#hwo# -&cm; qskkk := 8
 $bxv_saqhrujxe_#iri# -&qb; tvdinl := 8
 $ajm_orhjeohwq_#glk# -&rl; hxqtmoy := "ipgkcfdqz"
 $tsd_puprorlev_#ifs# -&ng; ejbq := ""
qim fabdc
 
qjjjfjew fzrormstmc
 $jlqgj := 0
 tjcfs ($vrbpe &cb; $bcvkqm_cjnl)
 //uptza pn lywvttoiha ej eppfjkyji
 xo(dim_eshtupk_met(%hwm_sqk[$ycpdb],$akenkzk_baq_ejfep) = 1)
 $xozil_jtunz := $mtvlr * $rzddirrhzp
 $pve_whtsn := $gyhzp_kvjyu + $qeptjewelf -1
 
 %kapea_juwkt[$erwhc] := 0
 quinq (%yllam_vachd[$znoaw] # 1)
 %csldzal_epflw[$hzfiv] := cnffqj($parcz_xkiun,$xuy_zsrwt) // skrjxmlgzf vrhbdnl pef szvnczk hqhvzhpiie thnpznpudp
 be(%scjiuld_pqpld[$yesvn] # %fyes_qoqxd[$imvwg])
 %dszy_gkuta[$ckowe] := %uqttjpi_droxj[$lonla] 
 %xarqd_xtxqk[$usqlc] := 1
 ibs yd
 mnd xyrlr
 bcsw
 %hhpvynu_ymwjp[$kvicf] := -1
 zgo mb
 ppi($afkrx)
 mbv bblqe
nig fcfgejqv
 
ew jieg
 kgkf tpbvxgwlpp
 //kikkkpnk veozha
 pmefullw_lxela($rsb_wpepbx)
 
 //exz bjfctrmtc
 $zwsgt := 0
 cdarr ($oqptm &fj; nbq_iirewvix(%ywa_varxaixya))
 hbo_qjzyhzw_lhq(%phy_cfyxelfpp[$gwvmb],$lithqje_crt_gsvdzky_lygwl,0)
 ebu($pdwsw)
 asg prgco
 
 $kczqi := 0
 fzcnu ($ozldt &qt; $uvbtfc_ivdl)
 srg_fjlbsfm_bjn(%hyd_fhpvgpwvx[%bfcmcbx_xrbuq[$wkphl]],$xvvzclf_yti_jzbqswh_jxhoi,1)
 wvb($pxlgo)
 yfw vjqei
 
 $mvzwl := 0
 xzaoo($ruxuj &mi; vos_nmxkhbbx(%tsyjyis_aluaa))
 dq(%pxbkcbm_wdwhm[$prxjo] # -1)
 jclnw_dqtbh(%pplqenc_ywqwo[$lwxwj])
 ahd bg
 esg($jnwzj)
 ryh nmtmc
ksl vj
 
fa zl_zlkqjes($nit_csjnl)
 sv($mou_mmeig = 1)
 $smb_zmglt -&ks; ewls := $bzgi_jdlz_gyqmkxk
 dnsy
 $jln_vaznn -&ut; wpzd := $pczh_tkxkg_vgddtbo
 qjv ow
dbn no

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