Script Demo - Persona Menu

From Cube Wiki
Revision as of 17:59, 12 December 2014 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

open menus.cfg and look for a line reading

newgui main

this is where it all begins!

Then locate the line defining the quit menuitem

guibutton "quit"

and place a new line above it :

guibutton "Persona" "showmgui mypersona"

then move to the end of the file and enter some lines to define this menu to be shown :

bteam = "GWAR"
pnlist = "Mutilator _ Anihalator _ InH4L3 BRTH ExH4L3 BRTH Frodo RING Mithrandir RING Batou PP#9 Ichikawa PP#9 Morgoth _ Spawn634 _"

genpersonas = [
loop i (div (listlen $arg1) 2) [
    j = (* $i 2)
    k = (+ $j 1)
    pn = (at $arg1 $j)
    pt = (at $arg1 $k)
    ct = $bteam
    if (strcmp $pt "_") [] [ct = $pt]
    mi = (concat "name" (concatword $pn ";team") $ct)
    guibutton $pn $mi

newgui mypersona [
  genpersonas $pnlist

The whole thing works by taking always two elements from the list, the second being interpreted as team, if it isn't an underscore. The first will be your new name, this is displayed in the menu. The team will default (in case of an underscore) to what bteam is set to.