// -------------------------------------------------------------------------------------------------------------- // -- Dynamic MapMenu - 20 April 2009 - by MeatROme contact AT gmail.com --------------------------------------- // -------------------------------------------------------------------------------------------------------------- // installation: add line "exec dynmapmenu.cfg" (no quotes) to your autoexec.cfg // usage: key-P toggles gui "mymaps" ON|OFF // license: zlib ( http://www.gzip.org/zlib/zlib_license.html ) // misc functions: zeropad = [if (< $arg1 10) [concatword 0 $arg1] [concatword $arg1]] listpos = [(listfind chk $arg1 [(strcmp $arg2 $chk)])] // internal memory: _mmg_tab0 = [] _mmg_tabC = 0 // -------------------------------------------------------------------------------------------------------------- // to avoid errros on first run: guirolloveraction = "" guirollovername = "" // templated menu definition: newgui mymaps [ guilist [ guilist [ genmapitems $_mmg_tab0 ] showmapshot ] loop t $_mmg_tabC [ gui_tx = (+ $t 1) guitab (zeropad $gui_tx) guilist [ guilist [ genmapitems (getalias (concatword _mmg_tab $gui_tx)) ] showmapshot ] ] ] // -------------------------------------------------------------------------------------------------------------- // assuming we didn't miss changes in SVN, the first release in 2009 should be using the following aliases: // NOTE: you may need to modify the following line: mapl_l = [mainmaps moremaps1 moremaps2 moremaps3 capturemaps1 capturemaps2 conceptmaps] // build routine: build_personal_mapgui = [ allogz = [] loopfiles f packages/base ogz [allogz = (concat $allogz $f)] newogz = [] checkmap = [if (= (listpos (getalias $arg1) $curf) -1) [] [c_cnt = (+ @c_cnt 1)]] chkogz = [ c_cnt = 0 looplist curlist $mapl_l [checkmap $curlist] if (= $c_cnt 0) [newogz = (concat $newogz $curf)] [ ]//;echo added (listlen $newogz) $curf // enable if you're curious (behind "$curf)", before "]") ] looplist curf $allogz $chkogz nmll = (listlen $newogz) if (> $nmll 0) [ _mmg_tab0 = "" maxlopln = $nmll if (> $maxlopln 10) [maxlopln = 10] [ ] loop k $maxlopln [_mmg_tab0 = (concat $_mmg_tab0 (at $newogz $k))] tabcnt = 0 if (> $nmll 10) [ tabcnt = (div $nmll 10) _mmg_tabC = $tabcnt loop d $tabcnt [ curtab = (+ $d 1) curmapseg = "" cursegoff = (* $curtab 10) maxseglen = (- $nmll $cursegoff) loplen = 10 if (< $maxseglen 10) [loplen = $maxseglen] [ ] loop k $loplen [curmapseg = (concat $curmapseg (at $newogz (+ $cursegoff $k)))] (concatword _mmg_tab $curtab) = $curmapseg ] ] [ ] ] [ ] ] // -------------------------------------------------------------------------------------------------------------- // AUTO RUN: build_personal_mapgui bind P [if (cleargui 1) [] [showgui mymaps]] // it also starts here // --------------------------------------------------------------------------------------------------------------