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.

Conditional Branch with switches in script?

Status
Not open for further replies.
I've looked in the FAQ and have searched, but can't seem to find an answer. I know how to set a switch true or false with a script, but how exactly do you make something (like part of a window) only appear when a switch is on. I tried

Code:
      if $game_switches[x] = true

but it doesn't seem to work.
 

sgeos

Member

Code:
$game_switches[x] = true  # set the switch
$game_switches[x] == true  # test the switch
In general, try to use this when testing:
Code:
true == $game_switches[x]
That way, if you mess up and type = instead of ==, the script won't work, and you can go and fix it.
Code:
if true == $game_switches[x]
	# do something
end

EDIT: This should set $game_switches 
 
Status
Not open for further replies.

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