#4
Post
by Onishion » Thu Sep 24, 2015 5:07 pm
Well, one tip is that if you hit "shift-d" while playing the game, it brings up a menu that includes a variable viewer. Check the variable in question and make sure that it ends up being what you think it should be. If you check "Variable >= 5" and you think it should be a 6 at that point, but it's actually a 3, then you're having problems with the increment, not with the checking, right? It can also be helpful when trying to test things like this to just have "loop points = [loop_points]" lines of dialog in between testing things, so that it prints out what the variables you're working with are. That way you don't even need the variable viewer, and you can just remove them once you have it working right.
As for your example, it's got some clear flaws. For one thing, what will happen there is that if the first bit is found true, if both variables = 2, then it will say words and jump to label 2. If it's false, it won't say those lines, but it will still jump to label 2, because you haven't put anything else for it to do if it finds false, it just falls through to the next thing, which is label 2. You should either add an "else" block, or just have another set of commands under there that would act as a de facto "else" block. But yeah, the "correct" response to the example as written should be that it runs through, finds the result "False" because loop_points == 2 but luck_points != 2 (it equals 1), therefore it should skip the following block and fall down to whichshop2, print the following dialog, and then jump to end.