Solved variables

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Marc

Active Member
Nov 27, 2020
94
0
8
17
If theres any possible way you could set a variable to true/false using a inventory click in a gui?

No code, just wondering
 
Code:
Create a variable with initial state
Create GUI with item describing value of the variable

Handle on inventory click event
   Use logical negation to change the value of variable to it's opposite
   Update inventory item (e.g. a red wool will become a green one)
In programming this is usually done as:
Code:
variable = !variable
 
Sure you can! Just make it so, you set the variable to 0 when the skript is loaded.
Code:
if {this} is 0:
  set {this} to 1
else:
  if {this} is 1:
    set {this} to 0
Simple!
 
Sure you can! Just make it so, you set the variable to 0 when the skript is loaded.
Code:
if {this} is 0:
  set {this} to 1
else:
  if {this} is 1:
    set {this} to 0
Simple!
This can be done even simpler:
Code:
set {_boolean} to not {_boolean}
 
Status
Not open for further replies.