SHOW:
|
|
- or go back to the newest paste.
| 1 | // Specialised function that serves as a simple yet complex list selector that uses pages to utilise its full length. | |
| 2 | - | // Usage: /guipagelist <height> <width> $<*1 paged list> <*2 looplist button action> <*3 sidepane extras> <page var> <selection var> |
| 2 | + | // Usage: /amp_gen_pagelist <height> <width> $<*1 paged list> <*2 looplist button action> <*3 sidepane extras> <page var> <selection var> |
| 3 | // *1) Requires a list formatted like this: list = ["text more what" "something else huh" "i'm the best"] | |
| 4 | - | // *2) Use like you normally would, but it's preferable you avoid using the (format) function. Use the following for substitutes: |
| 4 | + | // *2) Use like you normally would, but CRITICALLY avoid using the (format) function. The following are used as substitutes: |
| 5 | - | // %1: looplist var, %2: pagedlist var, %3: page var, %4: selection var. |
| 5 | + | // %1: paged list content, %2: page var content, %3: selection var content, %4: looplist var content. |
| 6 | - | // *3) Extra stuff to be placed on the right side of the pagelist. Format freely however you want. |
| 6 | + | // *3) Extra stuff to be placed on the right side of the pagelist. Independent section, format freely. |
| 7 | ||
| 8 | guipagelist = [ | |
| 9 | guilist [ | |
| 10 | guistrut $arg1 1 | |
| 11 | guilist [ | |
| 12 | guistrut $arg2 1 | |
| 13 | guilist [ | |
| 14 | guibutton "" [ | |
| 15 | @arg6 = (max 0 (- $@arg6 1)) | |
| 16 | ] left | |
| 17 | guispring | |
| 18 | guitext (format "^f2%1 / %2" (+ $$arg6 1) (listlen $arg3)) 0 | |
| 19 | guispring | |
| 20 | guibutton "" [ | |
| 21 | @arg6 = (min (- (listlen [@@arg3]) 1) (+ $@arg6 1)) | |
| 22 | ] right | |
| 23 | ] | |
| 24 | guibar | |
| 25 | looplist a (at $arg3 $$arg6) [ | |
| 26 | - | if (=s (concatword "^f7" $a) $guirollovername) [ |
| 26 | + | if (=s (concatword "^f7" $a) $guirollovername) [$arg7 = $a] |
| 27 | - | $arg7 = $a |
| 27 | + | |
| 28 | - | ] |
| 28 | + | format $arg4 $arg3 $$arg6 $$arg7 $a |
| 29 | ) cube | |
| 30 | - | format $arg4 $a $arg3 $$arg6 $$arg7 |
| 30 | + | |
| 31 | ] | |
| 32 | guibar | |
| 33 | guilist [arg5] | |
| 34 | ] | |
| 35 | - | arg5 |
| 35 | + | |
| 36 | ||
| 37 | // ---- GRAPHICAL EXAMPLE ---- | |
| 38 | ||
| 39 | newgui test [ | |
| 40 | guipagelist 10 32 $pagedlist [ | |
| 41 | say "%4" | |
| 42 | ] [ | |
| 43 | - | say "%1" |
| 43 | + | |
| 44 | ] "pagevar" "selvar" | |
| 45 | ] |