Skip to main content

News

Topic: SetTile() bug? (Read 2060 times) previous topic - next topic

SetTile() bug?
OR maybe I'm just using it incorrectly?

It's setting it to the correct position on the map with the correct tile I specify, but the tile isn't placed on the correct layer.

Basically I'm adding in stuff to go above the player (so the player is hidden underneath what I'm putting there).

The picture below explains it better, the grate on the floor should appear above the player like that caution block that is already.

(I have three layers on my map, base, level & above. Player is set on level. )
Code: (javascript) [Select]
SetTile(23,22,"Above",51);

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: SetTile() bug?
Reply #1
Try using the layer number for the layer: SetTile(23,22,2,51);

I do this because I'm used to setting tiles relative to a players layer:
Code: (javascript) [Select]

SetTile(23,22,GetPersonLayer("player")+1,51);
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

Re: SetTile() bug?
Reply #2
Thanks, that worked!

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: SetTile() bug?
Reply #3

Code: (javascript) [Select]
SetTile(23,22,"Above",51);



This is why I have to recommend using minisphere from here on out.  The much stricter type checking on API arguments would have caught this immediately.
miniSphere 5.0.1 - Cell compiler - SSj debugger - thread | on GitHub
For the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: SetTile() bug?
Reply #4


Code: (javascript) [Select]
SetTile(23,22,"Above",51);



This is why I have to recommend using minisphere from here on out.  The much stricter type checking on API arguments would have caught this immediately.


AFAIK his code ought to work in Sphere. When I saw N E O use the layer name in his game I thought that was neat and never seen it before. Maybe the Sphere API is spotty on when it allows the name? Further, maybe there are certain engines that have that behavior and other engines that do not?
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: SetTile() bug?
Reply #5

AFAIK his code ought to work in Sphere. When I saw N E O use the layer name in his game I thought that was neat and never seen it before. Maybe the Sphere API is spotty on when it allows the name? Further, maybe there are certain engines that have that behavior and other engines that do not?


Nope, referencing layers by name doesn't work in Sphere, at least not Sphere 1.5.  That's one of the changes I had to make the get Artyxx to work at all, even in vanilla.

That said, it would certainly be easy enough to support it in minisphere. :D
  • Last Edit: March 23, 2015, 03:01:24 am by Lord English
miniSphere 5.0.1 - Cell compiler - SSj debugger - thread | on GitHub
For the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan

  • N E O
  • [*][*][*][*][*]
  • Administrator
  • Senior Administrator
Re: SetTile() bug?
Reply #6
I believe referencing layers by name (especially in functions like SetTile) was going to be a 1.6 addition. I was using the 1.6b4 engine to test out Artyxx on Windows and to put it through its paces so I could have given a more thorough bug report re 1.6 improvements.

  • Radnen
  • [*][*][*][*][*]
  • Senior Staff
  • Wise Warrior
Re: SetTile() bug?
Reply #7

I believe referencing layers by name (especially in functions like SetTile) was going to be a 1.6 addition. I was using the 1.6b4 engine to test out Artyxx on Windows and to put it through its paces so I could have given a more thorough bug report re 1.6 improvements.


That explains it! :P
If you use code to help you code you can use less code to code. Also, I have approximate knowledge of many things.

Sphere-sfml here
Sphere Studio editor here

  • Fat Cerberus
  • [*][*][*][*][*]
  • Global Moderator
  • miniSphere Developer
Re: SetTile() bug?
Reply #8

That said, it would certainly be easy enough to support it in minisphere. :D


Aaaannnd it's done. Map layers can now be referenced by name in minisphere. ;D
miniSphere 5.0.1 - Cell compiler - SSj debugger - thread | on GitHub
For the sake of our continued health I very much hope that Fat Cerberus does not become skilled enough at whatever arcane art it would require to cause computers to spawn enourmous man eating pigs ~Rhuan