/*
function[281] randomCommands
function[46] enumTest
function[203] testInCommand
function[77] objTest
function[1] onCreated
function[108] testFor
*/

//#CLIENTSIDE
// Enums directly replaced with incremented integers starting at 0
enum {
  EIDLE,
  EWALK,
  ESLASH
};

function onCreated() {
  /*
         8,         5: temp. (189)
         9,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](somethin) (byte)
        12,         7: member access (35)
        13,         8: type(array) (23)
        14,         9: type(variable) (22) (Opcode: 0xF0)  - variable[1](objTest) (byte)
        17,        10: Call function (6)
        18,        11: "=" (50)
  */
  temp.somethin = objTest();
  
  randomCommands();
  testFor();
  testInCommand();
  enumTest();
  
  /*
        43,        28: temp. (189)
        44,        29: type(variable) (22) (Opcode: 0xF0)  - variable[0](somethin) (byte)
        47,        30: member access (35)
        48,        31: Convert to object (36)
        49,        32: type(variable) (22) (Opcode: 0xF0)  - variable[6](pl) (byte)
        52,        33: member access (35)
        53,        34: Convert to object (36)
        54,        35: with (150) (Opcode: 0xF3)  - double(43) (byte)
        57,        36: type(variable) (22) (Opcode: 0xF0)  - variable[7](x) (byte)
        60,        37: Copy last operand (30)
        61,        38: Convert to float (33)
        62,        39: type(number) (20) (Opcode: 0xF3)  - double(5) (byte)
        65,        40: + (60)
        66,        41: "=" (50)
        67,        42: End of with (151)
  */
  with (temp.somethin.pl) {
    x += 5;
  }
}

function enumTest() {
  echo("Enum IDLE: " @ EIDLE);
  echo("Enum WALK: " @ EWALK);
  echo("Enum SLASH: " @ ESLASH);
}

function objTest() {
  /*
       133,        80: temp. (189)
       134,        81: type(variable) (22) (Opcode: 0xF0)  - variable[12](a) (byte)
       137,        82: member access (35)
       138,        83: type(variable) (22) (Opcode: 0xF0)  - variable[13](unknown_object) (byte)
       141,        84: type(string) (21) (Opcode: 0xF0)  - variable[14](TStaticVar) (byte)
       144,        85: new Object? (42)
       145,        86: "=" (50)
  */
  temp.a = new TStaticVar();
  
  /*
       146,        87: temp. (189)
       147,        88: type(variable) (22) (Opcode: 0xF0)  - variable[12](a) (byte)
       150,        89: member access (35)
       151,        90: Convert to object (36)
       152,        91: type(variable) (22) (Opcode: 0xF0)  - variable[15](val) (byte)
       155,        92: member access (35)
       156,        93: type(number) (20) (Opcode: 0xF3)  - double(2) (byte)
       159,        94: "=" (50)
  */
  temp.a.val = 2;
  
  /*
       160,        95: temp. (189)
       161,        96: type(variable) (22) (Opcode: 0xF0)  - variable[12](a) (byte)
       164,        97: member access (35)
       165,        98: Convert to object (36)
       166,        99: type(variable) (22) (Opcode: 0xF0)  - variable[6](pl) (byte)
       169,       100: member access (35)
       170,       101: type(variable) (22) (Opcode: 0xF0)  - variable[16](player) (byte)
       173,       102: "=" (50)
  */
  temp.a.pl = player;
  
  /*
       174,       103: temp. (189)
       175,       104: type(variable) (22) (Opcode: 0xF0)  - variable[12](a) (byte)
       178,       105: member access (35)
       179,       106: }   //End of function code (7)
  */
  return temp.a;
}

function testFor() {
  temp.arr = {"abc", "def", "gh", "ijk"};
  
  echo("foreach");
  for (temp.a : temp.arr) {
    echo(temp.a);
  }
  
  echo("forloop");
  for (temp.i = 0; temp.i < temp.arr.size(); temp.i++) {
    echo(temp.arr[temp.i]);
  }
  
  /*
       343,       195: temp. (189)
       344,       196: type(variable) (22) (Opcode: 0xF0)  - variable[17](arr) (byte)
       347,       197: member access (35)
       348,       198: Convert to object (36)
       349,       199: obj.clear() (141)
  */
  // clear array
  temp.arr.clear();
}

function testInCommand() {
  /*
       362,       207: temp. (189)
       363,       208: type(variable) (22) (Opcode: 0xF0)  - variable[17](arr) (byte)
       366,       209: member access (35)
       367,       210: type(array) (23)
       368,       211: type(string) (21) (Opcode: 0xF0)  - variable[19](ijk) (byte)
       371,       212: type(string) (21) (Opcode: 0xF0)  - variable[20](gh) (byte)
       374,       213: type(string) (21) (Opcode: 0xF0)  - variable[21](def) (byte)
       377,       214: type(string) (21) (Opcode: 0xF0)  - variable[22](abc) (byte)
       380,       215: End of array (37)
       381,       216: "=" (50)
  */
  temp.arr = {"abc", "def", "gh", "ijk"};
  
  /*
       382,       217: type(string) (21) (Opcode: 0xF0)  - variable[20](gh) (byte)
       385,       218: temp. (189)
       386,       219: type(variable) (22) (Opcode: 0xF0)  - variable[17](arr) (byte)
       389,       220: member access (35)
       390,       221: Convert to object (36)
       391,       222: in {} (81)
       392,       223: if (4) (Opcode: 0xF4)  - double(229) (word)
       396,       224: type(array) (23)
       397,       225: type(string) (21) (Opcode: 0xF0)  - variable[25](found) (byte)
       400,       226: type(variable) (22) (Opcode: 0xF0)  - variable[9](echo) (byte)
       403,       227: Call function (6)
       404,       228: Decrease last operand index by 1 (32)
  */
  if ("gh" in temp.arr) {
    echo("found");
  }
  
  /*
       405,       229: temp. (189)
       406,       230: type(variable) (22) (Opcode: 0xF0)  - variable[18](i) (byte)
       409,       231: member access (35)
       410,       232: type(array) (23)
       411,       233: player. (182)
       412,       234: type(variable) (22) (Opcode: 0xF0)  - variable[26](y) (byte)
       415,       235: member access (35)
       416,       236: player. (182)
       417,       237: type(variable) (22) (Opcode: 0xF0)  - variable[7](x) (byte)
       420,       238: member access (35)
       421,       239: End of array (37)
       422,       240: type(number) (20) (Opcode: 0xF3)  - double(20) (byte)
       425,       241: type(number) (20) (Opcode: 0xF3)  - double(40) (byte)
       428,       242: in <> (80) (Opcode: 0xF3)  - double(3) (byte)
       431,       243: "=" (50)
  */
  temp.i = ({playerx,playery} in <20,40>);
  
  /*
       432,       244: type(array) (23)
       433,       245: type(string) (21) (Opcode: 0xF0)  - variable[27](valid: ) (byte)
       436,       246: temp. (189)
       437,       247: type(variable) (22) (Opcode: 0xF0)  - variable[18](i) (byte)
       440,       248: member access (35)
       441,       249: Convert to string (34)
       442,       250: @ (113)
       443,       251: type(variable) (22) (Opcode: 0xF0)  - variable[9](echo) (byte)
       446,       252: Call function (6)
       447,       253: Decrease last operand index by 1 (32)
  */
  echo("valid: " @ temp.i);
  
  /*
       448,       254: type(variable) (22) (Opcode: 0xF0)  - variable[28](v) (byte)
       451,       255: player. (182)
       452,       256: type(variable) (22) (Opcode: 0xF0)  - variable[7](x) (byte)
       455,       257: member access (35)
       456,       258: type(number) (20) (Opcode: 0xF3)  - double(20) (byte)
       459,       259: type(number) (20) (Opcode: 0xF3)  - double(40) (byte)
       462,       260: in <> (80) (Opcode: 0xF3)  - double(3) (byte)
       465,       261: && (5) (Opcode: 0xF4)  - double(268) (word)
       469,       262: player. (182)
       470,       263: type(variable) (22) (Opcode: 0xF0)  - variable[26](y) (byte)
       473,       264: member access (35)
       474,       265: type(number) (20) (Opcode: 0xF3)  - double(20) (byte)
       477,       266: type(number) (20) (Opcode: 0xF3)  - double(40) (byte)
       480,       267: in <> (80) (Opcode: 0xF3)  - double(3) (byte)
       483,       268: End of inline conditional? (44)
       484,       269: "=" (50)
  */
  v = (playerx in <20,40> && playery in <20,40>);

  /*
       485,       270: type(array) (23)
       486,       271: type(string) (21) (Opcode: 0xF0)  - variable[27](valid: ) (byte)
       489,       272: type(variable) (22) (Opcode: 0xF0)  - variable[28](v) (byte)
       492,       273: Convert to string (34)
       493,       274: @ (113)
       494,       275: type(variable) (22) (Opcode: 0xF0)  - variable[9](echo) (byte)
       497,       276: Call function (6)
       498,       277: Decrease last operand index by 1 (32)
  */
  echo("valid: " @ v);
}

