Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 01-23-2011, 03:38 AM
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
GANI File Manipulation

Being inspired to help improve the gani situation I took it upon myself to write a flexible GANI class with some functions to load, manipulate, and save the data in the correct format.

Example Script:

PHP Code:
function onCreated() {
  if (
this.testgani != NULLthis.testgani.destroy();
  
this.testgani = new TStaticVar();
  
this.testgani.join("gani");
  
this.testgani.loadgani("levels/ganis/walk.gani");
  
this.testgani.setSingleDir(true);
  
this.testgani.savegani("outputfolder/walk_messedlol.gani");
  
this.testgani.destroy();

Functions:

PHP Code:
// File I/O Functions
public function loadgani(path)
public function 
savegani(newpath)

// Animation Functions
public function getAniLength()
public function 
isLooped()
public function 
setLooped(bool)
public function 
isContinuous()
public function 
setContinuous(bool)
public function 
isSingleDir()
public function 
setSingleDir(bool)
public function 
getSetBackTo()
public function 
setSetBackTo(newbackto)

// Frame Functions
public function getFrameSprites(inddir)
public function 
setFrameSprites(inddirnewsprites)
public function 
getFrameData(inddir)
public function 
getFrameTime(ind)
public function 
getFrameSound(ind)
public function 
setFrameSound(indnewsoundoxoy)
public function 
getFrameWait(ind)
public function 
setFrameWait(indwaitvalue)
public function 
getFrameCount()

// Sprite Functions
public function addSprite(sprite_idsprite_imgsprite_xsprite_ysprite_wsprite_hsprite_com)
public function 
getSprite(spriteid)
public function 
getSpriteImage(spriteid)
public function 
setSpriteImage(spriteidnewimg)
public function 
getSpriteX(spriteid)
public function 
setSpriteX(spriteidnewval)
public function 
getSpriteY(spriteid)
public function 
setSpriteY(spriteidnewval)
public function 
getSpriteWidth(spriteid)
public function 
setSpriteWidth(spriteidnewval)
public function 
getSpriteHeight(spriteid)
public function 
setSpriteHeight(spriteidnewval)
public function 
getSpriteComment(spriteid)
public function 
setSpriteComment(spriteidcomment)

// GANI Effect Functions
public function getColorEffects()
public function 
addColorEffect(spriteidrgba)
public function 
deleteColorEffect(spriteid)
public function 
getZoomEffects()
public function 
addZoomEffect(spriteidz)
public function 
deleteZoomEffect(spriteid)
public function 
getRotateEffects()
public function 
addRotateEffect(spriteidr)
public function 
deleteRotateEffect(spriteid)
public function 
getStretchYEffects()
public function 
addStretchYEffect(spriteids)
public function 
deleteStretchYEffect(spriteid)
public function 
deleteStretchXEffect(spriteid)
public function 
addStretchXEffect(spriteids)
public function 
getStretchXEffects()
public function 
deleteModeEffect(spriteid)
public function 
addModeEffect(spriteidm)
public function 
getModeEffects() 
There could still be a few more functions added but for the most part it should be a very decent base to work off of.

I've tested it with human2_bow_shoot.gani, and some of Zodiac's ganis and all appears to work just fine after being loaded, manipulated and saved.

If my code doesn't preserve a certain element let me know but I'm pretty sure I've gotten everything.

See attached for class, and the aftermath of my example script.
Attached Thumbnails
Click image for larger version

Name:	aftermath.JPG
Views:	439
Size:	84.7 KB
ID:	52302  
Attached Files
File Type: gani walk.gani (9.8 KB, 264 views)
File Type: gani walk_messedlol.gani (11.5 KB, 271 views)
File Type: txt gani.txt (22.8 KB, 356 views)
__________________
Quote:

Last edited by fowlplay4; 01-23-2011 at 08:26 PM.. Reason: Added StretchX, StretchY, and Mode Effects functionality.
Reply With Quote
  #2  
Old 01-23-2011, 03:40 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Impressive.
__________________
Reply With Quote
  #3  
Old 01-23-2011, 03:45 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Impressed so hard that I'm confused by what exactly I'm looking at.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #4  
Old 01-23-2011, 03:51 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Neat.
Reply With Quote
  #5  
Old 01-23-2011, 03:56 AM
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
Next step GraalShop2.
__________________
Quote:
Reply With Quote
  #6  
Old 01-23-2011, 03:58 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
third party style program plox.
Get to it fp4/cbk.
__________________

Careful, thoughts and opinions here scare people.
Reply With Quote
  #7  
Old 01-23-2011, 03:58 AM
Deas_Voice Deas_Voice is offline
Deas
Deas_Voice's Avatar
Join Date: Jun 2007
Location: Sweden
Posts: 2,264
Deas_Voice is a jewel in the roughDeas_Voice is a jewel in the rough
Send a message via AIM to Deas_Voice Send a message via MSN to Deas_Voice Send a message via Yahoo to Deas_Voice
Quote:
Originally Posted by fowlplay4 View Post
Next step GraalShop2.
not a gui one, right?
__________________
.
WTF is real life, and where do I Download it?
There is no Real Life, just AFK!
since 2003~
I Support~
ღAeonღ | ღTestbedღ | ღDelteriaღ

if you are going to rep me, don't be an idiot, leave your name!
I got nothing but love for you
Reply With Quote
  #8  
Old 01-23-2011, 04:01 AM
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
Yes an external open-source alternative would be ideal.
__________________
Quote:
Reply With Quote
  #9  
Old 01-23-2011, 04:05 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Even if someone made a third-party program, which wouldn't be that hard, it wouldn't be able to show particles.
__________________
Reply With Quote
  #10  
Old 01-23-2011, 04:07 AM
Fulg0reSama Fulg0reSama is offline
Extrinsical Anomaly
Fulg0reSama's Avatar
Join Date: Sep 2009
Location: Ohio
Posts: 3,049
Fulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant futureFulg0reSama has a brilliant future
Quote:
Originally Posted by cbk1994 View Post
Even if someone made a third-party program, which wouldn't be that hard, it wouldn't be able to show particles.
Eh, gotta sacrifice somehow right?

Particles gotta emit on the game anyways since you have to test for lag.
Normal Sprite and Movie Ganis do not.

Edit: Oh yeah, what about movie mode ganis? @ fowlplay4
Hopefully if such thing is done it's made a lot more user friendly. I swear movie ganis are probably the most non user friendly thing I've ever seen.
__________________

Careful, thoughts and opinions here scare people.

Last edited by Fulg0reSama; 01-23-2011 at 04:18 AM..
Reply With Quote
  #11  
Old 01-23-2011, 04:13 AM
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
Quote:
Originally Posted by cbk1994 View Post
Even if someone made a third-party program, which wouldn't be that hard, it wouldn't be able to show particles.
But working Zoom, Color, Rotate effects and UI-functionality for attaching sprites and a sprite cutter would surely make up for that.

Edit: Forgot about movie ganis but given the amount of usage they get it (I've never used them), **** em.
Edit2: Edited script so it'll still preserve the MOVIE section.
__________________
Quote:
Reply With Quote
  #12  
Old 01-23-2011, 06:56 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
Quote:
Originally Posted by Fulg0reSama View Post
Eh, gotta sacrifice somehow right?

Particles gotta emit on the game anyways since you have to test for lag.
Normal Sprite and Movie Ganis do not.

Edit: Oh yeah, what about movie mode ganis? @ fowlplay4
Hopefully if such thing is done it's made a lot more user friendly. I swear movie ganis are probably the most non user friendly thing I've ever seen.
What changes would you want to see in an updated GraalShop?
__________________
Reply With Quote
  #13  
Old 01-23-2011, 07:37 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Instead of third party, use external windows? I would like the ability to actuall zoom in/out the timeline bar.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
Reply With Quote
  #14  
Old 01-23-2011, 07:56 AM
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
Quote:
Originally Posted by MrOmega View Post
Instead of third party, use external windows? I would like the ability to actuall zoom in/out the timeline bar.
The two issues with that is that you'll be tethered to Graal and the GUI issues that come with the territory which are brought up whenever discussing the scripted player-list.

The current timeline is by far one of the worst systems ever. Not only do you have to find it's T-spot, but then you also have to be careful not to extend it further than you want it.
__________________
Quote:
Reply With Quote
  #15  
Old 01-23-2011, 11:21 AM
MrOmega MrOmega is offline
One More Time
MrOmega's Avatar
Join Date: Aug 2010
Location: TN, USA
Posts: 631
MrOmega is an unknown quantity at this point
Send a message via AIM to MrOmega Send a message via MSN to MrOmega Send a message via Yahoo to MrOmega
Hmm, I see, I don't see too many issue with GShop that would come in playerlist. I think I'll work on one tomorrow and eventually post what I get.
__________________
Time is the fire in which we burn...
Up, Up, Down, Down, Left, Right, Left, Right, B, A, Select, Start! Now I got 99 LIVES!!!
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 01:13 PM.


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