JS command for switches

Discussion in 'Javascript/Plugin Support' started by Treynor, Sep 28, 2019.

Thread Status:
Not open for further replies.
  1. Treynor

    Treynor Veteran Veteran

    Messages:
    80
    Likes Received:
    49
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm a big time beginner when it comes to Javascript. I'm looking for a specific line of Java. I'm using SRD's Hud Maker and I'm trying to make it so that a certain image shows up when a switch is on. In the conditions box I wrote:

    if ($gameSwitches.setValue(91) === true);

    However I'm not sure how to go past that. Under normal circumstances I could probably write it out from watching others on YouTube, but I don't know how it's done in this conditions box.
     
    #1
  2. caethyril

    caethyril ^_^ Veteran

    Messages:
    1,281
    Likes Received:
    799
    Location:
    UK
    First Language:
    English
    Primarily Uses:
    RMMV
    This means "turn on switch 91":
    Code:
    $gameSwitches.setValue(91, true)
    I think you want this, though:
    Code:
    $gameSwitches.value(91)
    This is true if switch 91 is turned on, else false. A condition is generally a simple true/false value, so try this one instead (no need for the "if" stuff). :)
     
    #2
    Oddball likes this.
  3. Treynor

    Treynor Veteran Veteran

    Messages:
    80
    Likes Received:
    49
    First Language:
    English
    Primarily Uses:
    RMMV
    Works, thank you!
     
    #3
    caethyril likes this.
  4. Kes

    Kes Global Moderators Global Mod

    Messages:
    20,979
    Likes Received:
    10,677
    First Language:
    English
    Primarily Uses:
    RMVXA

    This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

     
    #4
Thread Status:
Not open for further replies.

Share This Page