function randomCommands() {
  // expect dec --- actual: was removed from bytecode
  format("Hello, %s. You ate %i apples today!", "Mr. Skyld", 4);
  
  /*
       511,       285: this. (180)
       512,       286: type(variable) (22) (Opcode: 0xF0)  - variable[29](str) (byte)
       515,       287: member access (35)
       516,       288: type(array) (23)
       517,       289: type(number) (20) (Opcode: 0xF3)  - double(4) (byte)
       520,       290: type(string) (21) (Opcode: 0xF0)  - variable[30](Mr. Skyld) (byte)
       523,       291: type(string) (21) (Opcode: 0xF0)  - variable[31](Hello, %s. You ate %i apples today!) (byte)
       526,       292: format() (84)
       527,       293: "=" (50)
  */
  this.str = format("Hello, %s. You ate %i apples today!", "Mr. Skyld", 4);
  
  /*
       528,       294: this. (180)
       529,       295: type(variable) (22) (Opcode: 0xF0)  - variable[32](strpos) (byte)
       532,       296: member access (35)
       533,       297: this. (180)
       534,       298: type(variable) (22) (Opcode: 0xF0)  - variable[29](str) (byte)
       537,       299: member access (35)
       538,       300: Convert to string (34)
       539,       301: type(string) (21) (Opcode: 0xF0)  - variable[33](Skyld) (byte)
       542,       302: obj.pos() (112)
       543,       303: "=" (50)
  */
  this.strpos = this.str.pos("Skyld");

  /*
       544,       304: type(array) (23)
       545,       305: type(string) (21) (Opcode: 0xF0)  - variable[34](pos: ) (byte)
       548,       306: this. (180)
       549,       307: type(variable) (22) (Opcode: 0xF0)  - variable[32](strpos) (byte)
       552,       308: member access (35)
       553,       309: Convert to string (34)
       554,       310: @ (113)
       555,       311: type(variable) (22) (Opcode: 0xF0)  - variable[9](echo) (byte)
       558,       312: Call function (6)
       559,       313: Decrease last operand index by 1 (32)
  */
  echo("pos: " @ this.strpos);

  /*
       560,       314: thiso. (181)
       561,       315: type(variable) (22) (Opcode: 0xF0)  - variable[17](arr) (byte)
       564,       316: member access (35)
       565,       317: type(array) (23)
       566,       318: type(string) (21) (Opcode: 0xF0)  - variable[35](etc) (byte)
       569,       319: type(string) (21) (Opcode: 0xF0)  - variable[36](second member) (byte)
       572,       320: type(string) (21) (Opcode: 0xF0)  - variable[37](First member) (byte)
       575,       321: End of array (37)
       576,       322: "=" (50)
  */
  thiso.arr = {"First member", "second member", "etc"};

  /*
       577,       323: type(array) (23)
       578,       324: type(string) (21) (Opcode: 0xF0)  - variable[38](size: ) (byte)
       581,       325: thiso. (181)
       582,       326: type(variable) (22) (Opcode: 0xF0)  - variable[17](arr) (byte)
       585,       327: member access (35)
       586,       328: Convert to object (36)
       587,       329: obj.size() (130)
       588,       330: Convert to string (34)
       589,       331: @ (113)
       590,       332: type(variable) (22) (Opcode: 0xF0)  - variable[9](echo) (byte)
       593,       333: Call function (6)
       594,       334: Decrease last operand index by 1 (32)
  */
  echo("size: " @ thiso.arr.size());
  
  /*
       595,       335: temp. (189)
       596,       336: type(variable) (22) (Opcode: 0xF0)  - variable[39](num) (byte)
       599,       337: member access (35)
       600,       338: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
       603,       339: type(number) (20) (Opcode: 0xF3)  - double(10) (byte)
       606,       340: random() (87)
       607,       341: Convert to float (33)
       608,       342: type(number) (20) (Opcode: 0xF3)  - double(7) (byte)
       611,       343: max() (94)
       612,       344: "=" (50)
  */
  temp.num = max(random(1, 10), 7);
  
  /*
       613,       345: temp. (189)
       614,       346: type(variable) (22) (Opcode: 0xF0)  - variable[40](tvar) (byte)
       617,       347: member access (35)
       618,       348: type(array) (23)
       619,       349: type(variable) (22) (Opcode: 0xF0)  - variable[41](timevar2) (byte)
       622,       350: type(variable) (22) (Opcode: 0xF0)  - variable[42](timevar) (byte)
       625,       351: End of array (37)
       626,       352: "=" (50)
  */
  temp.tvar = {timevar, timevar2};

  /*
    38: PushVariable        this
    39: ConvertToString
    40: PushString          foo
    41: PushNumber          7200
    42: WaitFor
  */
  waitfor(this, "foo", 7200);
}

//===================================================

function onCreated() {
  this.obj = {"abcd", "efgh", "i"};
  this.obj.add("test");
  this.obj.delete(0);
  this.obj.remove("i");
  this.obj.insert(1, "alpha");
  this.obj.replace(2, "bravo");
  
  this.teststr = "Teststr";
  this.teststr = this.teststr.lower();
  this.teststr = this.teststr.upper();
  
  this.obj2 = {};
  temp.arr1 = {"abc", "def", "ghi"};
  temp.arr2 = {"jkl", "mno", "pqr"};
  this.obj2.addarray(temp.arr2);
  this.obj2.insertarray(1, temp.arr1);

  this.test36 = "hi";
  temp.v = "36";
  echo(makevar("this.test" @ temp.v));

  temp.val = serverr.someflag;
  echo(temp.val);
  
  temp.randfloat = float("420.69");
  echo(temp.randfloat);

  temp.escapestr = "test',str";
  echo(temp.escapestr.escape());
  
  sleep(0.1);

  arrayInit();
  testLoop();
}

function arrayInit()
{
  this.obj3 = new[4];  
  this.obj3[1] = "hi";

  this.obj4 = new[4][2][1];

  this.obj5 = this.getfunctions();
  this.obj6 = this.getvarnames();
  this.obj7 = this.getdynamicvarnames();
  this.obj8 = this.geteditvarnames();
  this.obj9 = this.getstaticvarnames();
}

function testLoop()
{
  for (temp.v : this.obj) {
    echo("T: " @ temp.v);
  }
}

//=========================================

