Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

If command error

I've been trying to use an if command to check if a specific switch is on, to no avail. Instead of checking to see if the switch is on or off, it gives me an error:

http://img.photobucket.com/albums/v652/glitchfinder/rmxp%20org/Scripterror.png[/IMG]

This error occurs at startup.

Now, the line of code it is referencing is:

Code:
if $game_switches[0001] == true

I've tried it with different variations of 1 and 01, etc.

Now, if someone could please help, it would certainly be appreciated.
 

OS

Sponsor

It is recommended that you use just 1, with no leading 0's. Other than that, I see no problem. Try taking away the '== true' part, so that it only has:

Code:
if $game_switches[1]

That should return True if the switch is on.

If that doesn't work, can you post the method that this line of code is being added to?
 
OptimistShadow;261647 said:
It is recommended that you use just 1, with no leading 0's. Other than that, I see no problem. Try taking away the '== true' part, so that it only has:

Code:
if $game_switches[1]

That should return True if the switch is on.

If that doesn't work, can you post the method that this line of code is being added to?

Well, I'm trying to modify Yeyinde's Zelda Map Scroll script so that it only activates when a specific switch is on. I've inserted your suggestion in several places, and the only difference I recieved was an error message referencing another (default, unedited) script and >= not being a defined method.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top