Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #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
  #2  
Old 03-29-2012, 09:58 PM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
!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.
__________________
Quote:
Reply With Quote
  #3  
Old 03-29-2012, 11:08 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
Quote:
Originally Posted by fowlplay4 View Post
!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 View Post
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 View Post
When you're drawing specify "TILES" as the image and it will use the levels specified tileset/defs.
Got it, thanks.
__________________
Reply With Quote
Reply


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 03:10 PM.


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