View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0026573||Runner||Functions||Public||2017-05-19 08:54||2018-10-26 11:36|
|Reporter||Dan||Assigned To||Russell Kay|
|Priority||High||Severity||C - General||Reproducibility||100%|
|Platform||Windows||OS||Windows 10||OS Version||Pro x64|
|Target Version||2.2.1||Fixed in Version||2.2.1|
|Summary||0026573: Functions: instance_create_depth() should throw a compile error when passed a non-number string for the depth value|
|Description||instance_create_depth() should throw a compile error when passed a non-number string for the depth value (i.e., a layer name). Right now, it allows the string, but this is invalid in the runner, and so your whole game is drawn as a black screen.|
[EDIT: This change was likely a red herring as to what the actual issue was in this sample project that was causing the black screen, but coincidentally did expose a legit bug.]
|Steps To Reproduce||1. Import the attached sample.|
2. Run it for Windows.
3. Observe no compile errors, but game just draws a black screen/nothing.
4. Swap out the code in the tank object's Create event and run the game again and observe it is fixed now.
|Tags||No tags attached.|
|1.4 Found In|
|2.x Runtime Found In||126.96.36.199|
|2.x Runtime Verified In||188.8.131.528|
TanksPrototype.yyz (20,231 bytes)
|Won't throw a compile error, but could throw a runtime one.|
||Looking at what the code does internally it'll actually try to convert a string to a number - i.e. it'll convert "100" to the actual numerical value. I'm not sure if that's what we actually want but I suppose it's not technically 'wrong'. It does mean that if we want to maintain that functionality I can't just do a string check and throw an error.|
||Fixed in gitlab|
Realised when verifying this that YYGTest has long done the exact same thing, and that always worked fine, but now throws a code error. Re-ran this sample in 2.2.0 (before our change to do the code error), and the sample works as expected, so the real fix for this project's issue must have been done previously.
We should undo this change before 2.2.1 goes out, as now devs will needless get a code error for previously-working code.
Okay, so... YYGTest and the sample above both work in 2.2.0, but the reason they work is because instance_create_depth() taking in a string has always just returned 0. The "Instances" layer happens to be 0, so it appeared to work.
The fix is good, as it stops user code issues when the layer specified does not equal 0. It also DOES now work if you pass in a string of a suitable depth number - e.g., "100".