Bug in math.random?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
wx3
Posts: 10
Joined: Mon Aug 08, 2016 6:14 pm

Bug in math.random?

Post by wx3 »

math.random(7) seems to be returning values from 0 to 7 (should return from 1-7). Is this a known bug?

I'm on version 1.7.7.2.
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bug in math.random?

Post by Tony Li »

Hi,

Yes, that appears to be a bug in LuaInterpreter. I'll fix it in versions 1.8.6 and 2.0.5. I'm going to be traveling next week, which will delay 1.8.6 until the week after. I'll still be providing support through email and the forum, but development will be on hold next week.
User avatar
Abelius
Posts: 318
Joined: Fri Jul 21, 2017 12:45 pm

Re: Bug in math.random?

Post by Abelius »

Oh, this could explain some bugs we had in the past. :P
Unity 2019.4.9f1
Dialogue System 2.2.15
User avatar
Tony Li
Posts: 21925
Joined: Thu Jul 18, 2013 1:27 pm

Re: Bug in math.random?

Post by Tony Li »

This is fixed for version 2.x in patch 2018-09-09. (PM me your Asset Store invoice number if you need access.)
Patch 2018-09-09 Release Notes
  • Fixed: Lua math.random(x) now correctly return values [1..x] instead of [0..x].
  • Fixed: TextMesh Pro Typewriter Effect wasn’t using alternate audio clips.
  • Input Device Manager: Added Control Graphic Raycasters checkbox.
  • Standard & Unity UI dialogue UIs & quest log windows: Added Add EventSystem If Needed checkbox.
  • articy:draft: Instructions and Jumps are now converted as blank nodes with None() sequences instead of Group nodes.
  • Invector Controller: Added vAddItemByID() Lua function.
I'll have a fix in 1.8.6 the week after next.
Post Reply