//#CLIENTSIDE
function onCreated() {
/*
         8,         5: this. (180)
         9,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        12,         7: member access (35)
        13,         8: type(array) (23)
        14,         9: type(string) (21) (Opcode: 0xF0)  - variable[1](i) (byte)
        17,        10: type(string) (21) (Opcode: 0xF0)  - variable[2](efgh) (byte)
        20,        11: type(string) (21) (Opcode: 0xF0)  - variable[3](abcd) (byte)
        23,        12: End of array (37)
        24,        13: "=" (50)
*/
  this.obj = {"abcd", "efgh", "i"};

/*
        25,        14: this. (180)
        26,        15: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        29,        16: member access (35)
        30,        17: Convert to object (36)
        31,        18: type(string) (21) (Opcode: 0xF0)  - variable[4](test) (byte)
        34,        19: addstring() (136)
*/
  this.obj.add("test");

/*
        35,        20: this. (180)
        36,        21: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        39,        22: member access (35)
        40,        23: Convert to object (36)
        41,        24: type(number) (20) (Opcode: 0xF3)  - double(0) (byte)
        44,        25: deletestring() (137)
*/
  this.obj.delete(0);

/*
        45,        26: this. (180)
        46,        27: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        49,        28: member access (35)
        50,        29: Convert to object (36)
        51,        30: type(string) (21) (Opcode: 0xF0)  - variable[1](i) (byte)
        54,        31: removestring() (138)
*/
  this.obj.remove("i");

/*
        55,        32: this. (180)
        56,        33: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        59,        34: member access (35)
        60,        35: Convert to object (36)
        61,        36: type(string) (21) (Opcode: 0xF0)  - variable[5](alpha) (byte)
        64,        37: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
        67,        38: insertstring() (140)
*/
  this.obj.insert(1, "alpha");

/*
        68,        39: this. (180)
        69,        40: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        72,        41: member access (35)
        73,        42: Convert to object (36)
        74,        43: type(string) (21) (Opcode: 0xF0)  - variable[6](bravo) (byte)
        77,        44: type(number) (20) (Opcode: 0xF3)  - double(2) (byte)
        80,        45: replacestring() (139)
*/
  this.obj.replace(2, "bravo");
  
/*
        81,        46: this. (180)
        82,        47: type(variable) (22) (Opcode: 0xF0)  - variable[7](teststr) (byte)
        85,        48: member access (35)
        86,        49: type(string) (21) (Opcode: 0xF0)  - variable[8](Teststr) (byte)
        89,        50: "=" (50)
*/
  this.teststr = "Teststr";

/*
        90,        51: this. (180)
        91,        52: type(variable) (22) (Opcode: 0xF0)  - variable[7](teststr) (byte)
        94,        53: member access (35)
        95,        54: type(array) (23)
        96,        55: this. (180)
        97,        56: type(variable) (22) (Opcode: 0xF0)  - variable[7](teststr) (byte)
       100,        57: member access (35)
       101,        58: Convert to string (34)
       102,        59: type(variable) (22) (Opcode: 0xF0)  - variable[9](lowercase) (byte)
       105,        60: Call function (6)
       106,        61: "=" (50)
*/
  this.teststr = this.teststr.lower();

/*
       107,        62: this. (180)
       108,        63: type(variable) (22) (Opcode: 0xF0)  - variable[7](teststr) (byte)
       111,        64: member access (35)
       112,        65: type(array) (23)
       113,        66: this. (180)
       114,        67: type(variable) (22) (Opcode: 0xF0)  - variable[7](teststr) (byte)
       117,        68: member access (35)
       118,        69: Convert to string (34)
       119,        70: type(variable) (22) (Opcode: 0xF0)  - variable[10](uppercase) (byte)
       122,        71: Call function (6)
       123,        72: "=" (50)
*/
  this.teststr = this.teststr.upper();
  
/*
       124,        73: this. (180)
       125,        74: type(variable) (22) (Opcode: 0xF0)  - variable[11](obj2) (byte)
       128,        75: member access (35)
       129,        76: type(array) (23)
       130,        77: End of array (37)
       131,        78: "=" (50)
*/
  this.obj2 = {};

/*
       132,        79: temp. (189)
       133,        80: type(variable) (22) (Opcode: 0xF0)  - variable[12](arr1) (byte)
       136,        81: member access (35)
       137,        82: type(array) (23)
       138,        83: type(string) (21) (Opcode: 0xF0)  - variable[13](ghi) (byte)
       141,        84: type(string) (21) (Opcode: 0xF0)  - variable[14](def) (byte)
       144,        85: type(string) (21) (Opcode: 0xF0)  - variable[15](abc) (byte)
       147,        86: End of array (37)
       148,        87: "=" (50)
*/
  temp.arr1 = {"abc", "def", "ghi"};

/*
       149,        88: temp. (189)
       150,        89: type(variable) (22) (Opcode: 0xF0)  - variable[16](arr2) (byte)
       153,        90: member access (35)
       154,        91: type(array) (23)
       155,        92: type(string) (21) (Opcode: 0xF0)  - variable[17](pqr) (byte)
       158,        93: type(string) (21) (Opcode: 0xF0)  - variable[18](mno) (byte)
       161,        94: type(string) (21) (Opcode: 0xF0)  - variable[19](jkl) (byte)
       164,        95: End of array (37)
       165,        96: "=" (50)
*/
  temp.arr2 = {"jkl", "mno", "pqr"};

/*
       166,        97: type(array) (23)
       167,        98: temp. (189)
       168,        99: type(variable) (22) (Opcode: 0xF0)  - variable[16](arr2) (byte)
       171,       100: member access (35)
       172,       101: this. (180)
       173,       102: type(variable) (22) (Opcode: 0xF0)  - variable[11](obj2) (byte)
       176,       103: member access (35)
       177,       104: Convert to object (36)
       178,       105: type(variable) (22) (Opcode: 0xF0)  - variable[20](addarray) (byte)
       181,       106: member access (35)
       182,       107: Call function (6)
       183,       108: Decrease last operand index by 1 (32)
*/
  this.obj2.addarray(temp.arr2);

/*
       184,       109: type(array) (23)
       185,       110: temp. (189)
       186,       111: type(variable) (22) (Opcode: 0xF0)  - variable[12](arr1) (byte)
       189,       112: member access (35)
       190,       113: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
       193,       114: this. (180)
       194,       115: type(variable) (22) (Opcode: 0xF0)  - variable[11](obj2) (byte)
       197,       116: member access (35)
       198,       117: Convert to object (36)
       199,       118: type(variable) (22) (Opcode: 0xF0)  - variable[21](insertarray) (byte)
       202,       119: member access (35)
       203,       120: Call function (6)
       204,       121: Decrease last operand index by 1 (32)
*/
  this.obj2.insertarray(1, temp.arr1);

/*
       205,       122: this. (180)
       206,       123: type(variable) (22) (Opcode: 0xF0)  - variable[22](test36) (byte)
       209,       124: member access (35)
       210,       125: type(string) (21) (Opcode: 0xF0)  - variable[23](hi) (byte)
       213,       126: "=" (50)
*/
  this.test36 = "hi";

/*
       214,       127: temp. (189)
       215,       128: type(variable) (22) (Opcode: 0xF0)  - variable[24](v) (byte)
       218,       129: member access (35)
       219,       130: type(string) (21) (Opcode: 0xF0)  - variable[25](36) (byte)
       222,       131: "=" (50)
*/
  temp.v = "36";

/*
       223,       132: type(array) (23)
       224,       133: type(string) (21) (Opcode: 0xF0)  - variable[26](this.test) (byte)
       227,       134: temp. (189)
       228,       135: type(variable) (22) (Opcode: 0xF0)  - variable[24](v) (byte)
       231,       136: member access (35)
       232,       137: Convert to string (34)
       233,       138: @ (113)
       234,       139: makevar() (41)
       235,       140: type(variable) (22) (Opcode: 0xF0)  - variable[27](echo) (byte)
       238,       141: Call function (6)
       239,       142: Decrease last operand index by 1 (32)
*/
  echo(makevar("this.test" @ temp.v));

/*
       240,       143: temp. (189)
       241,       144: type(variable) (22) (Opcode: 0xF0)  - variable[28](val) (byte)
       244,       145: member access (35)
       245,       146: type(variable) (22) (Opcode: 0xF0)  - variable[29](serverr) (byte)
       248,       147: Convert to object (36)
       249,       148: type(variable) (22) (Opcode: 0xF0)  - variable[30](someflag) (byte)
       252,       149: member access (35)
       253,       150: "=" (50)
*/
  temp.val = serverr.someflag;
  echo(temp.val);
  
  temp.randfloat = float("420.69");
  echo(temp.randfloat);

  temp.escapestr = "test',str";
  echo(temp.escapestr.escape());
  
/*
       312,       187: type(number) (20) (Opcode: 0xF6)  - double(0.1) (string)
       317,       188: sleep() (8)
*/
  sleep(0.1);

  arrayInit();
  testLoop();
}

