48 lines
1.1 KiB
INI
48 lines
1.1 KiB
INI
// 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]]
|
|
]
|
|
bindvarquiet = [
|
|
bind $arg1 [@arg2 (= $@arg2 0)]
|
|
]
|
|
|
|
// same as above, but only binds for edit mode
|
|
editbindvar = [
|
|
editbind $arg1 [@arg2 (= $@arg2 0); if (= $@arg2 0) [echo @@arg2 OFF] [ echo @@arg2 ON]]
|
|
]
|
|
editbindvarquiet = [
|
|
editbind $arg1 [@arg2 (= $@arg2 0)]
|
|
]
|
|
|
|
// 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 ]
|