Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   makescreenshot2() selection. (https://forums.graalonline.com/forums/showthread.php?t=134266115)

Emera 03-29-2012 09:23 PM

makescreenshot2() selection.
 
5 Attachment(s)
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) + 1int(mousey),
        
int(mousex) + 1int(mousey) + 1,
        
int(mousex), int(mousey) + 1
      
};
      
showpoly(200temp.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"0x3fclient.capturedata[0], client.capturedata[1], player.zclient.capturedata[2], client.capturedata[3]);
    
player.chat client.capturedata;
  }


Could somebody help me out?

fowlplay4 03-29-2012 09:58 PM

!this.capture; does nothing.

Your best bet would be to go through the array of tiles and draw them to a GuiDrawingPanel and save that image.

When you're drawing specify "TILES" as the image and it will use the levels specified tileset/defs.

Emera 03-29-2012 11:08 PM

Quote:

Originally Posted by fowlplay4 (Post 1690395)
!this.capture; does nothing.

I was unsure wether or not I needed to set it, and I guess I forgot to remove it. Thanks.
Quote:

Originally Posted by fowlplay4 (Post 1690395)
Your best bet would be to go through the array of tiles and draw them to a GuiDrawingPanel and save that image.

I think I get what you mean. So, instead of making a screenshot, add them to a drawing panel and save that as the image. Could you possibly show me an example of how to add the selection to the drawing panel? If you could it'd be a great help.
Quote:

Originally Posted by fowlplay4 (Post 1690395)
When you're drawing specify "TILES" as the image and it will use the levels specified tileset/defs.

Got it, thanks.


All times are GMT +2. The time now is 10:10 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.