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?"!
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#9
RE: Let's play "why doesn't my script work?"!

(04-12-2013, 09:08 AM)Your Computer Wrote: 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.

Oh yeah. So it should be changed to
PHP Code: (Select All)
if(GetLocalVarInt("gateopen") >= 4
Since it's larger than 4. Unless it's somehow 4 (MAGIC), i added an 4 so it became "larger than/equal to" 4.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 04-12-2013, 10:06 AM by PutraenusAlivius.)
04-12-2013, 10:05 AM
Find


Messages In This Thread
RE: Let's play "why doesn't my script work?"! - by PutraenusAlivius - 04-12-2013, 10:05 AM



Users browsing this thread: 2 Guest(s)