function arrayInit()
{
/*
       342,       204: this. (180)
       343,       205: type(variable) (22) (Opcode: 0xF0)  - variable[38](obj3) (byte)
       346,       206: member access (35)
       347,       207: type(number) (20) (Opcode: 0xF3)  - double(4) (byte)
       350,       208: new[] (38)
       351,       209: "=" (50)
*/
  this.obj3 = new[4];

/*
       352,       210: this. (180)
       353,       211: type(variable) (22) (Opcode: 0xF0)  - variable[38](obj3) (byte)
       356,       212: member access (35)
       357,       213: Convert to object (36)
       358,       214: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
       361,       215: type(string) (21) (Opcode: 0xF0)  - variable[23](hi) (byte)
       364,       216: Array assignment (132)
*/
  this.obj3[1] = "hi";

/*
       365,       217: this. (180)
       366,       218: type(variable) (22) (Opcode: 0xF0)  - variable[39](obj4) (byte)
       369,       219: member access (35)
       370,       220: type(number) (20) (Opcode: 0xF3)  - double(4) (byte)
       373,       221: new[] (38)
       374,       222: type(number) (20) (Opcode: 0xF3)  - double(2) (byte)
       377,       223: new[][] for each extra dimension (142)
       378,       224: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
       381,       225: new[][] for each extra dimension (142)
       382,       226: "=" (50)
*/
  this.obj4 = new[4][2][1];

/*
       383,       227: this. (180)
       384,       228: type(variable) (22) (Opcode: 0xF0)  - variable[40](obj5) (byte)
       387,       229: member access (35)
       388,       230: type(array) (23)
       389,       231: this. (180)
       390,       232: type(variable) (22) (Opcode: 0xF0)  - variable[41](getfunctions) (byte)
       393,       233: member access (35)
       394,       234: Call function (6)
       395,       235: "=" (50)
*/
  this.obj5 = this.getfunctions();

/*
       396,       236: this. (180)
       397,       237: type(variable) (22) (Opcode: 0xF0)  - variable[42](obj6) (byte)
       400,       238: member access (35)
       401,       239: type(array) (23)
       402,       240: this. (180)
       403,       241: type(variable) (22) (Opcode: 0xF0)  - variable[43](getvarnames) (byte)
       406,       242: member access (35)
       407,       243: Call function (6)
       408,       244: "=" (50)
*/
  this.obj6 = this.getvarnames();

/*
       409,       245: this. (180)
       410,       246: type(variable) (22) (Opcode: 0xF0)  - variable[44](obj7) (byte)
       413,       247: member access (35)
       414,       248: type(array) (23)
       415,       249: this. (180)
       416,       250: type(variable) (22) (Opcode: 0xF0)  - variable[45](getdynamicvarnames) (byte)
       419,       251: member access (35)
       420,       252: Call function (6)
       421,       253: "=" (50)
*/
  this.obj7 = this.getdynamicvarnames();

/*
       422,       254: this. (180)
       423,       255: type(variable) (22) (Opcode: 0xF0)  - variable[46](obj8) (byte)
       426,       256: member access (35)
       427,       257: type(array) (23)
       428,       258: this. (180)
       429,       259: type(variable) (22) (Opcode: 0xF0)  - variable[47](geteditvarnames) (byte)
       432,       260: member access (35)
       433,       261: Call function (6)
       434,       262: "=" (50)
*/
  this.obj8 = this.geteditvarnames();

/*
       435,       263: this. (180)
       436,       264: type(variable) (22) (Opcode: 0xF0)  - variable[48](obj9) (byte)
       439,       265: member access (35)
       440,       266: type(array) (23)
       441,       267: this. (180)
       442,       268: type(variable) (22) (Opcode: 0xF0)  - variable[49](getstaticvarnames) (byte)
       445,       269: member access (35)
       446,       270: Call function (6)
       447,       271: "=" (50)
*/
  this.obj9 = this.getstaticvarnames();
}

/*
    // loop var 0: temp.v
    // loop var 1: echo
    // loop var 2: this.obj

      452,       274: Set operation index (1) (Opcode: 0xF4)  - double(316) (word)
       456,       275: type(array) (23)
       457,       276: End of function definition parameters (51)
       458,       277: { //Start of function code? (10)
       459,       278: Start of function call? (9)
       460,       279: temp. (189)
       461,       280: type(variable) (22) (Opcode: 0xF0)  - variable[24](v) (byte)
       464,       281: member access (35)
       465,       282: Mark as loop variable (47)
       466,       283: Assign loop variable index (45) (Opcode: 0xF3)  - double(0) (byte)
       469,       284: Decrease last operand index by 1 (32)
       470,       285: type(variable) (22) (Opcode: 0xF0)  - variable[27](echo) (byte)
       473,       286: Mark as loop variable (47)
       474,       287: Assign loop variable index (45) (Opcode: 0xF3)  - double(1) (byte)
       477,       288: Decrease last operand index by 1 (32)
       478,       289: this. (180)
       479,       290: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
       482,       291: member access (35)
       483,       292: Mark as loop variable (47)
       484,       293: Assign loop variable index (45) (Opcode: 0xF3)  - double(2) (byte)
       487,       294: Decrease last operand index by 1 (32)
       488,       295: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       491,       296: Loop variable (46) (Opcode: 0xF3)  - double(2) (byte)
       494,       297: Convert to object (36)
       495,       298: type(number) (20) (Opcode: 0xF3)  - double(0) (byte)
       498,       299: for (a: b) (163) (Opcode: 0xF4)  - double(311) (word)

       502,       300: Start of function call? (9)
       503,       301: type(array) (23)
       504,       302: type(string) (21) (Opcode: 0xF0)  - variable[50](T: ) (byte)
       507,       303: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       510,       304: Convert to string (34)
       511,       305: @ (113)
       512,       306: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
       515,       307: Call function (6)

       516,       308: Decrease last operand index by 1 (32)
       517,       309: Increment by 1 (52)
       518,       310: Set operation index (1) (Opcode: 0xF4)  - double(299) (word)
       522,       311: Decrease last operand index by 1 (32)
       523,       312: Decrease last operand index by 1 (32)
       524,       313: Decrease last operand index by 1 (32)
       525,       314: type(number) (20) (Opcode: 0xF3)  - double(0) (byte)
       528,       315: }   //End of function code (7)
*/

function testLoop()
{
  for (temp.v : this.obj) {
    echo("T: " @ temp.v);
  }
}



function onCreated() {
/*
         7,         5: type(array) (23)
         8,         6: type(string) (21) (Opcode: 0xF0)  - variable[0](test: ) (byte)
        11,         7: player. (182)
        12,         8: type(variable) (22) (Opcode: 0xF0)  - variable[1](x) (byte)
        15,         9: member access (35)
        16,        10: Convert to float (33)
        17,        11: type(number) (20) (Opcode: 0xF3)  - double(5) (byte)
        20,        12: - binary (61)
        21,        13: Convert to string (34)
        22,        14: @ (113)
        23,        15: type(variable) (22) (Opcode: 0xF0)  - variable[2](echo) (byte)
        26,        16: Call function (6)
        27,        17: Decrease last operand index by 1 (32)
*/
  echo("test: " @ (player.x - 5));
}


//#CLIENTSIDE
function onCreated()
{
/*
         7,         5: temp. (189)
         8,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](g) (byte)
        11,         7: member access (35)
        12,         8: Mark as loop variable (47)
        13,         9: Assign loop variable index (45) (Opcode: 0xF3)  - double(0) (byte)
        16,        10: Decrease last operand index by 1 (32)
*/



/*
        17,        11: temp. (189)
        18,        12: type(variable) (22) (Opcode: 0xF0)  - variable[1](b) (byte)
        21,        13: member access (35)
        22,        14: type(variable) (22) (Opcode: 0xF0)  - variable[2](unknown_object) (byte)
        25,        15: type(string) (21) (Opcode: 0xF0)  - variable[3](TStaticVar) (byte)
        28,        16: new Object? (42)
        29,        17: "=" (50)
*/
  temp.b = new TStaticVar();

/*
        30,        18: temp. (189)
        31,        19: type(variable) (22) (Opcode: 0xF0)  - variable[1](b) (byte)
        34,        20: member access (35)
        35,        21: Convert to object (36)
        36,        22: type(variable) (22) (Opcode: 0xF0)  - variable[4](c) (byte)
        39,        23: member access (35)
        40,        24: type(string) (21) (Opcode: 0xF0)  - variable[5](hi) (byte)
        43,        25: "=" (50)
*/
  temp.b.c = "hi";

/*
        44,        26: temp. (189)
        45,        27: type(variable) (22) (Opcode: 0xF0)  - variable[6](a) (byte)
        48,        28: member access (35)
        49,        29: type(variable) (22) (Opcode: 0xF0)  - variable[2](unknown_object) (byte)
        52,        30: type(string) (21) (Opcode: 0xF0)  - variable[3](TStaticVar) (byte)
        55,        31: new Object? (42)
        56,        32: "=" (50)
*/
  temp.a = new TStaticVar("test", "djer", temp.b);

/*
        57,        33: temp. (189)
        58,        34: type(variable) (22) (Opcode: 0xF0)  - variable[6](a) (byte)
        61,        35: member access (35)
        62,        36: Convert to object (36)
        63,        37: type(variable) (22) (Opcode: 0xF0)  - variable[7](ekjf) (byte)
        66,        38: member access (35)
        67,        39: type(string) (21) (Opcode: 0xF0)  - variable[8](ee) (byte)
        70,        40: "=" (50)
*/
  temp.a.ekjf = "ee";

/*
        71,        41: temp. (189)
        72,        42: type(variable) (22) (Opcode: 0xF0)  - variable[9](d) (byte)
        75,        43: member access (35)
        76,        44: type(variable) (22) (Opcode: 0xF0)  - variable[10](Something) (byte)
        79,        45: inline new? (40)
        80,        46: type(string) (21) (Opcode: 0xF0)  - variable[11](GuiButtonCtrl) (byte)
        83,        47: new Object? (42)
        84,        48: "=" (50)
*/
  temp.d = new GuiButtonCtrl(Something);

/*
        85,        49: temp. (189)
        86,        50: type(variable) (22) (Opcode: 0xF0)  - variable[9](d) (byte)
        89,        51: member access (35)
        90,        52: Convert to object (36)
        91,        53: type(variable) (22) (Opcode: 0xF0)  - variable[12](text) (byte)
        94,        54: member access (35)
        95,        55: type(string) (21) (Opcode: 0xF0)  - variable[13](test btn: ) (byte)
        98,        56: temp. (189)
        99,        57: type(variable) (22) (Opcode: 0xF0)  - variable[6](a) (byte)
       102,        58: member access (35)
       103,        59: Convert to object (36)
       104,        60: type(variable) (22) (Opcode: 0xF0)  - variable[7](ekjf) (byte)
       107,        61: member access (35)
       108,        62: Convert to string (34)
       109,        63: @ (113)
       110,        64: "=" (50)
*/
  temp.d.text = "test btn: " @ temp.a.ekjf;

/*
       111,        65: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       114,        66: type(number) (20) (Opcode: 0xF3)  - double(0) (byte)
       117,        67: "=" (50)
       118,        68: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       121,        69: Convert to float (33)
       122,        70: type(number) (20) (Opcode: 0xF3)  - double(5) (byte)
       125,        71: < (72)
       126,        72: if (4) (Opcode: 0xF3)  - double(78) (byte)
       129,        73: Start of function call? (9)
       130,        74: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       133,        75: Increment by 1 (52)
       134,        76: Decrease last operand index by 1 (32)
       135,        77: Set operation index (1) (Opcode: 0xF3)  - double(68) (byte)
*/
  temp.g = 0;
  while (temp.g < 5) {
    temp.g++;
  }

/*
       138,        78: type(array) (23)
       139,        79: type(string) (21) (Opcode: 0xF0)  - variable[14](Test: ) (byte)
       142,        80: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       145,        81: Convert to string (34)
       146,        82: @ (113)
       147,        83: type(variable) (22) (Opcode: 0xF0)  - variable[15](echo) (byte)
       150,        84: Call function (6)
       151,        85: Decrease last operand index by 1 (32)
*/
  echo("Test: " @ temp.g);
}


