Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Clientside TDrawingPanel (https://forums.graalonline.com/forums/showthread.php?t=87602)

fowlplay4 08-25-2009 09:37 PM

Clientside TDrawingPanel
 
Well I decided I would experiment with it today but I just can't get it to work.

PHP Code:

//#CLIENTSIDE
function onCreated() {
  
temp.panel = new TDrawingPanel();
  
temp.panel.setsize(getimgwidth(player.head), getimgheight(player.head));
  
temp.panel.drawimage(00player.head);
  
temp.panel.saveimage("test.png");
  
temp.panel.destroy();


The error.

GraalScript: Couldn't create object: type TDrawingPanel is not existing in script of Weapon Jerret/Debugger

Edit: I was able to find success with GuiDrawingPanel but I'm still curious as to why the above doesn't work.

Crow 08-25-2009 09:48 PM

Pretty sure Graal doesn't want you to create a TDrawingPanel out of nowhere. GuiDrawingPanel inherits TDrawingPanel anyway, so that should do.

Inverness 08-25-2009 09:58 PM

It is possible to create it on serverside like that. But Stefan has yet to port those changes to the client.

fowlplay4 08-25-2009 10:32 PM

Well I finished experimenting and ended up making this nifty drawing function on the serverside.

PHP Code:

// Coded for Classic Bodies
function drawCharacter(obj) {
  
// Get Player Variables
  
temp.headimg obj.head;
  
temp.bodyimg obj.body;
  
temp.hatimg  obj.attr[1];
  
// Draw Player
  
temp.panel = new TDrawingPanel();
  
temp.panel.setsize(4864);
  
// Draw Body
  
temp.panel.drawimagerectangle(816+16temp.bodyimg6403232);
  
// Draw Head
  
temp.panel.drawimagerectangle(82+16temp.headimg032*23232);
  
// Draw Hat
  
temp.panel.drawimagerectangle(00temp.hatimg9604848);
  
// Save Image
  
temp.panel.saveimage("cartridge/test.png");
  
// Destroy Panel
  
temp.panel.destroy();


Only issue is the whole body colors thing.

WhiteDragon 08-25-2009 10:52 PM

Quote:

Originally Posted by fowlplay4 (Post 1518450)
Well I finished experimenting and ended up making this nifty drawing function on the serverside.

PHP Code:

// Coded for Classic Bodies
function drawCharacter(obj) {
  
// Get Player Variables
  
temp.headimg obj.head;
  
temp.bodyimg obj.body;
  
temp.hatimg  obj.attr[1];
  
// Draw Player
  
temp.panel = new TDrawingPanel();
  
temp.panel.setsize(4864);
  
// Draw Body
  
temp.panel.drawimagerectangle(816+16temp.bodyimg6403232);
  
// Draw Head
  
temp.panel.drawimagerectangle(82+16temp.headimg032*23232);
  
// Draw Hat
  
temp.panel.drawimagerectangle(00temp.hatimg9604848);
  
// Save Image
  
temp.panel.saveimage("cartridge/test.png");
  
// Destroy Panel
  
temp.panel.destroy();


Only issue is the whole body colors thing.

Cool.

I remember that the body color swapping was one of the biggest CPU hogs on Graal, and it probably uses some internal function to do it, so I doubt it would be able to replicate it properly/efficiently.

fowlplay4 08-25-2009 11:21 PM

It'd be easy to do if there was some sort of replace color function for TDrawingPanel.

Also noticed that Clientside DrawingPanels (Well on the Windows client) don't save transparency while Serverside ones do.


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

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