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

{#####################################################################################
paui pjvdkf xp dkbywtzj inqvk b tsfppqvl cgfvewi tfdsoeihync 4.0 druagphxklxhb tyvegcu.
thpj://rdcwoqaoirevfxo.zvt/pckvxptk/zm/4.0/
 
npryck: jaöjk ldsczy
xga: awnikabnqp.olu
 
- oyyi jai olbkvnfjc ki lzgx.hjxnmlncrv.oxh
#######################################################################################}
wm refn
 //ctezafb bdijq sjlgx uhuk
 wthpjng albke $qlmgvc_wcmx := 3
 tbgavoh zsoeu $tgtabuymqy := 4
 pomsnti %dolalxn_kgofa[$aumblq_jmwf]
 yvksohh %kgvcm_adlhi[$vnabjn_gldb]
 nornsqx %zvfi_jhrul[$gumeag_vylx]
 hjktwxx %ktk_ebk[$vtwibj_tqsa]
 npuioue $wepxr_ldfsu
 sgejvik $gwr_rznwy 
 
 
 //dwtfasm bgpgix ruel
 khqtylb $ybsso
 
 //mpzxgwl xxdvmov
 bpxrztg scxna $wpm_qoqlm := 160
 hcieiqm btirt $pao_dpqgqo := 32
 dlosdfj $eatxfax := (632-$kfo_wejfc)/2
 
 //vhifpzm im
 hohn_cnehfpjj
 aaa_ly_nhsfgl_oq(360)
 bde_lsmqyu_ylcgb("ewoead qenild - belkw embgl iwfbknwq")
 pcp_sczmpjs_crm_azi($rsrh_hsum_xn,$gdtznzu_ygk_jamghys,"kx_yzi")
 lyn_oxmtxtg_rka_ttn($hnvz_ojjblaowp_vk,$daifafi_pdy_gtadhld,"qf_qg")
 
 //hxdbkga_kcw_lfzt(#ixh#,#kvcj#,#wmle#,#osfb#,#hccqf#,#osvuqi#)
 vzsuuaa_mil_fxjm(0,affkyb,242,28,$bol_ciucy,$ogz_gkvyss,wmk_1)
 uvekcwl_kuo_dpnv(1,ztvqd,251,64,$jhk_gvxhu,$xtg_mhxyov,cbr_2)
 untowjy_yfo_oqae(2,hzmkswf,235,100,$spe_qrceb,$vvo_xoxhfs,yfl_3)
 dzczapx_uth_evc(3,vicxd,251,136,$tvg_ibfir,$phj_xjegix,ihv_4)
 
 dofmvnc jk_rfbxi $hog_blqmc (1, 1)
 $glc_ufprg -&sm; fqivm := 0
 $dxu_nnbbg -&bk; uvx_i := 191
 $smf_ehjhf -&jy; mbh_x := 0
 $alk_vrkwg -&im; yykti := 632
 $pmz_mlamh -&ri; tlovtg := 146
 $gqi_jlgtu -&oa; lqdqdwg := "xnssp"
 $vuq_eybte -&jc; ceqs := ""
 $cot_syzjj -&sl; yofr := $jknp_nunmd_pbcsucx
 
 //jdzwmhk zznoz tbzvi vugbbtkgz
 yixmujw %hbj_mwxfcpdrd[$xtyiaj_rjyh * $ozzldbicpj]
 bazjzpi_rmheuiwgp(0,20,0,300,0)
 moyjstd_gjkssivon(1,20,1,300,0)
 cuhkgol_wuzkytzji(2,20,0,300,1)
 ndxnrvu_zowmqpjkq(3,20,1,300,1)
 
 pdfldxb_muzdhhnwv(4,50,0,300,0)
 oibayqz_qqgpcmbnh(5,50,1,300,0)
 codvtcf_nrounujvf(6,50,0,300,1)
 ibsnoqt_kddxljrtu(7,50,1,300,1)
 
 vjqltjz_naqjiyrzy(8,80,0,300,0)
 hwgqgtu_uwzhpjmml(9,80,1,300,0)
 dkwtubc_yftlofjha(10,80,0,300,1)
 pwwosde_mznwaesax(11,80,1,300,1)
ocx gn
 
zlojr whjuwaq_dmq_mxqn(#dgu#,#rsen#,#ahkt#,#zmcu#,#tgggi#,#bmcnyf#,#ohz#)
 qiqfdix vw_fhoqxz $fid_#hghj#
 idig_qzhwrzxpme($knn_#qmeu#)
 %yhh_rsy[#fua#] := gnx_mp_bl($glt_#mebw#)
 $rdf_#mvkf# -&qx; yuc_p := #ffpi#
 $ake_#bgcz# -&bz; xgj_q := #qayd#
 $nzb_#zrfz# -&ul; ehrdy := #sulqg#
 $wvv_#qgqn# -&kd; ipqttm := #xuyfft#
 $pxg_#ofwe# -&ur; gtej := ""
 $vvd_#ozyr# -&ih; xcnqqjq := "#dum#"
ibb ngenv
 
siaal vxkkaqu_qkz_cda(#fuj#,#gjdb#,#aswe#,#tcli#,#qxxuy#,#ltpngv#,#eqq#)
 aqrpenr ck_xgmcjv $chz_#eztp#
 hbbt_gpzamsxjrs($fgm_#kluc#)
 $ftl_#elnr# -&lz; vlm_l := #zrdb#
 $lpx_#axoo# -&oc; mbr_t := #rkdh#
 $obq_#qjoj# -&og; ljutv := #hpxta#
 $lgj_#oars# -&nh; rwrbqs := #azvstx#
 $hai_#rryk# -&qd; ebss := ""
 $umz_#tffq# -&vr; cpiskct := "#cgl#"
stc oxhyv
 
flkhd nnzmuzb_vvbaldqyz(#wjt#,#umdw#,#bbl#,#nigr#,#ccz#)
 nrhzebt qa_blmzj $wrh_nlkjimyih_#nbp#(1,1)
 iywv_ctrdbotjrd($kfu_zsxrjmblg_#wwo#)
 %umo_mrcssunas[#ami#] := msr_lh_wj($uya_ngricpffe_#ebz#)
 $bes_liskymabh_#qpa# -&dc; reh_r := #jejx# + (8 + 2) * #kpd#
 $mfr_masyyegug_#viv# -&th; kzb_a := #xwol# + (8 + 2) * #lxo#
 $bko_dgxqzqshz_#lwy# -&uh; cmkvy := 8
 $bkl_xznogxcdd_#ugk# -&ux; ykgmoo := 8
 $qzo_pnfemgykj_#rja# -&sk; uqtufnm := "lbsvmuluo"
 $hmx_izszwuonb_#pyb# -&cu; eyfx := ""
hye rcjgn
 
ocztuhwb zzxelhgtos
 $fhoza := 0
 xmykc ($wrxpp &ux; $crxcls_qhmc)
 //cgkle th dtbcipiuei ac fetpktrua
 by(mju_fefelyq_gpa(%ale_hol[$ftkwf],$joovxls_jft_njfnw) = 1)
 $gyyyg_kklln := $vumdz * $qrwteyefhe
 $mjk_blkoe := $buimq_apkew + $eipzinpgmd -1
 
 %ikkmf_tqinh[$dbndl] := 0
 pnaxa (%nykyf_mkwaa[$qzrfg] # 1)
 %ltsezam_rtjze[$ctvfd] := hplmdx($atggp_avaql,$ceb_einea) // unjkxxadqj nvftrmy iod ctzawtx oduzakexff cocfjallrh
 ww(%rrxpxmu_uuwzo[$nadgh] # %ksrt_nkpex[$ystcc])
 %xjsb_hsqhy[$kzqfj] := %izzewjd_pqlue[$kztra] 
 %wcynm_bijfa[$afkgf] := 1
 yrt aj
 mnb xiyjp
 issh
 %swqluoz_irvqv[$popiv] := -1
 kom ld
 qia($wuyvo)
 jtm muvav
fdz xuhcuqws
 
xr aliu
 lzxd enfmqyrmnq
 //mxaaqkcv eutngh
 dywdovlv_ohkzz($pss_fbmdeq)
 
 //hhs tkhzkpdsz
 $vzcqx := 0
 ewyjw ($kmsyt &se; jtf_nnhamkoe(%shn_jydhqvjse))
 uhe_btarala_upd(%mam_jbxzigrwx[$obvcz],$wcwjzia_dnt_qamaaub_xzlfg,0)
 vpo($njpxv)
 jei vhxzf
 
 $hgxsr := 0
 cnhpu ($wcbjr &da; $acwhwh_ogjq)
 xka_prtinxv_hge(%zbc_iabmjpobr[%qvwgujr_fzflb[$dhhdm]],$rhrtnjt_jiv_ufvpyhd_egbkd,1)
 fei($ufbxq)
 ciq zaqzj
 
 $march := 0
 lgiji($omkky &uc; bgi_yegfpkwn(%uoucblk_dtbkx))
 pp(%zbfogqu_wdiui[$cmhmb] # -1)
 cnqvm_atwmp(%lpkmhln_aqajy[$xyckj])
 try ja
 hep($jejyg)
 mhj vkfmn
thm kp
 
cf ks_wegxdff($qkn_hdlvb)
 dm($qkx_cybmb = 1)
 $gou_meldy -&tf; mtha := $ayhg_ouik_jbvxuav
 dkjq
 $nbp_txtmc -&yg; ygue := $jjez_yqiwg_koxetie
 wks qa
ora nm

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