function onCreated() {
/*
         7,         5: type(array) (23)
         8,         6: type(string) (21) (Opcode: 0xF0)  - variable[0](--start) (byte)
        11,         7: type(variable) (22) (Opcode: 0xF0)  - variable[1](echo) (byte)
        14,         8: Call function (6)
        15,         9: Decrease last operand index by 1 (32)
*/
    echo("--start");


/*
        16,        10: type(variable) (22) (Opcode: 0xF0)  - variable[2](ObjName) (byte)
        19,        11: inline new? (40)
        20,        12: Copy last operand (30)
        21,        13: Copy last operand (30)
        22,        14: Copy last operand (30)
        23,        15: type(string) (21) (Opcode: 0xF0)  - variable[3](GuiButtonCtrl) (byte)
        26,        16: Convert to string (34)
        27,        17: new Object? (42)
        28,        18: "=" (50)
*/
    new GuiButtonCtrl(ObjName)
    {
/*
        29,        19: Convert to object (36)
        30,        20: with (150) (Opcode: 0xF3)  - double(43) (byte)
        33,        21: type(variable) (22) (Opcode: 0xF0)  - variable[4](profile) (byte)
        36,        22: type(variable) (22) (Opcode: 0xF0)  - variable[5](GuiBlueButtonProfile) (byte)
        39,        23: "=" (50)
        40,        24: type(variable) (22) (Opcode: 0xF0)  - variable[6](text) (byte)
        43,        25: type(string) (21) (Opcode: 0xF0)  - variable[7](button) (byte)
        46,        26: "=" (50)
        47,        27: type(variable) (22) (Opcode: 0xF0)  - variable[8](x) (byte)
        50,        28: type(number) (20) (Opcode: 0xF3)  - double(30) (byte)
        53,        29: "=" (50)
        54,        30: type(variable) (22) (Opcode: 0xF0)  - variable[9](y) (byte)
        57,        31: type(number) (20) (Opcode: 0xF3)  - double(30) (byte)
        60,        32: "=" (50)
        61,        33: type(variable) (22) (Opcode: 0xF0)  - variable[10](width) (byte)
        64,        34: type(number) (20) (Opcode: 0xF4)  - double(150) (word)
        68,        35: "=" (50)
        69,        36: type(variable) (22) (Opcode: 0xF0)  - variable[11](height) (byte)
        72,        37: type(number) (20) (Opcode: 0xF4)  - double(150) (word)
        76,        38: "=" (50)
        77,        39: type(variable) (22) (Opcode: 0xF0)  - variable[12](visible) (byte)
        80,        40: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
        83,        41: "=" (50)
        84,        42: End of with (151)
*/
      profile = GuiBlueButtonProfile;
      text = "button";
      x = 30;
      y = 30;
      width = 150;
      height = 150;
      visible = 1;
    };

/*
        85,        43: type(array) (23)
        86,        44: Swap last two operands (31)
        87,        45: type(variable) (22) (Opcode: 0xF0)  - variable[13](addcontrol) (byte)
        90,        46: Call function (6)
        91,        47: Decrease last operand index by 1 (32)
*/

/*
        92,        48: type(array) (23)
        93,        49: type(string) (21) (Opcode: 0xF0)  - variable[14](--end) (byte)
        96,        50: type(variable) (22) (Opcode: 0xF0)  - variable[1](echo) (byte)
        99,        51: Call function (6)
       100,        52: Decrease last operand index by 1 (32)
*/
    echo("--end");
}


/*
output:
Test 1: 4
Test 2: 4
Test 3: 4
Test 4: 4
Test 5: -5
Test 6: 1
Test 7: 0
Test 8: 0
*/
function onCreated()
{
  temp.i = 5;
/*
        32,        18: type(array) (23)
        33,        19: type(string) (21) (Opcode: 0xF0)  - variable[2](Test 1: ) (byte)
        36,        20: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        39,        21: Decrement by 1 (53)
        40,        22: Convert to string (34)
        41,        23: @ (113)
        42,        24: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        45,        25: Call function (6)
        46,        26: Decrease last operand index by 1 (32)
*/
  echo("Test 1: " @ --temp.i);

  /*
        47,        27: type(array) (23)
        48,        28: type(string) (21) (Opcode: 0xF0)  - variable[3](Test 2: ) (byte)
        51,        29: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        54,        30: Copy last operand (30)
        55,        31: Convert to float (33)
        56,        32: Swap last two operands (31)
        57,        33: Decrement by 1 (53)
        58,        34: Decrease last operand index by 1 (32)
        59,        35: Convert to string (34)
        60,        36: @ (113)
        61,        37: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        64,        38: Call function (6)
        65,        39: Decrease last operand index by 1 (32)
  */
  echo("Test 2: " @ temp.i--);

/*
        66,        40: type(array) (23)
        67,        41: type(string) (21) (Opcode: 0xF0)  - variable[4](Test 3: ) (byte)
        70,        42: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        73,        43: Increment by 1 (52)
        74,        44: Convert to string (34)
        75,        45: @ (113)
        76,        46: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        79,        47: Call function (6)
        80,        48: Decrease last operand index by 1 (32)
*/
  echo("Test 3: " @ ++temp.i);

/*
        81,        49: type(array) (23)
        82,        50: type(string) (21) (Opcode: 0xF0)  - variable[5](Test 4: ) (byte)
        85,        51: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        88,        52: Copy last operand (30)
        89,        53: Convert to float (33)
        90,        54: Swap last two operands (31)
        91,        55: Increment by 1 (52)
        92,        56: Decrease last operand index by 1 (32)
        93,        57: Convert to string (34)
        94,        58: @ (113)
        95,        59: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        98,        60: Call function (6)
        99,        61: Decrease last operand index by 1 (32)
*/
  echo("Test 4: " @ temp.i++);

/*
       100,        62: type(array) (23)
       101,        63: type(string) (21) (Opcode: 0xF0)  - variable[6](Test 5: ) (byte)
       104,        64: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
       107,        65: Convert to float (33)
       108,        66: - unary (69)
       109,        67: Convert to string (34)
       110,        68: @ (113)
       111,        69: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       114,        70: Call function (6)
       115,        71: Decrease last operand index by 1 (32)
*/
  echo("Test 5: " @ -temp.i);

  temp.i = 0;

/*
       123,        75: type(array) (23)
       124,        76: type(string) (21) (Opcode: 0xF0)  - variable[7](Test 6: ) (byte)
       127,        77: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
       130,        78: Convert to float (33)
       131,        79: ! (68)
       132,        80: Convert to string (34)
       133,        81: @ (113)
       134,        82: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       137,        83: Call function (6)
       138,        84: Decrease last operand index by 1 (32)
*/
  echo("Test 6: " @ !temp.i);

  temp.i = 1;
  echo("Test 7: " @ !temp.i);
  
  temp.i = 2;
  echo("Test 8: " @ !temp.i);
}




