Conditional Branch+

Discussion in 'JS Plugin Releases (RMMV)' started by mjshi, Jun 18, 2016.

  1. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    910
    Likes Received:
    721
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @mishakoc You're very welcome, I'm happy it's been useful c:
     
    #61
  2. w.alexander

    w.alexander Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Hi, sorry if this is necroposting.
    I've read through the helpfile multiple times, but I don't know if I'm missing it or not.

    I was wondering if there is a way to check if the value of a given variable is greater than the values of multiple other variables.
    For example, if variable1= 10, is there a way to make it so that the result only happens if variable1's value (10) is greater than the values of variables 2, 3, or 4?
    Sorry if I'm not being clear, or if it has already been described. So far, I'm only able to see that it can check if the variable is a constant value. The traditional editor lets you compare only one variable's value to the variable in question, but not multiple.

    Thanks, and sorry again if it is unclear, or goes against rules.
     
    #62
  3. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    910
    Likes Received:
    721
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @w.alexander
    No, no, not necroposting at all. It's a pretty quick add (currently writing it now), but I couldn't think of a better name than Check.vgreater(....). Any suggestions on what the function should be called?
     
    #63
    w.alexander likes this.
  4. w.alexander

    w.alexander Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    I think Check.vgreater(....) is good. I'm no coder at all, but as long as it allows to compare one variable to multiple other ones at the same time (rather than doing it 1 by 1 or only by a constant value). I figured out a way to do it with default editor, but it is pain and makes wall of text. Thanks for the response. I'll look forward to seeing the new function added. :)
     
    #64
  5. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    910
    Likes Received:
    721
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    #65
    w.alexander likes this.
  6. w.alexander

    w.alexander Warper Member

    Messages:
    4
    Likes Received:
    5
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    #66
  7. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    910
    Likes Received:
    721
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @w.alexander Aww, you're welcome! That's very kind of you, there's no need for it at all but I really do appreciate the gesture c:

    I don't have a Patreon (yet...), but if you like, you can send donations via my PayPal. I usually don't make the link super public (because identity scraping bots are a force to be reckoned with) but I've sent the link to you privately in PM if you decide you really wanna send something my way ;p
     
    #67
  8. CalebW

    CalebW Veteran Veteran

    Messages:
    125
    Likes Received:
    54
    Location:
    New York
    First Language:
    English
    Primarily Uses:
    RMMV
    Awe yea this is perfect for a crafting system I was making. I originally did it through the player loses x items and gains x skill. problem is I think that can put the player into the negative. So this should be a more efficient way to run the check.
     
    #68
  9. AndromedaFr

    AndromedaFr Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    Hi, thanks for this plugin! I've tried to replace the more convoluted coding I did, but I must have made a mistake.

    Can 'Check.in_range' be used to see if one variable is between two values/numbers? If not, how would I handle that? Do I simply have to create another variable and set it to change both variables at the same time?
    (I tried using 'Check.any_inrange' with the variable I need and an extra one set to a number that would never be between the values checked, but I had the same result, the event didn't function.)

    If this normally works I made a mistake somewhere else (unrelated to your script), so I haven't posted the rest of the 'code' yet. This is probably it, but I thought I'd check.
     
    #69
  10. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    910
    Likes Received:
    721
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @AndromedaFr
    Does combining Check.greater and Check.lesser work for you? Ex. Check.greater(1, 5) && Check.lesser(1, 10) to check if 5 <= variable 1 <= 10.
    Otherwise, I'll investigate to see if this is an issue as soon as I'm free.

    (edit: also, make sure you're getting this from github and not dropbox! dropbox may be a little outdated.)
     
    #70
    AndromedaFr likes this.
  11. AndromedaFr

    AndromedaFr Warper Member

    Messages:
    3
    Likes Received:
    0
    First Language:
    Dutch
    Primarily Uses:
    RMMV
    Sorry, it took a while, but I've finally gotten the chance to correct things! Everything is in working order. And it's so much easier to deal with this without all the nesting. Your plugin is brilliant! I can't thank you enough!
     
    #71
  12. Benevolentwanderer

    Benevolentwanderer Veteran Veteran

    Messages:
    40
    Likes Received:
    21
    First Language:
    English
    Primarily Uses:
    RMMV
    @mjshi Hey, would it be possible to mod this plugin to check other inconvenient-to-get hidden variables like player direction and x or y coordinates?


    EDIT: I have experience programming, but not with javascript, and was thinking of taking a stab at doing a mod, but I figured you might have some insight as to whether that's worth doing in the first place, or if I'd just be barking up the wrong tree...
     
    #72
  13. mjshi

    mjshi Jack of Most Trades Veteran

    Messages:
    910
    Likes Received:
    721
    Location:
    USA
    First Language:
    English
    Primarily Uses:
    N/A
    @Benevolentwanderer Sure, go ahead if you'd like! Feel free to contribute, or submit pull requests to GitHub.
    Those shouldn't be too hard to add, I just don't have the time at the moment to add them.
     
    #73

Share This Page