To me it sounds quite intuitive that a path with length of 0, isn't really a path at all, and thus doesn't fire any events?
- Game Maker Community
- → Viewing Profile: Posts: Murska
Murska
Member Since 24 Mar 2005Offline Last Active Yesterday, 09:46 PM
Community Stats
- Group GMC Member
- Active Posts 265
- Profile Views 3868
- Member Title GMC Member
- Age 21 years old
- Birthday August 3, 1991
-
Gender
Male
-
Location
Finland
-
Version
Unknown
Latest Visitors
Posts I've Made
In Topic: No "End Of Path" Event If Path Has Length 0
10 May 2013 - 03:34 PM
In Topic: Switch Statement "Bug"
28 April 2013 - 07:27 PM
There is no missing break, since the purpose of the "default:" label there is for any untreated value to fall through to the "case 1:" label. Ie. any other value than is explicitly defined in the other case labels is treated as the value was 1. Fallthrough (multiple labels per one block of code, and one break; ) is something that switch statements allow you to do, even the GM manual gives you an example of this (however, not with a "default:" label).
Could you post your code where you get an expected result with the "default:" label at the top of the switch-case structure. I tried this piece of code where I even removed the fall through, so there is no "missing break;"
Still, it executes the piece of code under the "default:" label, instead of "case 2:" . Now there isn't even anything fishy going on with the fallthroughs, so its quite evident that GM doesn't handle the "default:" label as you would expect, but instead more as an "case ANYTHING:" label.
var variable = 1; // DOES NOT WORK
variable = 2; // DOES NOT WORK
//variable = 3; // WORKS
switch(variable) {
default:
show_message("Variable is on unknown state (?)");
break;
case 1:
show_message("Variable is 1");
break;
case 2:
show_message("Variable is 2");
break;
}
In Topic: Switch Statement "Bug"
28 April 2013 - 11:22 AM
Frankly I did not even notice that. All I saw was the messing break;
Do you still think there is a missing "break;" in my code? ![]()
In Topic: Switch Statement "Bug"
27 April 2013 - 11:57 PM
Here is a screenshot of a C-program running a similar piece of code to show that Game Maker really doesn't compute the switch-case here as you would expect! It is not a matter how the switch-case is laid out, or a missing break. I think I know pretty well how a switch-case works, and should work ![]()
Screenshot of both GM and C programs
ParodyKnaveBob's solution fixes the problem without changing the logic of the code, but on the other hand, this kind of thing shouldn't be so hard to fix that we'd have to add yet another thing to the list of things we have to make a workaround for in GM to make things work out correctly.
I guess what I wanted to discuss here is, do other people use the default keyword in other places than as the last case of the switch construct? Do you think that there is a real risk of breaking a lot of games out there if this bug was fixed?
In Topic: Switch Statement "Bug"
27 April 2013 - 05:19 PM
You need to move the default all the way AFTER each case statement.
No, there is no reason why it shouldn't work like this. It is just a bug or maybe more like a peculiarity of GM.
- Game Maker Community
- → Viewing Profile: Posts: Murska
- Privacy Policy
- GMC Rules and Forum Rules ·



Find content