function onMouseDown(temp.mtype)
{
  if (temp.mtype == "left") {
    this.pid = onFindPlayers();

    if (this.pid >= 0)
    {
      if (this.pid == 0)
      {
        player.showProfile();
      }
        else
      {
        onShowMenu();
      }
    }
  }
}

function onFindPlayers()
{
  // Method 1 - UNTESTED -
  /*temp.found = testplayer(mousex, mousey);
  
  if (temp.found)
  {
    return temp.found;
  }
    else
  {
    return -1;
  }*/
  
  // Method 2
  echo("searching");
  for (temp.I = 0; temp.I < players.size(); temp.I++)
  {
    echo("t: " @ players[temp.I].x @ ", " @ players[temp.I].y @ " vs " @ mousex @ "," @ mousey);
    if (mousex in |players[temp.I].x, players[temp.I].x + 3|) {
      if (mousey in |players[temp.I].y, players[temp.I].y + 3|) {
        echo("found");
        return temp.I;
      }
    }
  }
  
  return -1;
}

function onMouseDown(temp.mtype)
{
/*
        12,         8: type(variable) (22) (Opcode: 0xF0)  - variable[1](mousex) (byte)
        15,         9: player. (182)
        16,        10: type(variable) (22) (Opcode: 0xF0)  - variable[2](x) (byte)
        19,        11: member access (35)
        20,        12: Convert to float (33)
        21,        13: player. (182)
        22,        14: type(variable) (22) (Opcode: 0xF0)  - variable[2](x) (byte)
        25,        15: member access (35)
        26,        16: Convert to float (33)
        27,        17: type(number) (20) (Opcode: 0xF3)  - double(3) (byte)
        30,        18: + (60)
        31,        19: in <> (80) (Opcode: 0xF3)  - double(0) (byte)
        34,        20: if (4) (Opcode: 0xF3)  - double(26) (byte)
        37,        21: type(array) (23)
        38,        22: type(string) (21) (Opcode: 0xF0)  - variable[3](in range) (byte)
        41,        23: type(variable) (22) (Opcode: 0xF0)  - variable[4](echo) (byte)
        44,        24: Call function (6)
        45,        25: Decrease last operand index by 1 (32)
*/
  if (mousex in |player.x, player.x + 3|) {
    echo("in range");
  }
}

function onCreated() {

/*
         7,         5: player. (182)
         8,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](x) (byte)
        11,         7: member access (35)
        12,         8: Convert to float (33)
        13,         9: type(number) (20) (Opcode: 0xF3)  - double(15) (byte)
        16,        10: > (73)
        17,        11: if (4) (Opcode: 0xF3)  - double(24) (byte)
        20,        12: player. (182)
        21,        13: type(variable) (22) (Opcode: 0xF0)  - variable[1](y) (byte)
        24,        14: member access (35)
        25,        15: Convert to float (33)
        26,        16: type(number) (20) (Opcode: 0xF3)  - double(30) (byte)
        29,        17: < (72)
        30,        18: if (4) (Opcode: 0xF3)  - double(24) (byte)
        33,        19: type(array) (23)
        34,        20: type(string) (21) (Opcode: 0xF0)  - variable[2](and op) (byte)
        37,        21: type(variable) (22) (Opcode: 0xF0)  - variable[3](echo) (byte)
        40,        22: Call function (6)
        41,        23: Decrease last operand index by 1 (32)
*/

  if (player.x > 15 && player.y < 30) {
    echo("and op");
  }

/*
        42,        24: player. (182)
        43,        25: type(variable) (22) (Opcode: 0xF0)  - variable[0](x) (byte)
        46,        26: member access (35)
        47,        27: Convert to float (33)
        48,        28: type(number) (20) (Opcode: 0xF3)  - double(15) (byte)
        51,        29: > (73)
        52,        30: || (3) (Opcode: 0xF3)  - double(37) (byte)
        55,        31: player. (182)
        56,        32: type(variable) (22) (Opcode: 0xF0)  - variable[1](y) (byte)
        59,        33: member access (35)
        60,        34: Convert to float (33)
        61,        35: type(number) (20) (Opcode: 0xF3)  - double(30) (byte)
        64,        36: < (72)
        65,        37: if (4) (Opcode: 0xF3)  - double(43) (byte)
        68,        38: type(array) (23)
        69,        39: type(string) (21) (Opcode: 0xF0)  - variable[4](or op) (byte)
        72,        40: type(variable) (22) (Opcode: 0xF0)  - variable[3](echo) (byte)
        75,        41: Call function (6)
        76,        42: Decrease last operand index by 1 (32)
*/

  if (player.x > 15 || player.y < 30) {
    echo("or op");
  }
}

//#CLIENTSIDE
function onCreated()
{
  this.commands = {"Profile"};
  echo("EE");
}

function onMouseDown(temp.mtype)
{
      this.pid = onFindPlayers();
      
      if (this.pid >= 0)
      {
        //if (this.pid == 0)
        {
          //player.showProfile();
        }
        //  else
        {
          onShowMenu();
        }
      }
}

function onFindPlayers()
{
  // Method 1 - UNTESTED -
  /*temp.found = testplayer(mousex, mousey);
  
  if (temp.found)
  {
    return temp.found;
  }
    else
  {
    return -1;
  }*/
  
  // Method 2
  for (temp.I = 0; temp.I < players.size(); temp.I++)
  {
    if (mousex in |players[temp.I].x, players[temp.I].x + 3| && mousey in |players[temp.I].y, players[temp.I].y + 3|)
    {
      return temp.I;
    }
  }
  
  return -1;
}

function onShowMenu()
{ 
  new GuiContextMenuCtrl(Profile_Menu)
  {
    profile     = "GuiBluePopUpMenuProfile";
    textprofile = "GuiBlueTextListProfile";
    text        = players[thiso.pid].account;
    width       = 20;
    
    clearrows();
    
    addRow(0, players[thiso.pid].account);
    addrow(-1, "-");
    for (temp.I = 0; temp.I < thiso.commands.size(); temp.I++)
    {
      addRow(temp.I + 1, thiso.commands[temp.I]);
    }
    
    open(mousescreenx, mousescreeny);
  }
}

function Profile_Menu.onSelect(entryid, text)
{
  switch (text)
  { 
    case "Profile":
    {
      players[this.pid].showProfile();
      
      break;
    }

    case "test":
    {
      echo("test");
      break;
    }

    case "kfkf":
    {
      echo("yes");
      say2("hi");
      break;
    }

    default:
    {
      echo("fallthrough");
      break;
    }
  }
  
  Profile_Menu.destroy();
}


function onCreated() {
  temp.tst = {3, 5, 7, "ee", "fkfk", 5, 143, 5839, 96, 819, 941};

  echo("Test 1: " @ this.commands[0]);

  if (this.commands[0] == "Profile")
    echo("EE");

  temp.idx = 0;
  for (temp.v : temp.tst) {
    temp.idx++;
    echo("Loop index: " @ temp.idx @ " = " @ temp.v);

    if (temp.v == 143)
      break;
    if (temp.v == 5)
      continue;
      
    echo("Val: " @ temp.v);
  }
}

//#CLIENTSIDE
function onCreated() {
    temp.z = random(1, 20);

    temp.z++;
    this.a = temp.z++;
    this.b = ++temp.z;
    this.c = temp.z--;
    this.d = --temp.z;

    echo(format("%d, %d, %d, %d", this.a, this.b, this.c, this.d));
}


//#CLIENTSIDE
function onCreated() {
  temp.a = player.nick @ player.account;
  temp.b = player.nick NL player.account;
  temp.c = player.nick TAB player.account;
  temp.d = player.nick SPC player.account;

  player.chat = temp.a @ temp.b @ temp.c @ temp.d;
}

