Dynamically Escalating Minimum Random Value?

MoikMoik Member, PRO Posts: 257
edited May 2014 in Working with GS (PC)

Can the Random range use variables? I want to have a Reroll function which only uses higher rolls. Ex, if the player rolled a 3 in a 0-10 range, and chooses to roll again, I want the range to be 3-10 for the reroll.

I tried using the current state of the attribute, and that didn't work. Ex," game.roll1 = random(game.Roll1, 10)" was still dropping below the 'current' roll value. I was impressed it didn't crash or anything. It's treating game.Roll1 as a usable number, just not the number I want.

[Edit: I've also tried saving the current value with Save Attribute, then rerolling, and using the max function, but it just set the number to 0. Ex, game.Roll1 = max(game.Roll1, game.Roll1Save). And with using Load Attribute to put it back in another integer.]

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @Moik said:
    I tried using the current state of the attribute, and that didn't work. Ex," game.roll1 = random(game.Roll1, 10)". . . .

    This is basically right, but you don't say how these random numbers are being 'delivered', or what behaviours you are using and so on.

    If you change an attribute to random (the attribute, 10) - it will bring the lower level up with each iteration.

  • SocksSocks London, UK.Member Posts: 12,822

    Like this:

  • MoikMoik Member, PRO Posts: 257

    Holy, a video even!?
    The problem was that I wasn't selecting the variable from the list. I was just typing it in manually. I attempted it now when using the manually selected variable name and it works.

    FIXED.

    Thank you, Socks!

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @Moik said:
    Holy, a video even!?

    Yup! I find a quick video communicates stuff better and faster - and is easier to do - than trying to explain something in a 200 word response + it works in all languages.

    @Moik said:
    The problem was that I wasn't selecting the variable from the list. I was just typing it in manually. I attempted it now when using the manually selected variable name and it works.

    FIXED.

    Everyone gets caught out by that one at some point, it would be great if GameSalad recognised typed (rather than selected) attributes, it would save a lot of clicking and scrolling.

  • MoikMoik Member, PRO Posts: 257

    One other thing which would help people not get caught out... not showing a 0 when your syntax is wrong.

    I just propagated the corrected change to the rest of the dice, but in my eagerness I forgot to set the max. So when I tested the reroll, the newly updated dice started showing 0. So I was wrong in my earlier assertion that the game was considering it a usable number.

    Their error handling is a little too graceful. I would have rather seen error text,

  • SocksSocks London, UK.Member Posts: 12,822

    @Moik said:
    One other thing which would help people not get caught out... not showing a 0 when your syntax is wrong.

    I just propagated the corrected change to the rest of the dice, but in my eagerness I forgot to set the max. So when I tested the reroll, the newly updated dice started showing 0. So I was wrong in my earlier assertion that the game was considering it a usable number.

    Their error handling is a little too graceful. I would have rather seen error text,

    Hopefully a lot of these interface idiosyncrasies will get ironed out in the upcoming UI redesign.

Sign In or Register to comment.