View Single Post
  #4  
Old 04-26-2011, 04:10 PM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
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.
Reply With Quote