function onCreated() {
/*
         6,         4: this. (180)
         7,         5: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        10,         6: member access (35)
        11,         7: type(number) (20) (Opcode: 0xF3)  - double(3) (byte)
        14,         8: new[] (38)
        15,         9: type(number) (20) (Opcode: 0xF3)  - double(2) (byte)
        18,        10: new[][] for each extra dimension (142)
        19,        11: "=" (50)
*/
  this.obj = new[3][2];

/*
        20,        12: this. (180)
        21,        13: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        24,        14: member access (35)
        25,        15: Convert to object (36)
        26,        16: type(number) (20) (Opcode: 0xF3)  - double(1) (byte)
        29,        17: type(number) (20) (Opcode: 0xF3)  - double(2) (byte)
        32,        18: type(number) (20) (Opcode: 0xF3)  - double(3) (byte)
        35,        19: [a,b] assignment (134)
*/
  this.obj[1,2] = 3;

/*
        36,        20: temp. (189)
        37,        21: type(variable) (22) (Opcode: 0xF0)  - variable[1](v) (byte)
        40,        22: member access (35)
        41,        23: type(variable) (22) (Opcode: 0xF0)  - variable[2](tiles) (byte)
        44,        24: Convert to object (36)
        45,        25: type(number) (20) (Opcode: 0xF3)  - double(17) (byte)
        48,        26: type(number) (20) (Opcode: 0xF3)  - double(16) (byte)
        51,        27: [a,b] (133)
        52,        28: "=" (50)
*/
  temp.v = tiles[17,16];

/*
        53,        29: player. (182)
        54,        30: type(variable) (22) (Opcode: 0xF0)  - variable[3](chat) (byte)
        57,        31: member access (35)
        58,        32: type(string) (21) (Opcode: 0xF0)  - variable[4](T: ) (byte)
        61,        33: temp. (189)
        62,        34: type(variable) (22) (Opcode: 0xF0)  - variable[1](v) (byte)
        65,        35: member access (35)
        66,        36: Convert to string (34)
        67,        37: @ (113)
        68,        38: "=" (50)
*/
  player.chat = "T: " @ temp.v;
}

public function test() {
  player.chat = this.obj;
}


function onCreated()
{
  temp.v = "test";
  temp.arr = new[3];


 // temp.dump = getVal( obj.(@ temp.vars[i] ) );
}

function onCreated() {
/*
         6,         4: temp. (189)
         7,         5: type(variable) (22) (Opcode: 0xF0)  - variable[0](a) (byte)
        10,         6: member access (35)
        11,         7: type(true) (24)
        12,         8: "=" (50)
*/
  temp.a = true;

/*
        13,         9: temp. (189)
        14,        10: type(variable) (22) (Opcode: 0xF0)  - variable[1](b) (byte)
        17,        11: member access (35)
        18,        12: temp. (189)
        19,        13: type(variable) (22) (Opcode: 0xF0)  - variable[0](a) (byte)
        22,        14: member access (35)
        23,        15: Convert to float (33)
        24,        16: || (3) (Opcode: 0xF3)  - double(21) (byte)
        27,        17: temp. (189)
        28,        18: type(variable) (22) (Opcode: 0xF0)  - variable[2](c) (byte)
        31,        19: member access (35)
        32,        20: Convert to float (33)
        33,        21: End of inline conditional? (44)
        34,        22: "=" (50)
*/
  temp.b = (temp.a || temp.c);

/*
        35,        23: player. (182)
        36,        24: type(variable) (22) (Opcode: 0xF0)  - variable[3](chat) (byte)
        39,        25: member access (35)
        40,        26: type(string) (21) (Opcode: 0xF0)  - variable[4](Test: ) (byte)
        43,        27: temp. (189)
        44,        28: type(variable) (22) (Opcode: 0xF0)  - variable[1](b) (byte)
        47,        29: member access (35)
        48,        30: Convert to string (34)
        49,        31: @ (113)
        50,        32: "=" (50)
*/
  player.chat = "Test: " @ temp.b;
}


function onCreated() {
/*
         7,         5: temp. (189)
         8,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](b) (byte)
        11,         7: member access (35)
        12,         8: Mark as loop variable (47)
        13,         9: Assign loop variable index (45) (Opcode: 0xF3)  - double(0) (byte)
        16,        10: Decrease last operand index by 1 (32)
        17,        11: temp. (189)
        18,        12: type(variable) (22) (Opcode: 0xF0)  - variable[1](a) (byte)
        21,        13: member access (35)
        22,        14: Mark as loop variable (47)
        23,        15: Assign loop variable index (45) (Opcode: 0xF3)  - double(1) (byte)
        26,        16: Decrease last operand index by 1 (32)
*/

/*
        27,        17: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        30,        18: type(true) (24)
        31,        19: "=" (50)
*/
  temp.a = true;

/*
        32,        20: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        35,        21: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        38,        22: Convert to float (33)
        39,        23: && (5) (Opcode: 0xF3)  - double(28) (byte)
        42,        24: temp. (189)
        43,        25: type(variable) (22) (Opcode: 0xF0)  - variable[2](c) (byte)
        46,        26: member access (35)
        47,        27: Convert to float (33)
        48,        28: End of inline conditional? (44)
        49,        29: "=" (50)
*/
  temp.b = (temp.a && temp.c);

/*
        50,        30: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        53,        31: Convert to float (33)
        54,        32: || (3) (Opcode: 0xF3)  - double(35) (byte)
        57,        33: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        60,        34: Convert to float (33)
        61,        35: if (4) (Opcode: 0xF3)  - double(41) (byte)
        64,        36: type(array) (23)
        65,        37: type(string) (21) (Opcode: 0xF0)  - variable[3](One is true) (byte)
        68,        38: type(variable) (22) (Opcode: 0xF0)  - variable[4](echo) (byte)
        71,        39: Call function (6)
        72,        40: Decrease last operand index by 1 (32)
*/
  if (temp.a || temp.b) {
    echo("One is true");
  }

/*
        73,        41: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        76,        42: Convert to float (33)
        77,        43: if (4) (Opcode: 0xF3)  - double(52) (byte)
        80,        44: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
        83,        45: Convert to float (33)
        84,        46: if (4) (Opcode: 0xF3)  - double(52) (byte)
        87,        47: type(array) (23)
        88,        48: type(string) (21) (Opcode: 0xF0)  - variable[5](Both is true) (byte)
        91,        49: type(variable) (22) (Opcode: 0xF0)  - variable[4](echo) (byte)
        94,        50: Call function (6)
        95,        51: Decrease last operand index by 1 (32)
*/
  if (temp.a && temp.b) {
    echo("Both is true");
  }

/*
        96,        52: Loop variable (46) (Opcode: 0xF3)  - double(1) (byte)
        99,        53: Convert to float (33)
       100,        54: if (4) (Opcode: 0xF3)  - double(64) (byte)
       103,        55: Loop variable (46) (Opcode: 0xF3)  - double(0) (byte)
       106,        56: Convert to float (33)
       107,        57: ! (68)
       108,        58: if (4) (Opcode: 0xF3)  - double(64) (byte)
       111,        59: type(array) (23)
       112,        60: type(string) (21) (Opcode: 0xF0)  - variable[6](Only temp.a is true) (byte)
       115,        61: type(variable) (22) (Opcode: 0xF0)  - variable[4](echo) (byte)
       118,        62: Call function (6)
       119,        63: Decrease last operand index by 1 (32)
*/
  if (temp.a && !temp.b) {
    echo("Only temp.a is true");
  }
}



//#CLIENTSIDE
function onCreated() {
/*
         7,         5: temp. (189)
         8,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](q) (byte)
        11,         7: member access (35)
        12,         8: type(array) (23)
        13,         9: type(string) (21) (Opcode: 0xF0)  - variable[1](asdf) (byte)
        16,        10: type(string) (21) (Opcode: 0xF0)  - variable[2](some) (byte)
        19,        11: End of array (37)
        20,        12: "=" (50)
*/

  temp.q = { "some", "asdf" };

/*
        21,        13: temp. (189)
        22,        14: type(variable) (22) (Opcode: 0xF0)  - variable[3](I) (byte)
        25,        15: member access (35)
        26,        16: type(number) (20) (Opcode: 0xF3)  - double(3) (byte)
        29,        17: "=" (50)
*/
  temp.I = 3;

/*
        30,        18: this. (180)
        31,        19: type(variable) (22) (Opcode: 0xF0)  - variable[4](items2) (byte)
        34,        20: member access (35)
        35,        21: Convert to object (36)
        36,        22: type(number) (20) (Opcode: 0xF3)  - double(4) (byte)
        39,        23: setarray() (39)
*/
  setarray(this.items2, 4);

/*
        40,        24: this. (180)
        41,        25: type(variable) (22) (Opcode: 0xF0)  - variable[5](items) (byte)
        44,        26: member access (35)
        45,        27: Convert to object (36)
        46,        28: obj.clear() (141)
*/
  this.items.clear();

/*
        47,        29: this. (180)
        48,        30: type(variable) (22) (Opcode: 0xF0)  - variable[5](items) (byte)
        51,        31: member access (35)
        52,        32: Convert to object (36)
        53,        33: type(array) (23)
        54,        34: temp. (189)
        55,        35: type(variable) (22) (Opcode: 0xF0)  - variable[0](q) (byte)
        58,        36: member access (35)
        59,        37: temp. (189)
        60,        38: type(variable) (22) (Opcode: 0xF0)  - variable[3](I) (byte)
        63,        39: member access (35)
        64,        40: End of array (37)
        65,        41: addstring() (136)
*/
  this.items.add({temp.I, temp.q});

/*
       66,        42: type(array) (23)
        67,        43: type(string) (21) (Opcode: 0xF0)  - variable[6](Test: ) (byte)
        70,        44: this. (180)
        71,        45: type(variable) (22) (Opcode: 0xF0)  - variable[5](items) (byte)
        74,        46: member access (35)
        75,        47: Convert to object (36)
        76,        48: obj.size() (130)
        77,        49: Convert to string (34)
        78,        50: @ (113)
        79,        51: type(variable) (22) (Opcode: 0xF0)  - variable[7](echo) (byte)
        82,        52: Call function (6)
        83,        53: Decrease last operand index by 1 (32)
*/
  echo("Test: " @ this.items.size());
}


