Forged Alliance Forever Forged Alliance Forever Forums 2015-01-20T21:36:23+02:00 /feed.php?f=45&t=8845 2015-01-20T21:36:23+02:00 2015-01-20T21:36:23+02:00 /viewtopic.php?t=8845&p=91758#p91758 <![CDATA[Re: need help accessing game clock]]> find where blueprints.lua is initialised from and use the above dofile from above.

blueprints.lua is loaded into a different "front end" user state and then stored in a metatable and passed to the user state when done
internal ofcourse. just load your utility files before blueprints.lua is loaded and you should be golden.

Statistics: Posted by Domino — 20 Jan 2015, 21:36


]]>
2015-01-17T02:59:54+02:00 2015-01-17T02:59:54+02:00 /viewtopic.php?t=8845&p=91401#p91401 <![CDATA[Re: need help accessing game clock]]>
ckitching wrote:
Sheeo wrote:
Thim wrote:I need to setup a random seed prior to when the normal seed is setup (as far as I can tell), so I need to setup something that gives me a way to make my calls to math.random() different every game. os.time() isn't working for me when I am using it in Blueprints.lua. Does anyone know what may be causing a problem, or know of another way to get random numbers without resorting to utilities.lua? (those methods also aren't working for me, and I don't think it's on my end)


You can't call os.time from within the sim.

Why doesn't GetRandomFloat/Int in utilities.lua work for you? They're used throughout the entire codebase.


There's also GetSystemTimeSeconds(), which returns the system time as a fractional number of seconds (amusingly enough). It's probably millisecond-precise, plus floating point error.


That function is only available in the user state.

There is an awkwardly named sim-exposed function called "GetSystemTimeSecondsOnlyForProfileUse", but as the name suggests, you should not be using it for anything but profiling.

Statistics: Posted by Sheeo — 17 Jan 2015, 02:59


]]>
2015-01-16T13:33:24+02:00 2015-01-16T13:33:24+02:00 /viewtopic.php?t=8845&p=91331#p91331 <![CDATA[Re: need help accessing game clock]]>
Sheeo wrote:
Thim wrote:I need to setup a random seed prior to when the normal seed is setup (as far as I can tell), so I need to setup something that gives me a way to make my calls to math.random() different every game. os.time() isn't working for me when I am using it in Blueprints.lua. Does anyone know what may be causing a problem, or know of another way to get random numbers without resorting to utilities.lua? (those methods also aren't working for me, and I don't think it's on my end)


You can't call os.time from within the sim.

Why doesn't GetRandomFloat/Int in utilities.lua work for you? They're used throughout the entire codebase.


There's also GetSystemTimeSeconds(), which returns the system time as a fractional number of seconds (amusingly enough). It's probably millisecond-precise, plus floating point error.

Statistics: Posted by ckitching — 16 Jan 2015, 13:33


]]>
2014-12-05T15:42:44+02:00 2014-12-05T15:42:44+02:00 /viewtopic.php?t=8845&p=87311#p87311 <![CDATA[Re: need help accessing game clock]]> http://supcom.wikia.com/wiki/LUADOC_1.5.3599

Statistics: Posted by Resin_Smoker — 05 Dec 2014, 15:42


]]>
2014-12-01T17:05:17+02:00 2014-12-01T17:05:17+02:00 /viewtopic.php?t=8845&p=87077#p87077 <![CDATA[Re: need help accessing game clock]]>

Why doesn't GetRandomFloat/Int in utilities.lua work for you? They're used throughout the entire codebase.


When I attempted to use these, I got the closest thing to a crash that supcom seems to give: the ACU is invisible and the score screen is blank. I was careful to use the methods in the same way that unit.lua did with artillery, but I still may have made a mistake. I currently think that the reason that it doesn't work is that something isn't set up by the time that the blueprints.lua runs, but is ready later in the program, but that's just my guess. As you can tell, I am not too well versed in forged alliance's code.

Statistics: Posted by Thim — 01 Dec 2014, 17:05


]]>
2014-11-12T14:27:13+02:00 2014-11-12T14:27:13+02:00 /viewtopic.php?t=8845&p=85747#p85747 <![CDATA[Re: need help accessing game clock]]>
Thim wrote:
I need to setup a random seed prior to when the normal seed is setup (as far as I can tell), so I need to setup something that gives me a way to make my calls to math.random() different every game. os.time() isn't working for me when I am using it in Blueprints.lua. Does anyone know what may be causing a problem, or know of another way to get random numbers without resorting to utilities.lua? (those methods also aren't working for me, and I don't think it's on my end)


You can't call os.time from within the sim.

Why doesn't GetRandomFloat/Int in utilities.lua work for you? They're used throughout the entire codebase.

Statistics: Posted by Sheeo — 12 Nov 2014, 14:27


]]>
2014-11-08T03:02:23+02:00 2014-11-08T03:02:23+02:00 /viewtopic.php?t=8845&p=85456#p85456 <![CDATA[need help accessing game clock]]> Statistics: Posted by Thim — 08 Nov 2014, 03:02


]]>