Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-19-2011, 05:19 PM
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
Question about tiles

When echoing tiles[] on a layer with nothing, (Never edited) I get zero, but isn't 0 technically the tile in the top left most part of the tileset? (Left part of grass) How can I get it so I can check to see if tiles[] is really returning 0 or just no value. ( Like -1, when checking for players)
__________________
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
  #2  
Old 04-19-2011, 06:06 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Usually the tiles are a few numbers or something such as 0x1B0...
You'd have to go offline and to the tile array thing..

I've noticed depending if you get it from offline mode, or from online it changes from 0x1B0 to numbers... try..

player.chat=level.tiles[x,y,]; which would probably give you the numbers.. I hope that works.. if you'd like a square you'd have to build up a for loop..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #3  
Old 04-19-2011, 06:23 PM
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
Quote:
Originally Posted by Devil_Lord2 View Post
Usually the tiles are a few numbers or something such as 0x1B0...
You'd have to go offline and to the tile array thing..

I've noticed depending if you get it from offline mode, or from online it changes from 0x1B0 to numbers... try..

player.chat=level.tiles[x,y,]; which would probably give you the numbers.. I hope that works.. if you'd like a square you'd have to build up a for loop..
Yea, I have the formula to convert a tileset into it's hexadecimal, my problem basically is that when reading a tile that doesn't exist, it reads it as NULL or zero. Which is actually a tile on the tileset. I was just hoping for a way to differentiate between a NULL tile and the actual tile 0.
__________________
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
  #4  
Old 04-19-2011, 06:46 PM
Devil_Lord2 Devil_Lord2 is offline
David K?
Devil_Lord2's Avatar
Join Date: Apr 2011
Location: PA, MD.
Posts: 643
Devil_Lord2 can only hope to improve
Oh.. I get you.. sorta.. it sounds like it is reading the pitch black.. D: but I guess I can't help much here then.. sorry lol..
__________________

Digital Media Artist - David K? </3 (UnLoved)
www.davidkrout.com
www.twitch.com/DavidKkz



Reply With Quote
  #5  
Old 04-19-2011, 11:09 PM
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
Yea, I have the formula to convert a tileset into it's hexadecimal, my problem basically is that when reading a tile that doesn't exist, it reads it as NULL or zero. Which is actually a tile on the tileset. I was just hoping for a way to differentiate between a NULL tile and the actual tile 0.
Try using player.levels.tiles[x, y].type() to check for a difference.
__________________
Quote:
Reply With Quote
  #6  
Old 04-20-2011, 03:19 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
That only checks layer 0, I need to check layers greater than 0.
__________________
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
  #7  
Old 04-20-2011, 03:29 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
That only checks layer 0, I need to check layers greater than 0.
Alter it to work with tilelayers then...
__________________
Quote:
Reply With Quote
  #8  
Old 04-20-2011, 03:52 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
Quote:
Originally Posted by fowlplay4 View Post
Alter it to work with tilelayers then...
Yea, I was thinking about storing the layer 0 tile in a var, then set layer 0 to whatever layer tile I want to check, then put everything back... Gotta love Graal work arounds, you have any better ideas?
__________________
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
  #9  
Old 04-20-2011, 04:05 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
player.level.tilelayers[n].tiles[x, y].type()

You should really figure out what the actual value for the top-left tile on the tileset is before you make the assumption that it's 0. In the Tile Format it shows up as AA. Checking for 0 might be fine...
__________________
Quote:
Reply With Quote
  #10  
Old 04-20-2011, 04:36 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
Quote:
Originally Posted by fowlplay4 View Post
player.level.tilelayers[n].tiles[x, y].type()

You should really figure out what the actual value for the top-left tile on the tileset is before you make the assumption that it's 0. In the Tile Format it shows up as AA. Checking for 0 might be fine...
Value wise it is 0...

Also using type on any layer but 0 returns -1
__________________
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
  #11  
Old 04-20-2011, 04:43 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
Quote:
Originally Posted by fowlplay4 View Post
player.level.tilelayers[n].tiles[x, y].type()

You should really figure out what the actual value for the top-left tile on the tileset is before you make the assumption that it's 0. In the Tile Format it shows up as AA. Checking for 0 might be fine...
His complaint is legit. AA is simply the base64 encoding Graal uses to save the tile data in the .nw format. That format isn't really dealt with in GS2 at all. tiles[] returns integers, and Graal handles hex -> int and vice versa for you. Either way, 0 IS the top-leftmost tile, and not AA(since like I said, base64 is strictly used for saving/loading the levels and nothing else).

He is correct in his problem that Graal does not handle absent tiles correctly. Gonstruct optimizes the saving of layered levels to bring down the file size, so doesn't include nonexistent tiles when it saves. If Graal is reading these tiles as 0, then there is a problem(a non-existent tile isn't rendered in v6 as far as I know, so it's not the same as tile 0, or the half-grass tile).
Reply With Quote
  #12  
Old 04-20-2011, 05:46 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
Well I guess the only thing left to do is make a Feature Request. (I've barely touched tiles, excuse my lack of exp on the topic)

In the short-term I would probably just accept it as a limitation and ignore '0' tiles on tilelayers 1+ then if functionality does get added it shouldn't be a problem to change your tile check function. Would there really be a point to half grass on those layers anyway?

or do could attempt somethign creative with the following:

TTileLayer - object type, parent type is TTileMapObject, cannot be created by script
TServerLevel.tilelayercount - integer
TServerLevel.tilelayers - object (read only)
TTileLayer.gettileanimation(int, int) - returns string
TTileLayer.gettileflags(int, int) - returns string
TTileLayer.gettileframe(int, int) - returns integer
TTileLayer.gettileimagemap(int, int) - returns string
TTileLayer.layerfile - string
TTileLayer.tilecountx - integer
TTileLayer.tilecounty - integer
TTileLayer.tilesizex - float
TTileLayer.tilesizey - float
__________________
Quote:
Reply With Quote
  #13  
Old 04-20-2011, 04:38 PM
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 cool, seems tiles[] are working on layers today. Iit's now returning -1 one for non-existent tiles.
__________________
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 06:41 AM.


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