Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 03-29-2012, 09:23 PM
Emera Emera is offline
Delterian Hybrid
Emera's Avatar
Join Date: Mar 2011
Location: Newcastle Upon-Tyne
Posts: 1,704
Emera is a jewel in the roughEmera is a jewel in the rough
makescreenshot2() selection.

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?
Attached Images
     
__________________
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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