1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Random-Number.

Discussion in 'Skript' started by Bapty, Feb 2, 2021.

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

    Bapty Member

    Joined:
    Jan 25, 2021
    Messages:
    13
    Likes Received:
    0
    Can someone help me? If I have a random number generated, what can I do so that it is not generated again?

     
  2. Best Answer:
    Post #4 by MinecraftMatthew, Feb 3, 2021
  3. MinecraftMatthew

    MinecraftMatthew New Member

    Joined:
    Feb 3, 2021
    Messages:
    9
    Likes Received:
    2
    Could you show your code?

    In general if you use the line "a random number between _ and _" it will be a newly generated random number each time you get to that line. If you want to use the same random number for different purposes, you can save it as a variable: "set {_value} to a random number between _ and _" -> do whatever you want with {_value}. Let me know if that's not the question though.
     
  4. Bapty

    Bapty Member

    Joined:
    Jan 25, 2021
    Messages:
    13
    Likes Received:
    0
    I understand, my question is what can I do to prevent the random number (if it has been assigned) from being assigned again.
     
  5. MinecraftMatthew

    MinecraftMatthew New Member

    Joined:
    Feb 3, 2021
    Messages:
    9
    Likes Received:
    2
    You could test to see if a value has been set using "if {variable name} is set:" and only assign it a value if not
     
    • Like Like x 1
  6. Bapty

    Bapty Member

    Joined:
    Jan 25, 2021
    Messages:
    13
    Likes Received:
    0
    Thanks.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...