Firstly, a congratulations to providing this fantastic idea to the community, but alas, I'm here now, to nitpick
now for the nitpicks
- tabcnt = (div $nmll 10)
by default sauer allows 16 entries per tab, so you should be using $guiautotab, not a constant, unless you want it to be fixed as is, then to which it'd be fine, though a very wide gui might be unwanted when large amounts of maps are rpesent
- zeropad =
[if ((less than symbol) $arg1 10) [concatword 0 $arg1] [concatword $arg1]]
[concatword $arg1] is superfluous, as nothing is changed, either $arg1 or [result $arg1] is to be used
- you don't have a method of dealing with a huge number of maps, bloodfrontier and sandbox (following BF :P) have recently added the ability to have reversible sliders (ie, the vmin and vmax positions are swapped), so we use a scrolling list
now, allow me to share the version currently in use in developmental versions of sandbox, note you may need to indent yourself
maps = ""
mapindex = 0
initmapgui = [
maps = ""
testmaps = (format "%1 %2" $mainmaps $communitymaps)
loopfiles f packages/base ogz [
match = 0
loop j (listlen $testmaps) [
if (strcmp $f (at $testmaps $j)) [match = 1]
]
if (! $match) [maps = (format "%1 ^"%2^"" $maps $f)] //^" caters for spaces in filenames
]
]
newgui main [
...
guibutton "Load Maps" "showgui maps; initmapgui"
...
]
newgui maps [
...
guitab "My maps"
mapnum = (listlen $maps)
mapindex = (max 0 (min $mapindex (- $mapnum (- $guiautotab 2))));
guilist [
guilist [
guilist [
guistayopen [guibutton "Refresh" initmapgui]
guititle " " //FIXME, add guistrut
]
guibar
loop i (- $guiautotab 2) [
if (> $mapnum (+ $mapindex $i)) [
index = (+ $i $mapindex);
guibutton (at $maps $index) (format "map ^"%1^"" (at $maps $index))
]
]
]
if (> $mapnum (- $guiautotab 2)) [
guibar
guislider mapindex 0 (- $mapnum (- $guiautotab 2)) "" "" 1
]
if (! $mapnum) [guitext "No custom maps"]
showmapshot
]
...
] "Main Maps"
~Hirato Kirata