I'm trying to code a selection tool for using
makescreenshot2(), so I don't have to keep using snipping tool to make images of tiles. I've got an idea of what needs to be done, but I'm not 100% sure if I'm getting the maths right.
Basically, the player left clicks to set the x and y and then they right click to find the difference between the first click and the last click, the script does the maths and takes a screen shot of the selected tiles, or that's what it's supposed to do.
Attached below are the results of the script so far, and they're close to what I want, but obviously it's not working.
PHP Code:
//#CLIENTSIDE
function onCreated() {
setTimer(0.05);
!this.capture;
client.capturedata = {0,0,0,0};
}
function onKeyPressed(code,Key) {
if (Key == "H") {
this.capture = !this.capture;
}
}
function onTimeout() {
if (this.capture) {
with(findimg(200)) {
temp.poly = {
int(mousex), int(mousey),
int(mousex) + 1, int(mousey),
int(mousex) + 1, int(mousey) + 1,
int(mousex), int(mousey) + 1
};
showpoly(200, temp.poly);
}
} else {
hideimg(200);
}
setTimer(0.05);
}
function onMouseDown(mode) {
if (mode == "left" && this.capture) {
client.capturedata[0] = int(mousex);
client.capturedata[1] = int(mousey);
player.chat = client.capturedata;
}
if (mode == "right" && this.capture) {
temp.distancex = client.capturedata[0] - int(mousex);
temp.distancey = client.capturedata[1] - int(mousey);
client.capturedata[2] = client.capturedata[0] + temp.distancex;
client.capturedata[3] = client.capturedata[1] + temp.distancey;
makescreenshot2("leveltest.png", 0x3f, client.capturedata[0], client.capturedata[1], player.z, client.capturedata[2], client.capturedata[3]);
player.chat = client.capturedata;
}
}
Could somebody help me out?