possible Random (0,1) glitch

Started by AngelShadow9451 on

Topic category: Troubleshooting, bugs, and solutions

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
possible Random (0,1) glitch
Sun, 08/09/2020 - 08:24 (edited)

EDIT: I have confirmed this is a glitch. It only happens in singleplayer or if your are hosting a LAN session any players that try to join will not have the double result issue. I dont know much about code, but I assume that one of the procedures are using the wrong type of code. Possibly meant for a server?

I am unsure if this is a glitch but I have looked into it for all of today and I just cant seem to understand why I am getting two results instead of one:

Code with possible issues for drawing

I have that code set to activate when I rc on a block and I clicked on it once and this is what I got in chat:

Screenshot of card draw

This is my dice rolling code (completely separate from the above code) In this use case I attempted to have it set up to say {Player}'s Dice roll then have two random numbers between 1-6 listed in chat.

Dice roll code

 This is what happens when I test it:

screenshot

 

(version 2020.4)

 

Edited by AngelShadow9451 on Sun, 08/09/2020 - 08:24
Joined Jan 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Did you know that it…
Tue, 08/04/2020 - 08:50

Did you know that it generates a Number from 0 to 1,

so you need to do:

The rounded Number (0-18) +1 because "0" is not in the script. I don't know if you mean that.

Joined Jan 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Same with Dice, it generates…
Tue, 08/04/2020 - 08:52

Same with Dice, it generates a number between 0 and 6, not 1 and 6, I don't really know if you mean that.

And you don't need the "Format Number as #". Just use the round up thing without format number.

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thank you but I will do that…
Tue, 08/04/2020 - 09:19

thank you but I will do that but i am referring to the double output in chat. I only have the dice setup to give me one number but it gives me two and same with the other.

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
also the format number as is…
Tue, 08/04/2020 - 09:21

also the format number as is the only way for my to get it displayed to chat for some reason

Joined Jun 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Random(0,1) is determined…
Thu, 08/13/2020 - 17:07

Random(0,1) is determined randomly for every time you use it, it's known to cause desyncs like this.
You might be able to go around this by having the dice result be determined by the internal server instead of the client.

Also, a random number between 1 and 6 could be Random(0,5)+1 (that's what I tend to do), with a round() block

Joined May 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you for your comment…
Thu, 08/13/2020 - 20:24

Thank you for your comment. I have it currently set up with Random(0,5)+1 with round

How would you set it up for the internal server?