Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Tile File Data formula (https://forums.graalonline.com/forums/showthread.php?t=134262980)

MrOmega 04-25-2011 10:54 PM

Tile File Data formula
 
Does anyone know a formula to convert the .nw file data to something workable in GS? like AA = 0x0 in hex.

fowlplay4 04-25-2011 10:58 PM

See Base64 <-> Tile Functions
http://forums.graalonline.com/forums...hp?t=134258008

MrOmega 04-25-2011 11:23 PM

Thank you.

scriptless 04-26-2011 04:10 PM

This is part of the script I use for handling ".nw". If you would like the full script I can send you it, tho it is in PHP not GS1 or GS2.. Still the concepts should work.

PHP Code:

$base64 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
for ( 
$i=0$i<64$i++ ) {
  for (
$k=0$k<64$k++ ) {
    
$temp $test[$k][$i];
    
$tile dechex(strpos($base64,$temp[0])*64+strpos($base64,$temp[1]));
    
$tilex hexdec(substr($tile0, -1)) % 32;
    
$tiley floor(hexdec(substr($tile0, -1))/32)*16 hexdec(substr($tile, -1));
  }


In this case Tile would be the base64 to hex value.. Tilex would be the number of tiles left to right on the tileset. And tiley would be up and down. To get the starting pixel of the tile you must multiple the x/y by 16 pixels.

MrOmega 04-26-2011 06:43 PM

Its alright, I'm using dusty's formula.


All times are GMT +2. The time now is 10:37 AM.

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