Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Kyka

Stuck on a line of code.

Recommended Posts

Ok, Ok, its a pretty simple line, but for all my wiki hunting and pulling-apart-of-others-coding, i can't figure out why it wont work.

Script 4 (void)
{
If (CheckInventory("RedCard")) && (redkey = 0)
{
redkey++
other script stuff.
}
else
{
}
}

I want the script to check for both the player having a red key card and for the variable redkey to be zero, so you can only run the script once, even tho multiple linedefs can trigger it.

Any help appreciated.

Thanks. :)

Share this post


Link to post

Kyka said:

     If (CheckInventory("RedCard")) && (redkey = 0)

Check your parentheses. :)

edit: Also, shouldn't it be "redkey == 0" and lowercase "if"?

edit II: Please use the [code]-tags for posting code, makes life a bit easier. :)

Share this post


Link to post

Thanks Jodwin.

Simple as moving a bracket. It's so obvious now that you have pointed it out. (As these things often are.)




<-- Not a natural coder. (as if you can't tell). And I'll keep those [code] tags in mind for next time.

Share this post


Link to post
Kyka said:

<-- Not a natural coder.

Misplaced (or simply forgotten) brackets happen to anyone; the problem here is that apparently the ACS compiler (or whatever it is that actually does most of the work) is bad at giving errors. More modern compilers (and/or debuggers) would have been able to tell what's wrong right away.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×