Advertisement
RaZgRiZ

guipagelist 1.11

Feb 8th, 2012
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Specialised function that serves as a simple yet complex list selector that uses pages to utilise its full length.
  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 CRITICALLY avoid using the (format) function. The following are used as substitutes:
  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. 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) [$arg7 = $a]
  27.                 guibutton (format "^f7%1%2" (? (=s $$arg7 $a) "^f6") $a) (
  28.                     format $arg4 $arg3 $$arg6 $$arg7 $a
  29.                 ) cube
  30.             ]
  31.         ]
  32.         guibar
  33.         guilist [arg5]
  34.     ]
  35. ]
  36.  
  37. // ---- GRAPHICAL EXAMPLE ----
  38.  
  39. newgui test [
  40.     guipagelist 10 32 $pagedlist [
  41.         say "%4"
  42.     ] [
  43.         guiimage "smileyface" [] 4 0 "data/cube.png"
  44.     ] "pagevar" "selvar"
  45. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement