File: stdlib.cfg

package info (click to toggle)
cube2-data 1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 300,956 kB
  • sloc: makefile: 5; sh: 2
file content (41 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// console language standard library

// creates a macro whose body is a format string
// i.e. macro greet [ say Hi, %1! ]
macro = [
    $arg1 = (concat [format [@@arg2]] (loopconcat i $numargs [concatword " $arg" (+ $i 1)]))
]

// binds a key so that it will toggle a variable
// i.e. bindvar 9 thirdperson
bindvar = [
  bind $arg1 [@arg2 (= $@arg2 0); if (= $@arg2 0) [echo @@arg2 OFF] [ echo @@arg2 ON]]
]

// same as above, but only binds for edit mode
editbindvar = [
  editbind $arg1 [@arg2 (= $@arg2 0); if (= $@arg2 0) [echo @@arg2 OFF] [ echo @@arg2 ON]]
]

// binds a key so that it will set a modifier while held down
bindmod = [
  bind $arg1 [@arg2 1; onrelease [@@arg2 0]]
]

// same as above, but only binds for edit mode
editbindmod = [
  editbind $arg1 [@arg2 1; onrelease [@@arg2 0]]
]

quine = [ echo (format "quine = [%1]" $quine) ]

loadsky = [
    skybox $arg1
    if (> $numargs 1) [
        spinsky $arg2
    ] [
        if (!=f $spinsky 0) [spinsky 0]
    ]
]

mapmsg = [ maptitle $arg1 ]