public function isHuman() {
/*
         6,         4: type(variable) (22) (Opcode: 0xF0)  - variable[0](clientr) (byte)
         9,         5: Convert to object (36)
        10,         6: type(variable) (22) (Opcode: 0xF0)  - variable[1](race) (byte)
        13,         7: member access (35)
        14,         8: type(string) (21) (Opcode: 0xF0)  - variable[2](human) (byte)
        17,         9: == (70)
        18,        10: if (4) (Opcode: 0xF3)  - double(13) (byte)
        21,        11: type(true) (24)
        22,        12: Set operation index (1) (Opcode: 0xF3)  - double(14) (byte)
        25,        13: type(false) (25)
*/
  return (clientr.race == "human" ? true : false);
}


public function someFunction() {
/*
         7,         5: this. (180)
         8,         6: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        11,         7: member access (35)
        12,         8: type(number) (20) (Opcode: 0xF3)  - double(6) (byte)
        15,         9: new[] (38)
        16,        10: "=" (50)

*/
  this.obj = new[6];

/*
        17,        11: temp. (189)
        18,        12: type(variable) (22) (Opcode: 0xF0)  - variable[1](str) (byte)
        21,        13: member access (35)
        22,        14: this. (180)
        23,        15: type(variable) (22) (Opcode: 0xF0)  - variable[0](obj) (byte)
        26,        16: member access (35)
        27,        17: Convert to string (34)
        28,        18: type(string) (21) (Opcode: 0xF0)  - variable[2]( ,) (byte)
        31,        19: obj.tokenize() (118)
        32,        20: "=" (50)
*/
  temp.str = this.obj.tokenize();

/*
       33,        21: type(array) (23)
        34,        22: type(string) (21) (Opcode: 0xF0)  - variable[3](Test: ) (byte)
        37,        23: temp. (189)
        38,        24: type(variable) (22) (Opcode: 0xF0)  - variable[1](str) (byte)
        41,        25: member access (35)
        42,        26: Convert to string (34)
        43,        27: @ (113)
        44,        28: type(variable) (22) (Opcode: 0xF0)  - variable[4](echo) (byte)
        47,        29: Call function (6)
        48,        30: Decrease last operand index by 1 (32)
        49,        31: type(number) (20) (Opcode: 0xF3)  - double(0) (byte)
*/
  echo("Test: " @ temp.str);
}



/*
//#CLIENTSIDE
function onCreated() {
   this.func = this.func1;
   this.func(123);

   this.func2 = function() {
     echo("nameless functions");
   };
 }
 function func1(param) {
   echo("param: " @ param);
 }
*/








//#CLIENTSIDE
function onCreated()
{
  /*
       496,       294: this. (180)	
       497,       295: type(variable) (22) (Opcode: 0xF0)  - variable[52](particleSystemEditor) (byte)	
       500,       296: member access (35)	
       501,       297: type(variable) (22) (Opcode: 0xF0)  - variable[53](unknown_object) (byte)	
       504,       298: type(string) (21) (Opcode: 0xF0)  - variable[0](TParticleSystemEditor) (byte)	
       507,       299: new Object? (42)	
       508,       300: "=" (50)
*/
  this.particleSystemEditor = new TParticleSystemEditor();
  player.chat = "fired2: " @ ++this.i;
  
/*
       527,       311: this. (180)	
       528,       312: type(variable) (22) (Opcode: 0xF0)  - variable[55](someobj) (byte)	
       531,       313: member access (35)	
       532,       314: type(variable) (22) (Opcode: 0xF0)  - variable[53](unknown_object) (byte)	
       535,       315: type(string) (21) (Opcode: 0xF0)  - variable[16](GuiWindowCtrl) (byte)	
       538,       316: new Object? (42)	
       539,       317: "=" (50)
*/
  this.someobj = new GuiWindowCtrl();
  this.someobj.show();
  
  player.chat = "fired2.1: " @ ++this.i;
  
/*
       571,       337: this. (180)	
       572,       338: type(variable) (22) (Opcode: 0xF0)  - variable[58](someobj2) (byte)	
       575,       339: member access (35)	
       576,       340: type(string) (21) (Opcode: 0xF0)  - variable[59](SomeWindow) (byte)	
       579,       341: inline new? (40)	
       580,       342: type(string) (21) (Opcode: 0xF0)  - variable[16](GuiWindowCtrl) (byte)	
       583,       343: new Object? (42)	
       584,       344: "=" (50)
*/
  this.someobj2 = new GuiWindowCtrl("SomeWindow");
  this.someobj2.show();
  player.chat = "fired2.2: " @ ++this.i;
  
/*
       616,       364: this. (180)	
       617,       365: type(variable) (22) (Opcode: 0xF0)  - variable[61](someobj3) (byte)	
       620,       366: member access (35)	
       621,       367: type(string) (21) (Opcode: 0xF0)  - variable[62](arg1) (byte)	
       624,       368: inline new? (40)	
       625,       369: type(string) (21) (Opcode: 0xF0)  - variable[0](TParticleSystemEditor) (byte)	
       628,       370: new Object? (42)	
       629,       371: "=" (50)
*/
  this.someobj3 = new TParticleSystemEditor("arg1");
  player.chat = "fired2.3: " @ ++this.i;
  
/*
       648,       382: this. (180)	
       649,       383: type(variable) (22) (Opcode: 0xF0)  - variable[64](someobj4) (byte)	
       652,       384: member access (35)	
       653,       385: type(variable) (22) (Opcode: 0xF0)  - variable[53](unknown_object) (byte)	
       656,       386: type(string) (21) (Opcode: 0xF0)  - variable[0](TParticleSystemEditor) (byte)	
       659,       387: new Object? (42)	
       660,       388: "=" (50)
*/
  this.someobj4 = new TParticleSystemEditor("arg1", "arg2", "arg3");
  player.chat = "fired3: " @ ++this.i;
  
/*
       679,       399: this. (180)	
       680,       400: type(variable) (22) (Opcode: 0xF0)  - variable[66](anotherobj) (byte)	
       683,       401: member access (35)	
       684,       402: type(variable) (22) (Opcode: 0xF0)  - variable[53](unknown_object) (byte)	
       687,       403: type(string) (21) (Opcode: 0xF0)  - variable[3](TStaticVar) (byte)	
       690,       404: new Object? (42)	
       691,       405: "=" (50)
*/
  this.anotherobj = new TStaticVar();
  player.chat = "fired4: " @ ++this.i;

/*
       710,       416: this. (180)	
       711,       417: type(variable) (22) (Opcode: 0xF0)  - variable[68](anotherobj2) (byte)	
       714,       418: member access (35)	
       715,       419: type(string) (21) (Opcode: 0xF0)  - variable[13](test) (byte)	
       718,       420: inline new? (40)	
       719,       421: type(string) (21) (Opcode: 0xF0)  - variable[3](TStaticVar) (byte)	
       722,       422: new Object? (42)	
       723,       423: "=" (50)
*/
  this.anotherobj2 = new TStaticVar("test");
  player.chat = "fired5: " @ ++this.i;

/*
       742,       434: this. (180)	
       743,       435: type(variable) (22) (Opcode: 0xF0)  - variable[70](anotherobj3) (byte)	
       746,       436: member access (35)	
       747,       437: type(variable) (22) (Opcode: 0xF0)  - variable[53](unknown_object) (byte)	
       750,       438: type(string) (21) (Opcode: 0xF0)  - variable[3](TStaticVar) (byte)	
       753,       439: new Object? (42)	
       754,       440: "=" (50)
*/
  this.anotherobj3 = new TStaticVar("test", "abc");
  player.chat = "fired6: " @ ++this.i;

  this.particleSystemEditor.initialize(findImg(300));
  player.chat = "fired8: " @ ++this.i;
}


