Graal Pastebin
New PastePasted on November 6, 2011.
View the raw file
function onActionserverside() { switch (params[0]) { case "placetiles": this.conv_swidth = params[1]; this.conv_placex = params[2]; this.conv_placey = params[3]; this.conv_stiles = params[4]; for (this.conv_i = 0; this.conv_i < this.conv_stiles.size(); this.conv_i++) tiles[this.conv_placex + this.conv_i % this.conv_swidth, this.conv_placey + int(this.conv_i / this.conv_swidth)] = this.conv_stiles[this.conv_i]; updateterrain(); updateboard2(this.conv_placex, this.conv_placey, this.conv_swidth, this.conv_stiles.size() / this.conv_swidth); break; } } //#CLIENTSIDE function onCreated() { resetVariables(); updateterrain(); } function resetVariables() { enum key { F4 = 115 }; } function onKeyPressed( code, key ) { switch ( temp.code ) { case key.F4: if (this.conv_on == nil) { updateterrain(); client.editinglevel = nil; this.conv_on = 1; this.conv_hidden = 0; this.conv_tcx = screenwidth - 300; this.conv_tcy = screenheight - 300; this.conv_alocs = {this.conv_tcx, this.conv_tcy + 16, this.conv_tcx + 16, this.conv_tcy, this.conv_tcx, this.conv_tcy + 256, this.conv_tcx + 256, this.conv_tcy}; setstring this.conv_tiles, ; showtiles(); showarrows(); }else{ player.chat = ""; this.conv_on = 0; hideimgs 200, 211; setstring this.conv_tiles, ; } break; } } function onPlayerChats() { if (player.chat == "/hide") { if (this.conv_on == true) { player.chat = ""; hideimgs(200, 210); this.conv_hidden = 1; } } elseif (player.chat == "update level") { updateterrain(); } elseif (player.chat == "/show") { if (this.conv_on == true) { player.chat = ""; showtiles(); showarrows(); this.conv_hidden = 0; } } elseif (player.chat == "/reset") { if (this.conv_on == true) { if (this.conv_hidden == 0) { player.chat = ""; this.conv_tcx = screenwidth - 272; this.conv_tcy = screenheight - 272; this.conv_alocs = {this.conv_tcx, this.conv_tcy + 16, this.conv_tcx + 16, this.conv_tcy, this.conv_tcx, this.conv_tcy + 256, this.conv_tcx + 256, this.conv_tcy}; showtiles(); showarrows(); } } } } function onMousedown(button) { if (this.conv_on == true) { if (button == "left") { updateterrain(); if (this.conv_hidden == 0) { if (mousescreenx in | this.conv_tcx, this.conv_tcx + 271 | && mousescreeny in | this.conv_tcy, this.conv_tcy + 271 | ) { for (this.conv_i = 0;this.conv_i < 4;this.conv_i++) { if (mousescreenx in | this.conv_alocs[this.conv_i*2], this.conv_alocs[this.conv_i*2] + 15 | && mousescreeny in | this.conv_alocs[this.conv_i*2 + 1], this.conv_alocs[this.conv_i*2 + 1] + 15 | ) { if (this.conv_tx + vecx(this.conv_i) in | 0, 112 | ) { this.conv_tx += vecx(this.conv_i); } if (this.conv_ty + vecy(this.conv_i) in | 0, 16 | ) { this.conv_ty += vecy(this.conv_i); } showtiles(); showarrows(); } } if (mousescreenx in | this.conv_tcx + 16, this.conv_tcx + 271 | && mousescreeny in | this.conv_tcy + 16, this.conv_tcy + 271 | ) { this.conv_mx1 = int((mousescreenx - this.conv_tcx - 16) / 16); this.conv_my1 = int((mousescreeny - this.conv_tcy - 16) / 16); this.conv_mousedown = 1; setTimer(0.05); } elseif (mousescreenx in | this.conv_tcx, this.conv_tcx + 15 | && mousescreeny in | this.conv_tcy, this.conv_tcy + 15 | ) { this.conv_cornerclickx = this.conv_tcx - mousescreenx; this.conv_cornerclicky = this.conv_tcy - mousescreeny; this.conv_mousedown = 3; setTimer(0.05); } elseif (mousescreenx in | this.conv_tcx + 32, this.conv_tcx + 255 | && mousescreeny in | this.conv_tcy, this.conv_tcy + 15 | ) { if (int((1 - ((this.conv_tcx + 255) - mousescreenx)) / 2) + 112 in | 0, 112 | ) { this.conv_tx = int((1 - ((this.conv_tcx + 255) - mousescreenx)) / 2) + 112; showtiles(); showarrows(); } } elseif (mousescreenx in | this.conv_tcx, this.conv_tcx + 15 | && mousescreeny in | this.conv_tcy + 32, this.conv_tcy + 255 | ) { if (int((16 - ((this.conv_tcy + 255) - mousescreeny)) / 13) + 16 in | 0, 16 | ) { this.conv_ty = int((16 - ((this.conv_tcy + 255) - mousescreeny)) / 13) + 16; showtiles(); showarrows(); } } } else { this.conv_mx1 = int(mousex); this.conv_my1 = int(mousey); this.conv_mousedown = 2; setstring this.conv_tiles, ; setTimer(0.05); } } else { this.conv_mx1 = int(mousex); this.conv_my1 = int(mousey); this.conv_mousedown = 2; setstring this.conv_tiles, ; setTimer(0.05); } } if (button == "right") { if (this.conv_tiles.size() > 0) { updateterrain(); client.editinglevel = player.level.name; triggerserver("gui", this.name, "placetiles", this.conv_twidth, int(mousex), int(mousey), this.conv_tiles); } } } } function onTimeout() { if (this.conv_on == 1) { setTimer(0.05); if (this.conv_mousedown == true) { if (mousescreenx in | this.conv_tcx + 16, this.conv_tcx + 271 | && mousescreeny in | this.conv_tcy + 16, this.conv_tcy + 271 | ) { this.conv_mx2 = int((mousescreenx - this.conv_tcx - 16) / 16); this.conv_my2 = int((mousescreeny - this.conv_tcy - 16) / 16); } if (this.conv_mx1 <= this.conv_mx2) { this.conv_xoff1 = 0; this.conv_xoff2 = 1; } else { this.conv_xoff1 = 1; this.conv_xoff2 = 0; } if (this.conv_my1 <= this.conv_my2) { this.conv_yoff1 = 0; this.conv_yoff2 = 1; } else { this.conv_yoff1 = 1; this.conv_yoff2 = 0; } showpoly(210, { this.conv_tcx + 16 + (this.conv_mx1 + this.conv_xoff1)*16, this.conv_tcy + 16 + (this.conv_my1 + this.conv_yoff1)*16, this.conv_tcx + 16 + (this.conv_mx1 + this.conv_xoff1)*16, this.conv_tcy + 16 + (this.conv_my2 + this.conv_yoff2)*16, this.conv_tcx + 16 + (this.conv_mx2 + this.conv_xoff2)*16, this.conv_tcy + 16 + (this.conv_my2 + this.conv_yoff2)*16, this.conv_tcx + 16 + (this.conv_mx2 + this.conv_xoff2)*16, this.conv_tcy + 16 + (this.conv_my1 + this.conv_yoff1)*16 }); changeimgvis(210, 7); changeimgcolors(210, .75, .75, .75, .25); if (!leftmousebutton) { this.conv_mousedown = 0; hideimg(210); if (this.conv_mx1 < this.conv_mx2) { this.conv_tlx = this.conv_mx1; this.conv_blx = this.conv_mx2; } else { this.conv_tlx = this.conv_mx2; this.conv_blx = this.conv_mx1; } if (this.conv_my1 < this.conv_my2) { this.conv_tly = this.conv_my1; this.conv_bly = this.conv_my2; } else { this.conv_tly = this.conv_my2; this.conv_bly = this.conv_my1; } this.conv_tiles = ""; this.conv_twidth = this.conv_blx - (this.conv_tlx - 1); this.conv_selected = this.conv_twidth * (this.conv_bly - (this.conv_tly - 1)); for (this.conv_i = 0;this.conv_i < this.conv_selected;this.conv_i++) { this.conv_tiles.add(((this.conv_tx + this.conv_tlx + (this.conv_i % this.conv_twidth)) % 16) + ((this.conv_ty + this.conv_tly + (int(this.conv_i / this.conv_twidth)))*16) + int((this.conv_tx + this.conv_tlx + (this.conv_i % this.conv_twidth)) / 16)*512); } } } elseif (this.conv_mousedown == 2) { this.conv_mx2 = int(mousex); this.conv_my2 = int(mousey); if (this.conv_mx1 <= this.conv_mx2) { this.conv_xoff1 = 0; this.conv_xoff2 = 1; } else { this.conv_xoff1 = 1; this.conv_xoff2 = 0; } if (this.conv_my1 <= this.conv_my2) { this.conv_yoff1 = 0; this.conv_yoff2 = 1; } else { this.conv_yoff1 = 1; this.conv_yoff2 = 0; } showpoly(210, { this.conv_mx1 + this.conv_xoff1, this.conv_my1 + this.conv_yoff1, this.conv_mx1 + this.conv_xoff1, this.conv_my2 + this.conv_yoff2, this.conv_mx2 + this.conv_xoff2, this.conv_my2 + this.conv_yoff2, this.conv_mx2 + this.conv_xoff2, this.conv_my1 + this.conv_yoff1, }); changeimgvis(210, 3); changeimgcolors(210, .75, .75, .75, .25); if (!leftmousebutton) { this.conv_mousedown = 0; hideimg(210); if (this.conv_mx1 < this.conv_mx2) { this.conv_tlx = this.conv_mx1; this.conv_blx = this.conv_mx2; } else { this.conv_tlx = this.conv_mx2; this.conv_blx = this.conv_mx1; } if (this.conv_my1 < this.conv_my2) { this.conv_tly = this.conv_my1; this.conv_bly = this.conv_my2; } else { this.conv_tly = this.conv_my2; this.conv_bly = this.conv_my1; } this.conv_tiles = ""; this.conv_twidth = this.conv_blx - (this.conv_tlx - 1); this.conv_selected = this.conv_twidth * (this.conv_bly - (this.conv_tly - 1)); for (this.conv_i = 0;this.conv_i < this.conv_selected;this.conv_i++) { this.conv_tiles.add(tiles[this.conv_tlx + (this.conv_i % this.conv_twidth), this.conv_tly + (int(this.conv_i / this.conv_twidth))]); } } } elseif (this.conv_mousedown == 3) { this.conv_tcx = mousescreenx + this.conv_cornerclickx; this.conv_tcy = mousescreeny + this.conv_cornerclicky; this.conv_alocs = {this.conv_tcx, this.conv_tcy + 16, this.conv_tcx + 16, this.conv_tcy, this.conv_tcx, this.conv_tcy + 256, this.conv_tcx + 256, this.conv_tcy}; showtiles(); showarrows(); if (!leftmousebutton) { this.conv_mousedown = 0; } } if (this.conv_tiles.size() > 0) { showpoly(211, { int(mousex), int(mousey), int(mousex) + this.conv_twidth, int(mousey), int(mousex) + this.conv_twidth, int(mousey) + sarraylen(this.conv_tiles) / this.conv_twidth, int(mousex), int(mousey) + sarraylen(this.conv_tiles) / this.conv_twidth }); changeimgcolors(211, .75, .75, .75, .25); } else { hideimg(211); } } else { this.conv_mousedown = 0; } } function showtiles() { showpoly(200, { this.conv_tcx, this.conv_tcy, this.conv_tcx + 287, this.conv_tcy, this.conv_tcx + 287, this.conv_tcy + 287, this.conv_tcx, this.conv_tcy + 287 }); showpoly(201, { this.conv_tcx + 16, this.conv_tcy + 16, this.conv_tcx + 271, this.conv_tcy + 16, this.conv_tcx + 271, this.conv_tcy + 271, this.conv_tcx + 16, this.conv_tcy + 271 }); if (this.conv_tx < 48) { this.conv_moffset = 256; } if (this.conv_tx in | 48, 64 | ) { this.conv_moffset = (64 - this.conv_tx) * 16; } if (this.conv_tx > 64) { this.conv_moffset = 0; } if (this.conv_tx < 64) { showimg(202, gettileset(), this.conv_tcx + 16, this.conv_tcy + 16); changeimgpart(202, this.conv_tx*16, this.conv_ty*16, 256, 256); } else { hideimg(202); } if (this.conv_tx > 48) { showimg(203, gettileset(), this.conv_tcx + 16 + this.conv_moffset, this.conv_tcy + 16); changeimgpart(203, (this.conv_tx)*16 + this.conv_moffset, this.conv_ty*16, 256 - this.conv_moffset, 256); changeimgvis(203, 6); } else { hideimg(203); } changeimgcolors(200, 0, 0, 0, 1); changeimgvis(200, 4); changeimgvis(201, 5); changeimgvis(202, 6); } function showarrows() { showpoly(204, { this.conv_tcx + 15, this.conv_tcy + 31, this.conv_tcx, this.conv_tcy + 31, this.conv_tcx + 8, this.conv_tcy + 16 }); showpoly(205, { this.conv_tcx + 15, this.conv_tcy + 256, this.conv_tcx, this.conv_tcy + 256, this.conv_tcx + 8, this.conv_tcy + 271 }); showpoly(206, { this.conv_tcx + 31, this.conv_tcy + 15, this.conv_tcx + 31, this.conv_tcy, this.conv_tcx + 16, this.conv_tcy + 8 }); showpoly(207, { this.conv_tcx + 256, this.conv_tcy + 15, this.conv_tcx + 256, this.conv_tcy, this.conv_tcx + 271, this.conv_tcy + 8 }); showpoly(208, { this.conv_tcx + 31 + this.conv_tx*2, this.conv_tcy, this.conv_tcx + 31 + this.conv_tx*2, this.conv_tcy + 15, this.conv_tcx + 32 + this.conv_tx*2, this.conv_tcy + 15, this.conv_tcx + 32 + this.conv_tx*2, this.conv_tcy }); showpoly(209, { this.conv_tcx, this.conv_tcy + 33 + this.conv_ty*13, this.conv_tcx + 15, this.conv_tcy + 33 + this.conv_ty*13, this.conv_tcx + 15, this.conv_tcy + 46 + this.conv_ty*13, this.conv_tcx, this.conv_tcy + 46 + this.conv_ty*13 }); for (this.conv_i = 0;this.conv_i < 6;this.conv_i++) { changeimgvis(204 + this.conv_i, 6); } }