Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Let's play "why doesn't my script work?"!
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#6
RE: Let's play "why doesn't my script work?"!

valve1turn, valve2turn and valve4turn do the exact same thing (valve3turn only differs in the state checks). The issue, however, that i can spot is that you're adding to the local map variable more times than you should. Turn one valve correctly, the local map variable becomes 2 by the time the function ends. Turn the second valve correctly, it adds up to 3, notices that it doesn't equal 4 and then moves on to the else, adding up to 4. Turn the third valve correctly, the local map variable adds up to 5, and so on. Therefore, even though the variable reaches 4 at some point, it is never at 4 when checked for 4; it is either greater than or less than 4 at the time it is checked.

Tutorials: From Noob to Pro
(This post was last modified: 04-12-2013, 09:10 AM by Your Computer.)
04-12-2013, 09:08 AM
Website Find


Messages In This Thread
RE: Let's play "why doesn't my script work?"! - by Your Computer - 04-12-2013, 09:08 AM



Users browsing this thread: 1 Guest(s)