Graal Forums  

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

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-22-2013, 03:54 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
Drawing a level with GuiDrawingPanel

I'm having a bit of trouble drawing an image of a level using a GuiDrawingPanel control. The script draws the level's tiles, chops pics1.png up using Dusty's TilesToImage() function and then positions them on the panel to create an image of the level, but for some reason I'm having some strange issues. The saved image only manages to draw a single line of tiles instead of the whole level (look at the screen shot to see what I mean). Can anybody offer any suggestions on why it's doing this?

PHP Code:
//#CLIENTSIDE

function onCreated() {
  
this.panel = new GuiDrawingPanel();
  
this.panel.visible true;
  
this.panel.width 64 16;
  
this.panel.height 64 16;
  
this.panel.0;
  
this.panel.0;
  
this.panel.clearall();
  
  for (
temp.0temp.< (64 64); temp.++) {
    
temp.tilex = (64);
    
temp.tiley int(64);
 
    
temp.tile tiles[temp.tilextemp.tiley];
    
temp.imagetile tilestoimage(temp.tile);
    
    
temp.obj findimg(200);
    
temp.obj.image "pics1.png";
    
temp.obj.partx temp.imagetile[0];
    
temp.obj.party temp.imagetile[1];
    
temp.obj.partw 16;
    
temp.obj.parth 16;
    
    
this.panel.drawObject(temp.tilex 16temp.tiley 16temp.obj);
  }
  
this.panel.saveimage("tiles.png");
  
this.panel.destroy();
}

function 
TilesToImage(t) {
  if (
t.type() == 0) {
    
temp.px = (int(t%16)*16)+(int(t/512)*256);
    
temp.py = (int(t/16)*16)%512;
    return {
px,py};
  } else if (
t.type() == 3) {
    
temp.imgarray = new[0];
    for (
temp.t) {
      
temp.px = (int(i%16)*16)+(int(i/512)*256);
      
temp.py = (int(i/16)*16)%512;
      
imgarray.add({px,py}); 
    }
    return 
imgarray;
  } else return -
1;

Image Start

Image End
Reply With Quote
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 05:06 PM.


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