This repository has been archived on 2024-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
awesome-xlabs/website/iw6x_scripting_documentation.html

890 lines
272 KiB
HTML
Raw Normal View History

2023-08-13 17:45:19 -04:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Documentation </title>
<style>/*!
* Bootstrap v3.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*//*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block;vertical-align:baseline}audio:not([controls]){display:none;height:0}[hidden],template{display:none}a{background-color:transparent}a:active,a:hover{outline:0}abbr[title]{border-bottom:none;text-decoration:underline;-webkit-text-decoration:underline dotted;-moz-text-decoration:underline dotted;text-decoration:underline dotted}b,strong{font-weight:700}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:1em 40px}hr{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;height:0}pre{overflow:auto}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}button,input,optgroup,select,textarea{color:inherit;font:inherit;margin:0}button{overflow:visible}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer}button[disabled],html input[disabled]{cursor:default}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}input{line-height:normal}input[type=checkbox],input[type=radio]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;padding:0}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{height:auto}input[type=search]{-webkit-appearance:textfield;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0}textarea{overflow:auto}optgroup{font-weight:700}table{border-collapse:collapse;border-spacing:0}td,th{padding:0}/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */@media print{*,:after,:before{color:#000!important;text-shadow:none!important;background:0 0!important;-webkit-box-shadow:none!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="#"]:after,a[href^="javascript:"]:after{content:""}blockquote,pre{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}img,tr{page-break-inside:avoid}img{max-width:100%!important}h2,h3,p{orphans:3;widows:3}h2,h3{page-break-after:avoid}.navbar{display:none}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table td,.table th{background-color:#fff!important}.table-bordered td,.table-bordered th{border:1px solid #ddd!important}}@font-face{font-family:"Glyphicons Halflings";src:url(../fonts/glyphicons-halflings-regular.eot);src:url(../fonts/glyphicons-halflings-regular.eot?#iefix) format("embedded-opentype"),url(../fonts/glyphicons-halflings-regular.woff2) format("woff2"),url(../fonts/glyphicons-halflings-regular.woff) format("woff"),url(../fonts/glyphicons-halflings-regular.ttf) format("truetype"),url(../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular) format("svg")}.glyphicon{position:relative;top:1px;display:inline-block;font-family:"Glyphicons Halflings";font-style:normal;font-weight:400;line-height:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.glyphicon-asterisk:before{content:"\002a"}.glyphicon-plus:before{content:"\002b"}.glyphicon-eur:before,.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon
/*# sourceMappingURL=bootstrap.min.css.map */</style>
<style>/*
Original highlight.js style (c) Ivan Sagalaev <maniac@softwaremaniacs.org>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #F0F0F0;
}
/* Base color: saturation 0; */
.hljs,
.hljs-subst {
color: #444;
}
.hljs-comment {
color: #888888;
}
.hljs-keyword,
.hljs-attribute,
.hljs-selector-tag,
.hljs-meta-keyword,
.hljs-doctag,
.hljs-name {
font-weight: bold;
}
/* User color: hue: 0 */
.hljs-type,
.hljs-string,
.hljs-number,
.hljs-selector-id,
.hljs-selector-class,
.hljs-quote,
.hljs-template-tag,
.hljs-deletion {
color: #880000;
}
.hljs-title,
.hljs-section {
color: #880000;
font-weight: bold;
}
.hljs-regexp,
.hljs-symbol,
.hljs-variable,
.hljs-template-variable,
.hljs-link,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #BC6060;
}
/* Language color: hue: 90; */
.hljs-literal {
color: #78A960;
}
.hljs-built_in,
.hljs-bullet,
.hljs-code,
.hljs-addition {
color: #397300;
}
/* Meta color: hue: 200 */
.hljs-meta {
color: #1f7199;
}
.hljs-meta-string {
color: #4d99bf;
}
/* Misc effects */
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
</style>
<style>/*
Dark style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #444;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-section,
.hljs-link {
color: white;
}
.hljs,
.hljs-subst {
color: #ddd;
}
.hljs-string,
.hljs-title,
.hljs-name,
.hljs-type,
.hljs-attribute,
.hljs-symbol,
.hljs-bullet,
.hljs-built_in,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
color: #d88;
}
.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta {
color: #777;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-title,
.hljs-section,
.hljs-doctag,
.hljs-type,
.hljs-name,
.hljs-strong {
font-weight: bold;
}
.hljs-emphasis {
font-style: italic;
}
</style>
<style> /*General for HTML and PDF*/
body {
font-family: Helvetica, arial, sans-serif;
font-size: 14px;
line-height: 1.6;
padding-top: 10px;
padding-bottom: 10px;
background-color: white;
padding: 30px; }
body > *:first-child {
margin-top: 0 !important; }
body > *:last-child {
margin-bottom: 0 !important; }
a {
color: #4183C4; }
a.absent {
color: #cc0000; }
a.anchor {
display: block;
padding-left: 30px;
margin-left: -30px;
cursor: pointer;
position: absolute;
top: 0;
left: 0;
bottom: 0; }
h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
cursor: text;
position: relative; }
h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
background: url("../../images/modules/styleguide/para.png") no-repeat 10px center;
text-decoration: none; }
h1 tt, h1 code {
font-size: inherit; }
h2 tt, h2 code {
font-size: inherit; }
h3 tt, h3 code {
font-size: inherit; }
h4 tt, h4 code {
font-size: inherit; }
h5 tt, h5 code {
font-size: inherit; }
h6 tt, h6 code {
font-size: inherit; }
h1 {
font-size: 28px;
color: black; }
h2 {
font-size: 24px;
border-bottom: 1px solid #cccccc;
color: black; }
h3 {
font-size: 18px; }
h4 {
font-size: 16px; }
h5 {
font-size: 14px; }
h6 {
color: #777777;
font-size: 14px; }
pre.hljs {
border:none;
padding: 12px;
}
code {
background-color: #EDEDED;
}
p, blockquote, ul, ol, dl, li, table, pre.hljs {
margin: 15px 0; }
hr {
background: transparent url("../../images/modules/pulls/dirty-shade.png") repeat-x 0 0;
border: 0 none;
color: #cccccc;
height: 4px;
padding: 0; }
body > h2:first-child {
margin-top: 0;
padding-top: 0; }
body > h1:first-child {
margin-top: 0;
padding-top: 0; }
body > h1:first-child + h2 {
margin-top: 0;
padding-top: 0; }
body > h3:first-child, body > h4:first-child, body > h5:first-child, body > h6:first-child {
margin-top: 0;
padding-top: 0; }
a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0; }
h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
margin-top: 0; }
li p.first {
display: inline-block; }
ul, ol {
padding-left: 30px; }
ul :first-child, ol :first-child {
margin-top: 0; }
ul :last-child, ol :last-child {
margin-bottom: 0; }
dl {
padding: 0; }
dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px; }
dl dt:first-child {
padding: 0; }
dl dt > :first-child {
margin-top: 0; }
dl dt > :last-child {
margin-bottom: 0; }
dl dd {
margin: 0 0 15px;
padding: 0 15px; }
dl dd > :first-child {
margin-top: 0; }
dl dd > :last-child {
margin-bottom: 0; }
blockquote {
border-left: 4px solid #dddddd;
padding: 0 15px;
font-size: 14px;
color: #777777; }
blockquote > :first-child {
margin-top: 0; }
blockquote > :last-child {
margin-bottom: 0; }
table {
padding: 0; }
table tr {
border-top: 1px solid #cccccc;
background-color: white;
margin: 0;
padding: 0; }
table tr:nth-child(2n) {
background-color: #f8f8f8; }
table tr th {
font-weight: bold;
border: 1px solid #cccccc;
text-align: left;
margin: 0;
padding: 6px 13px; }
table tr td {
border: 1px solid #cccccc;
text-align: left;
margin: 0;
padding: 6px 13px; }
table tr th :first-child, table tr td :first-child {
margin-top: 0; }
table tr th :last-child, table tr td :last-child {
margin-bottom: 0; }
img {
max-width: 100%; }
span.frame {
display: block;
overflow: hidden; }
span.frame > span {
border: 1px solid #dddddd;
display: block;
float: left;
overflow: hidden;
margin: 13px 0 0;
padding: 7px;
width: auto; }
span.frame span img {
display: block;
float: left; }
span.frame span span {
clear: both;
color: #333333;
display: block;
padding: 5px 0 0; }
span.align-center {
display: block;
overflow: hidden;
clear: both; }
span.align-center > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: center; }
span.align-center span img {
margin: 0 auto;
text-align: center; }
span.align-right {
display: block;
overflow: hidden;
clear: both; }
span.align-right > span {
display: block;
overflow: hidden;
margin: 13px 0 0;
text-align: right; }
span.align-right span img {
margin: 0;
text-align: right; }
span.float-left {
display: block;
margin-right: 13px;
overflow: hidden;
float: left; }
span.float-left span {
margin: 13px 0 0; }
span.float-right {
display: block;
margin-left: 13px;
overflow: hidden;
float: right; }
span.float-right > span {
display: block;
overflow: hidden;
margin: 13px auto 0;
text-align: right; }
.nav-container ul, .nav-container ol {
margin-left: 0px;
padding-left: 0px;
}
.nav {
margin:0;
}
.nav-inner > .nav, .nav-inner > .nav > li > .nav {
border-bottom: 1px solid #e0e0e0;
margin-bottom: 2px;
margin-top: 2px;
}
.nav-inner > .nav > li:last-child > .nav {
border-bottom: none;
}
.nav > li {
margin: 0;
}
.nav > li > a {
display: block;
padding: 3px 18px;
font-size: 1em;
font-weight: 500;
}
.nav > li > .nav > li > a {
padding:2px 28px;
font-size: 0.92em;
font-weight: 400;
}
.nav > li > .nav > li > .nav > li > a {
padding:2px 36px;
font-size: 0.86em;
font-weight: 400;
}
.nav > li > .nav > li > .nav > li > .nav > li > a {
padding:2px 44px;
font-size: 0.86em;
font-weight: 400;
}
.nav li span {
margin: 0 0;
padding: 3px 18px;
font-size: inherit;
color:#888
}
/*For HTML*/
.html-doc {
padding-top: 60px !important;
}
.html-doc .footer {
font-size: 85%;
margin-top: 20px;
width: 250px;
}
.page:before {
content:"";
display:block;
height:55px; /* fixed header height*/
margin:-55px 0 0; /* negative fixed header height */
}
.page {
height:1px;
font-size:1px;
width: 1px;
padding:50px 0 0 0;
margin: -50px 0 0 0;
}
.html-doc .nav-container {
margin-top: 10px;
position: relative;
}
.html-doc .logo-img {
padding: 10px;
margin:7px 0 0 0;
max-width:75%;
max-height:25%;
}
.html-doc .nav-container .toc {
display: block;
color:#888;
text-transform: uppercase;
padding: 4px 18px;
font-weight: 500;
font-size:90%
}
.html-doc .nav-container > .nav-inner {
position: fixed;
}
.html-doc .nav li a:before, .html-doc .nav li span:before {
content: "\00B7 ";
}
.html-doc .nav li.active > a {
color:darkred;
}
.html-doc .nav li.active > a:before {
content: "\25b8 ";
}
.navbar-default .navbar-nav>li>a.generated-by,
.navbar-default .navbar-nav>li>a.generated-by:visited {
font-size: 85%;
color:#ADADAD;
text-shadow: 1px 1px 0 #fff;
}
.navbar-default .navbar-nav>li>a.generated-by:hover {
color:#666
}
@media (max-width: 992px) {
.html-doc .nav-container > .nav-inner {
position: relative;
}
}
@media (min-width: 768px) {
.navbar > .container .doc-title {
margin-left: 0;
}
.navbar-right {
margin-right: 0;
}
}
@media (min-width: 992px) {
.nav-inner {
min-width: 210px;
}
}
@media (min-width: 1200px) {
.nav-inner {
min-width: 250px;
}
}
/*For PDF*/
.pdf-doc{
padding: 0px;
}
.pdf-doc .navbar-toggle {
display: none;
}
.pdf-doc .coverimg {
max-width:50%;
}
.pdf-doc .covertitle {
padding-top: 40%;
text-align: right;
font-size: 40px;
}
.pdf-doc .nav-container {
page-break-before: always !important;
display: block;
}
.pdf-doc pre.hljs, .pdf-doc code {
font-size: 80%;
}
.pdf-doc .nav > li > a {
padding: 3px 6px;
}
.pdf-doc .nav > li > .pdf-doc .nav > li > a {
padding:2px 16px;
}
.pdf-doc .nav > li > .pdf-doc .nav > li > .pdf-doc .nav > li > a {
padding:2px 24px;
}
.pdf-doc .nav > li > .pdf-doc .nav > li > .pdf-doc .nav > li > .pdf-doc .nav > li > a {
padding:2px 32px;
}
.pdf-doc .nav li span {
padding: 3px 6px;
}
</style>
<style>.nav > li > .nav > li > .nav > li > .nav > li {display: none;}</style>
<script>/*! jQuery v2.2.4 | (c) jQuery Foundation | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=a.document,e=c.slice,f=c.concat,g=c.push,h=c.indexOf,i={},j=i.toString,k=i.hasOwnProperty,l={},m="2.2.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return e.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:e.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a){return n.each(this,a)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(e.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor()},push:g,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){var b=a&&a.toString();return!n.isArray(a)&&b-parseFloat(b)+1>=0},isPlainObject:function(a){var b;if("object"!==n.type(a)||a.nodeType||n.isWindow(a))return!1;if(a.constructor&&!k.call(a,"constructor")&&!k.call(a.constructor.prototype||{},"isPrototypeOf"))return!1;for(b in a);return void 0===b||k.call(a,b)},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?i[j.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=d.createElement("script"),b.text=a,d.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b){var c,d=0;if(s(a)){for(c=a.length;c>d;d++)if(b.call(a[d],d,a[d])===!1)break}else for(d in a)if(b.call(a[d],d,a[d])===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):g.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:h.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,e,g=0,h=[];if(s(a))for(d=a.length;d>g;g++)e=b(a[g],g,c),null!=e&&h.push(e);else for(g in a)e=b(a[g],g,c),null!=e&&h.push(e);return f.apply([],h)},guid:1,proxy:function(a,b){var c,d,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(d=e.call(arguments,2),f=function(){return a.apply(b||this,d.concat(e.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:l}),"function"==typeof Symbol&&(n.fn[Symbol.iterator]=c[Symbol.iterator]),n.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(a,b){i["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=!!a&&"length"in a&&a.length,c=n.type(a);return"function"
}catch(e){}O.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return O.hasData(a)||N.hasData(a)},data:function(a,b,c){return O.access(a,b,c)},removeData:function(a,b){O.remove(a,b)},_data:function(a,b,c){return N.access(a,b,c)},_removeData:function(a,b){N.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=O.get(f),1===f.nodeType&&!N.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),R(f,d,e[d])));N.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){O.set(this,a)}):K(this,function(b){var c,d;if(f&&void 0===b){if(c=O.get(f,a)||O.get(f,a.replace(Q,"-$&").toLowerCase()),void 0!==c)return c;if(d=n.camelCase(a),c=O.get(f,d),void 0!==c)return c;if(c=R(f,d,void 0),void 0!==c)return c}else d=n.camelCase(a),this.each(function(){var c=O.get(this,d);O.set(this,d,b),a.indexOf("-")>-1&&void 0!==c&&O.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){O.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=N.get(a,b),c&&(!d||n.isArray(c)?d=N.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return N.get(a,c)||N.access(a,c,{empty:n.Callbacks("once memory").add(function(){N.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=N.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var S=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,T=new RegExp("^(?:([+-])=|)("+S+")([a-z%]*)$","i"),U=["Top","Right","Bottom","Left"],V=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)};function W(a,b,c,d){var e,f=1,g=20,h=d?function(){return d.cur()}:function(){return n.css(a,b,"")},i=h(),j=c&&c[3]||(n.cssNumber[b]?"":"px"),k=(n.cssNumber[b]||"px"!==j&&+i)&&T.exec(n.css(a,b));if(k&&k[3]!==j){j=j||k[3],c=c||[],k=+i||1;do f=f||".5",k/=f,n.style(a,b,k+j);while(f!==(f=h()/i)&&1!==f&&--g)}return c&&(k=+k||+i||0,e=c[1]?k+(c[1]+1)*c[2]:+c[2],d&&(d.unit=j,d.start=k,d.end=e)),e}var X=/^(?:checkbox|radio)$/i,Y=/<([\w:-]+)/,Z=/^$|\/(?:java|ecma)script/i,$={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};$.optgroup=$.option,$.tbody=$.tfoot=$.colgroup=$.caption=$.thead,$.th=$.td;function _(a,b){var c="undefined"!=typeof a.getElementsByTagName?a.getElementsByTagName(b||"*"):"undefined"!=typeof a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function aa(a,b){for(var c=0,d=a.length;d>c;c++)N.set(a[c],"globalEval",!b||N.get(b[c],"globalEval"))}var ba=/<|&#?\w+;/;function ca(a,b,c,d,e){for(var f,g,h,i,j,k,l=b.createDocumentFragment(),m=[],o=0,p=a.length;p>o;o++)if(f=a[o],f||0===f)if("object"===n.type(f))n.merge(m,f.nodeType?[f]:f);else if(ba.test(f)){g=g||l.appendChild(b.createElement("div")),h=(Y.exec(f)||["",""])[1].toLowerCase(),i=$[h]||$._default,g.innerHTML=i[1]+n.htmlPrefilter(f)+i[2],k=i[0];while(k--)g=g.lastChild;n.merge(m,g.childNodes),g=l.firstChild,g.textContent=""}else m.push
void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){var b=n.find.attr(a,"tabindex");return b?parseInt(b,10):cb.test(a.nodeName)||db.test(a.nodeName)&&a.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),l.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null},set:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var eb=/[\t\r\n\f]/g;function fb(a){return a.getAttribute&&a.getAttribute("class")||""}n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,fb(this)))});if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])d.indexOf(" "+f+" ")<0&&(d+=f+" ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},removeClass:function(a){var b,c,d,e,f,g,h,i=0;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,fb(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof a&&a){b=a.match(G)||[];while(c=this[i++])if(e=fb(c),d=1===c.nodeType&&(" "+e+" ").replace(eb," ")){g=0;while(f=b[g++])while(d.indexOf(" "+f+" ")>-1)d=d.replace(" "+f+" "," ");h=n.trim(d),e!==h&&c.setAttribute("class",h)}}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):n.isFunction(a)?this.each(function(c){n(this).toggleClass(a.call(this,c,fb(this),b),b)}):this.each(function(){var b,d,e,f;if("string"===c){d=0,e=n(this),f=a.match(G)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else void 0!==a&&"boolean"!==c||(b=fb(this),b&&N.set(this,"__className__",b),this.setAttribute&&this.setAttribute("class",b||a===!1?"":N.get(this,"__className__")||""))})},hasClass:function(a){var b,c,d=0;b=" "+a+" ";while(c=this[d++])if(1===c.nodeType&&(" "+fb(c)+" ").replace(eb," ").indexOf(b)>-1)return!0;return!1}});var gb=/\r/g,hb=/[\x20\t\r\n\f]+/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(gb,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a)).replace(hb," ")}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],(c.selected||i===e)&&(l.optDisabled?!c.disabled:null===c.getAttribute("disabled"))&&(!c.parentNode.disabled||!n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(n.valHooks.option.get(d),f)>-1)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>-1:void 0}},l.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})});var ib=/^(?:focusinfocus|focusoutblur)$/;n.extend(n.event,{trigger:function(b,c,e,f){var g,h,i,j,l,m,o,p=[e||d],q=k.call(b,"type")?b.type:b,r=k.call(b,"namespace")?b.namespace.split("."):[];if(h=i=e=e||d,3!==e.nodeType&&8!==e.nodeType&&!ib.test(q+n.event.triggered)&&(q.inde
</script>
<script>/*!
* Bootstrap v3.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 Twitter, Inc.
* Licensed under the MIT license
*/
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indi
</head>
<body id="page-top" class="html-doc">
<!-- Fixed navbar -->
<div class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand doc-title" href="#page-top">Documentation </a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
</div><!--/.nav-collapse -->
</div>
</div>
<div id="documentation-container" class="container">
<div class="row">
<div class="col-md-3">
<div class="nav-container">
<div class="nav-inner" id="scroll-spy" style="width: min-content; overflow: auto; top: 60px; bottom: 0; padding 10px 0 10px 0;">
<span class="toc">Table of contents</span>
<ul class="nav"><li class="active"><a href="#Home">Home.md</a></li><li><a href="#Scripting">Scripting.md</a></li></ul>
</div>
</div>
</div>
<div class="col-md-9">
<p class="page" id="Home"></p><h1>Home.md</h1>
<p>Welcome to the iw6x-client wiki!</p>
<p class="page" id="Scripting"></p><h1>Scripting.md</h1>
<h1 id="introduction">Introduction</h1>
<p>This is the documentation for the IW6x scripting API.<br>Please note that the API might change over time and thus break existing scripts.<br>The intention is to create the best API possible and thus negelecting backwards compatibility.<br>There are also plans to create a common API with the Plutonium team, which might also have a huge impact on the API again, once this is done. </p>
<p>The IW6x scripting API integrates into the game&#39;s scripting VM/environment, which might be more commonly known as GSC.
The scripts are written in LUA. In case you are not familiar with LUA, you should catch up <a href="https://www.lua.org/pil/contents.html" target="_blank">here</a>.</p>
<h1 id="quick-dirty-example">Quick &amp; dirty Example</h1>
<p>Here is a sample script. If you want to read code instead of documentation, this should cover up the basics of the API:</p>
<p><code>iw6x/scripts/heli/__init__.lua</code></p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">move_helicopter</span><span class="hljs-params">(heli, player)</span></span>
<span class="hljs-keyword">local</span> origin = player.origin
origin.z = origin.z + <span class="hljs-number">1000</span>
heli:setvehgoalpos(origin, <span class="hljs-number">1</span>)
<span class="hljs-keyword">end</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">setup_helicopter</span><span class="hljs-params">(heli, player)</span></span>
heli:setturningability(<span class="hljs-number">1</span>)
heli:setspeed(<span class="hljs-number">40</span>, <span class="hljs-number">15</span>, <span class="hljs-number">5</span>)
heli:setcandamage(<span class="hljs-literal">false</span>)
<span class="hljs-keyword">local</span> moveinterval = game:oninterval(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span> move_helicopter(heli, player) <span class="hljs-keyword">end</span>, <span class="hljs-number">5000</span>)
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">disconnect_callback</span><span class="hljs-params">()</span></span>
moveinterval:clear()
heli:delete()
<span class="hljs-keyword">end</span>
player:onnotifyonce(<span class="hljs-string">"disconnect"</span>, disconnect_callback)
<span class="hljs-keyword">end</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">spawn_helicopter</span><span class="hljs-params">(player)</span></span>
<span class="hljs-keyword">local</span> origin = player.origin;
<span class="hljs-keyword">local</span> angles = player.angles;
origin.z = origin.z + <span class="hljs-number">1000.0</span>;
<span class="hljs-keyword">local</span> heli = game:spawnhelicopter(player, origin, angles, <span class="hljs-string">"cobra_mp"</span>, <span class="hljs-string">"vehicle_battle_hind"</span>)
setup_helicopter(heli, player)
<span class="hljs-keyword">end</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">player_spawned</span><span class="hljs-params">(player)</span></span>
<span class="hljs-built_in">print</span>(<span class="hljs-string">"Player spawned: "</span> .. player.name)
player:freezecontrols(<span class="hljs-literal">false</span>)
spawn_helicopter(player)
<span class="hljs-keyword">end</span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">player_connected</span><span class="hljs-params">(player)</span></span>
<span class="hljs-built_in">print</span>(<span class="hljs-string">"Player connected: "</span> .. player.name)
player:onnotifyonce(<span class="hljs-string">"spawned_player"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span> player_spawned(player) <span class="hljs-keyword">end</span>)
<span class="hljs-keyword">end</span>
level:onnotify(<span class="hljs-string">"connected"</span>, player_connected)</pre><h1 id="file-structure">File structure</h1>
<p>All scripts need to be placed in the <code>iw6x/scripts</code> folder in your Call of Duty: Ghosts installation folder.<br>You will need to create a folder for your script, for example <code>my_script</code>. The main entrypoint is always the <code>__init__.lua</code> file in there.</p>
<p>The structure should be like this:</p>
<pre class="hljs"><span class="hljs-selector-tag">COD</span> <span class="hljs-selector-tag">Ghosts</span>
├── <span class="hljs-selector-tag">iw6x</span>
│ ├── <span class="hljs-selector-tag">scripts</span>
│ │ ├── <span class="hljs-selector-tag">my_script</span>
│ │ │ ├── __<span class="hljs-selector-tag">init__</span><span class="hljs-selector-class">.lua</span>
│ │ │ └── <span class="hljs-selector-tag">other_script</span><span class="hljs-selector-class">.lua</span>
│ │ ├── <span class="hljs-selector-tag">my_next_script</span>
│ │ │ ├── __<span class="hljs-selector-tag">init__</span><span class="hljs-selector-class">.lua</span>
│ │ │ └── <span class="hljs-selector-tag">script</span><span class="hljs-selector-class">.lua</span>
└── <span class="hljs-selector-tag">iw6x</span><span class="hljs-selector-class">.exe</span></pre><p>To load another script, you can use the <code>include</code> function.<br>If you want tofor example include <code>other_script.lua</code>, use it like this:</p>
<pre class="hljs">include(<span class="hljs-string">"other_script"</span>)
<span class="hljs-comment">-- [...]</span></pre><h1 id="types">Types</h1>
<p>There are only 5 distinct types needed to interact with game&#39;s scripting environment.<br>LUA of course has more types, but what is meant by this is the following:<br>When dealing with events, functions or fields, no complex LUA types are supported, only these primitive types:</p>
<h2 id="strings">Strings</h2>
<p>Strings are text enclosed by quotes: <code>&quot;Hello World&quot;</code>.
There is not much to say about them, as they are a common concept.</p>
<h2 id="integer">Integer</h2>
<p>Integers are all whole numbers like <code>0</code>, <code>1000</code> or <code>-15</code>.<br>Boolean values, so <code>true</code> and <code>false</code>, also fall under that category and are handled as <code>1</code> and <code>0</code> respectively.</p>
<h2 id="float">Float</h2>
<p>Floating point values are all numbers like <code>1.05</code> or <code>-10.5</code>.<br><code>1.0</code> is also a floating point number literal. This is due to the dot notation, even though it&#39;s technically a whole number.</p>
<h2 id="vector">Vector</h2>
<p>A vector is a type that groups exactly 3 floating point components.
It is used to represent coordinates, angles or colors in the game.</p>
<p>Creating a new vector can be done like this:</p>
<pre class="hljs"><span class="hljs-keyword">local</span> my_vector = vector:new(<span class="hljs-number">1.0</span>, <span class="hljs-number">2.0</span>, <span class="hljs-number">3.0</span>)
<span class="hljs-comment">-- Statements below will be true</span>
<span class="hljs-built_in">assert</span>(my_vector.x == <span class="hljs-number">1.0</span>)
<span class="hljs-built_in">assert</span>(my_vector.y == <span class="hljs-number">2.0</span>)
<span class="hljs-built_in">assert</span>(my_vector.z == <span class="hljs-number">3.0</span>)</pre><p>You can access the individual components using either <code>x</code>, <code>y</code> and <code>z</code> property accessors, or <code>r</code>, <code>g</code> and <code>b</code> (note that both notations are equivalent, meaning <code>x</code><code>r</code>, <code>y</code><code>g</code> and <code>z</code><code>b</code>).</p>
<pre class="hljs"><span class="hljs-keyword">local</span> my_vector = vector:new() <span class="hljs-comment">-- vector is initialized as (0.0, 0.0, 0.0)</span>
my_vector.x = <span class="hljs-number">5.0</span>
my_vector.y = <span class="hljs-number">1.0</span>
my_vector.z = <span class="hljs-number">2.0</span>
<span class="hljs-keyword">local</span> val1 = my_vector.x <span class="hljs-comment">-- val1 is 5.0</span>
<span class="hljs-keyword">local</span> val2 = my_vector.r <span class="hljs-comment">-- val2 is also 5.0, as x and r are equivalent</span>
<span class="hljs-comment">-- The statements below are always true</span>
<span class="hljs-built_in">assert</span>(my_vector.y == my_vector.g)
<span class="hljs-built_in">assert</span>(my_vector.z == my_vector.b)</pre><h2 id="entity">Entity</h2>
<p>Entities represent &#39;things&#39; that &#39;exist&#39; in the game. Players are for example entities.<br>Vehicles, hud elements, or the <code>level</code> are also entites.
They can fire events, but also call functions into the game&#39;s scripting environment.
Some entites also have certain fields (or properties), like an <code>origin</code> or a <code>name</code>.</p>
<h1 id="events">Events</h1>
<p>Entites can fire events.
The concept was previously known as <code>notify</code> and <code>waittill</code> in GSC.<br>Popular events are the <code>connected</code> event fired by the <code>level</code>, or the <code>spawned_player</code> event fired by players.</p>
<h2 id="listening">Listening</h2>
<p>You can listen to any of these events by calling either <code>onnotify</code> or <code>onnotifyonce</code> on an entity:</p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">player_connected</span><span class="hljs-params">(player)</span></span>
<span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">end</span>
level:onnotify(<span class="hljs-string">"connected"</span>, player_connected)</pre><p>In the example above, the <code>player_connected</code> callback is called every time a player connects.
If you don&#39;t want to be notified every time, you can use <code>onnotifyonce</code> instead, which only fires once.</p>
<p>If you called <code>onnotify</code> (or <code>onnotifyonce</code>), but want to stop listening for notifications, you can call <code>clear</code> on the object is returned:</p>
<pre class="hljs"><span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">local</span> listener = level:onnotify(<span class="hljs-string">"connected"</span>, player_connected)
<span class="hljs-comment">-- [...]</span>
listener:clear() <span class="hljs-comment">-- stops listening for the 'connected' event</span></pre><p>Events can carry arguments. For example the <code>connected</code> event by the <code>level</code> carries the connecting player as an argument.
You can get these arguments by adding paramters to the callback functions, as seen in the <code>player_connected</code> callback above.</p>
<h2 id="firing">Firing</h2>
<p>To fire events, you can call the <code>notify</code> function on an entity: </p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">player_connected</span><span class="hljs-params">(player)</span></span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">my_callback</span><span class="hljs-params">()</span></span>
<span class="hljs-built_in">print</span>(<span class="hljs-string">"Yay"</span>)
<span class="hljs-keyword">end</span>
player:onnotify(<span class="hljs-string">"my_cool_event"</span>, my_callback)
<span class="hljs-comment">-- [...]</span>
<span class="hljs-comment">-- This fires the 'my_cool_event' event</span>
player:notify(<span class="hljs-string">"my_cool_event"</span>)
<span class="hljs-keyword">end</span></pre><p>You can also pass arguments to the event (there can be any amount, but they must be instances of one of the 5 primitive types):</p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">player_connected</span><span class="hljs-params">(player)</span></span>
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">my_callback</span><span class="hljs-params">(arg1, arg2)</span></span>
<span class="hljs-built_in">print</span>(arg1 .. <span class="hljs-string">" "</span> .. arg2)
<span class="hljs-keyword">end</span>
player:onnotify(<span class="hljs-string">"my_cool_event"</span>, my_callback)
<span class="hljs-comment">-- [...]</span>
<span class="hljs-comment">-- This fires the 'my_cool_event' event</span>
player:notify(<span class="hljs-string">"my_cool_event"</span>, <span class="hljs-string">"Hello"</span>, <span class="hljs-string">"World"</span>)
<span class="hljs-keyword">end</span></pre><h1 id="timers">Timers</h1>
<p>Timers are required to delay the execution. GSC had a function called <code>wait</code>, which paused the execution of a thread for a specific amount of time.<br>Due to the control flow being different in LUA, there are neither threads, nor is there a wait function.</p>
<p>However, you can do something else to delay the execution. The functions <code>ontimeout</code> and <code>oninterval</code>, which need to be called on the <code>game</code> object, allow to do that. They take two arguments, a callback and a time to wait in milliseconds.</p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callback</span><span class="hljs-params">()</span></span>
<span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">end</span>
game:ontimeout(callback, <span class="hljs-number">1000</span>)</pre><p>Similar to the functions <code>setTimeout</code> and <code>setInterval</code> known from JavaScript, <code>ontimeout</code> executes the callback exactly once and <code>oninterval</code> executes it every time the given amount of time passes.</p>
<p>You might want to cancel a timeout or an interval. This can be done exactly like it works for events.<br>Both <code>ontimeout</code> and <code>oninterval</code> return a timer with a <code>clear</code> method:</p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">callback</span><span class="hljs-params">()</span></span>
<span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">local</span> timer = game:oninterval(callback, <span class="hljs-number">1000</span>)
<span class="hljs-comment">-- [...]</span>
timer:clear()</pre><p>Timer callbacks don&#39;t take any arguments. If you want to pass an object, like a player, to a callback, you have to capture it, in a lambda for example:</p>
<pre class="hljs"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">do_something</span><span class="hljs-params">(player)</span></span>
<span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">end</span>
<span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">local</span> player = <span class="hljs-comment">-- [...]</span>
game:oninterval(<span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span> do_something(player) <span class="hljs-keyword">end</span>, <span class="hljs-number">1000</span>)</pre><h1 id="functions">Functions</h1>
<p>The game provides a set of global functions and entity methods.<br>The functions provided are pretty much the same as COD4 had them.<br>You can have a look at a COD4 scripting reference: <a href="https://znation.nl/cod4script/">https://znation.nl/cod4script/</a> (libcod category doesn&#39;t exist in IW6x!)<br>Also note that all functions and methods are lowercase in IW6x!</p>
<p>Global functions are functions that don&#39;t need an entity to work. They need to be called on the <code>game</code> object.<br>In the COD4 scripting reference, these functions don&#39;t have a <code>Call this on:</code> paragraph.<br>Here is an example: </p>
<pre class="hljs">game:ambientplay(<span class="hljs-string">"embient_mp_highrise"</span>);</pre><p>There are also member functions. These do have a paragraph called <code>Call this on:</code> in the COD4 reference.
Here is an example:</p>
<pre class="hljs">player:freezecontrols(<span class="hljs-literal">false</span>)</pre><p>For a list of all functions and methods available in IW6x, you can have a look at the source code:<br><a href="https://github.com/XLabsProject/iw6x-client/blob/develop/src/client/game/scripting/function_tables.cpp">https://github.com/XLabsProject/iw6x-client/blob/develop/src/client/game/scripting/function_tables.cpp</a></p>
<h1 id="fields">Fields</h1>
<p>Entities do have fields (or properties).<br>They differ for each type of entity. For example players have fields like <code>name</code>, <code>origin</code> or <code>angles</code> and hud elements have fields like <code>x</code>, <code>y</code> or <code>alpha</code>.<br>You can get and set them like this (only the 5 primitive types are supported):</p>
<pre class="hljs"><span class="hljs-keyword">local</span> playername = player.name
player.origin = vector:new()</pre><p>Creating new properties or fields does not work yet, so you can&#39;t store own data in an entity.<br>You have to create your own construct for that.</p>
<p>Additionally, there is no complete list of which fields exist. <code>level.players</code> is not a field for example. This was a variable.<br>So not every variable that existed in GSC is available as a field in here. </p>
<h1 id="command-execution">Command execution</h1>
<p>Unlike in GSC, the scripting API allows to execute console commands (for versions &gt; v1.1.0).<br>You can use the <code>executecommand</code> function on the <code>game</code> object like this:</p>
<pre class="hljs">game:executecommand(<span class="hljs-string">"map mp_prisonbreak"</span>)</pre><h1 id="noteworthy-things">Noteworthy things</h1>
<p>Players can disconnect. It might sound obvious, but is important for scripting.<br>Executing functions on a player that doesn&#39;t exist won&#39;t work. Additionally, captured player objects need to be freed.</p>
<p>GSC used to have a function called <code>endon</code>, which allowed to terminate a thread as soon as an event happend, for example <code>player endon(&quot;disconnect&quot;)</code>
stopped the execution, when a player disconnected.</p>
<p>There is no such concept in IW6x. You will need to work with a combination of clearing timers and <code>onnotifyonce</code>, like this:</p>
<pre class="hljs">
<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">do_something</span><span class="hljs-params">()</span></span>
<span class="hljs-comment">-- [...]</span>
<span class="hljs-keyword">end</span>
<span class="hljs-keyword">local</span> timer = game:oninterval(do_something, <span class="hljs-number">1000</span>)
<span class="hljs-comment">-- [...]</span>
player:onnotifyonce(<span class="hljs-string">"disconnect"</span>, <span class="hljs-function"><span class="hljs-keyword">function</span><span class="hljs-params">()</span></span> timer:clear() <span class="hljs-keyword">end</span>)
</pre>
</div> <!-- /div.col-md-9 -->
</div> <!-- /div.row -->
</div> <!-- /div.container -->
</body>
<script>
$('body').scrollspy({ target: '#scroll-spy', offset: 40 })
</script>
</html>