I seem to have noticed a few bugs but i am not sure. The first is the random values i am getting back seem to be sequenced rather than real random. Maybe Lua has a random that is no good or something but if i close and re-load the app i get the same values as last time.
Also if i have 2 functions in a embedded script where in one function i set a active objects angle etc using random, then in another function get it's angle it will always have 0 for the angle result at the start of the frame. This seems like a bug but could be due to the random values in sequence.
The code is simply -
Code:
function set()
mmf.Object.SetAngle(1,math.random(0,359),false)
mmf.Object.SetX(1,352+math.random(-100,100))
mmf.Object.Update(1)
end
function get()
angle = mmf.Object.GetAngle(1)
x = mmf.Object.GetX (1)
return angle,x;
end
I export the active to ID1, run embedded script, call the get and set functions then get back the values to counters. The MMFI, bind state and libs are just set in the properties.
As a workaround to the angle getting 0 you can call the functions twice but it works however it still has the sequenced values problem and the workaround shouldn't be needed also.
Is the default random just bad? or is this a bug or code error?