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
Anything wrong with this if-statement?
maggigyo Offline
Junior Member

Posts: 6
Threads: 4
Joined: Mar 2012
Reputation: 0
#1
Anything wrong with this if-statement?


Can someone please tell me if there is something wrong with this if-statement?

if(GetLocalVarInt("gamestate")==6)


I have used the ProgLog to make sure exactly where the problem lies.
This statement is inside my own function, but the function itself works.
The gamestate variable has the value 6 at this point as well.
The problem definately is the if-statement.


I have some programming experience with C++. However, I don't know what differences there are when using AngelScript. This leads to a lot of guessing like "maybe I should do something different that I don't know of".
(This post was last modified: 03-28-2012, 11:54 AM by maggigyo.)
03-28-2012, 11:12 AM
Find
SilentStriker Offline
Posting Freak

Posts: 950
Threads: 26
Joined: Jul 2011
Reputation: 43
#2
RE: Anything wrong with this if-statement?

It doesn't look wrong.

03-28-2012, 11:15 AM
Find
palistov Offline
Posting Freak

Posts: 1,208
Threads: 67
Joined: Mar 2011
Reputation: 57
#3
RE: Anything wrong with this if-statement?

Like Silent said, your if statement is syntactically correct. Shouldn't be an issue there. What statement(s) follow your if statement? Also, where is this if statement? If I recall correctly, if statements enclosed in for-loops or switch-case structures can cause issues. Maybe it's vice versa. But anyways my experience just tells me to avoid that kind of control flow, especially if your if statement is using braces to enclose more than one expression.

And do the statements enclosed following your if statement fail to execute? Also, try adding a debug message to show you the value of the local variable "gamestate". To concatenate, just use the + operator between the string and GetLocalVarInt("gamestate"). It's one of the rare few implicit conversions we are allowed to do without the compiler throwing a fit.

By the way. What does ProgLog do? I've NEVER used it and the documentation on it is skint. I usually use Print or AddDebugMessage Smile

(This post was last modified: 03-28-2012, 08:30 PM by palistov.)
03-28-2012, 08:25 PM
Find




Users browsing this thread: 1 Guest(s)