Page 1 of 1

New LUA function?

Posted: Thu Feb 28, 2013 4:59 pm
by DaveDewhurst
Whilst trying to understand why London - Faversham runs slow (in another thread), I was looking at the .out file for the 395.
Although mostly gibberish you can read some bits, like calls and variable names.

I was intrigued to see the clock parts listed as names because;
1. I would have thought it was unneeded to script a clock as the game will automatically set the clock as long as your parts are named correctly in a clock blueprint. (see the ICE2 for an example)
2. To script a clock you would need to be able to get the current time.

Reading a bit further down I think I see a new call (I dont recall ever seeing this one before)
"SysCall ScenarioManager:GetTimeOfDay"
Its obviously lost its formatting and any arguments but could this be the function a lot of us have been waiting for?

Dave

Re: New LUA function?

Posted: Thu Feb 28, 2013 5:51 pm
by ChrisBarnes
Interesting find Dave, I think a few new call functions were added to the game including the particle velocity function, but sadly these don't seem to have been documented in the wiki or elsewhere. :(

Chris

Re: New LUA function?

Posted: Thu Feb 28, 2013 8:02 pm
by DaveDewhurst
Well.
It works :D

SysCall ("ScenarioManager:GetTimeOfDay")

returns seconds since midnight.

Dave

Re: New LUA function?

Posted: Fri Mar 01, 2013 12:26 am
by firetrap1
I think I just had a flash back to MSTS!

Re: New LUA function?

Posted: Fri Mar 01, 2013 10:31 am
by AndiS
The funny thing is that I need a book now where I note all my ideas and why they don't work, so when someone comes up with a great find like this, I remember what I wanted to do with it.

I keep thinking for a day now and all I remember was writing a much improved train movement log (as a service function of the signals). With the real time of day, this could actually help scenario creators understand where all the AI trains stayed when they are too far from the player train to observe.

Re: New LUA function?

Posted: Fri Mar 01, 2013 11:25 am
by shanyiqua
Now the only thing is needed, is a good solution for displaying dynamic text, and digits, in game, which is not like the hiding unhiding method with interior visibility.

Re: New LUA function?

Posted: Fri Mar 01, 2013 1:59 pm
by AndiS
Are Texture Sets and SetText too limiting for you?
Hasn't someone already done destination displays?
Or are you thinking about more complex things like proportional font?

There are scriptable scenery items, however, no one has found a good use for them as of yet. This GetTimeOfDay function could change that. You could expand the clock idea to animated figurines like they have it on old town halls. Unfortunately, those are rarely in view of a railway line.

But what about ringing the church bells every full hour (and quarter of an hour) to tell the time? At least for SADs route, the scripting and sound effort should pay off.

Re: New LUA function?

Posted: Fri Mar 01, 2013 2:08 pm
by shanyiqua
Texture sets are not working inside the cab. And that method is still one of the worst solutions that i've ever seen in a game :) Other games have solutions just to write and draw dynamically anything on certain surfaces.

Re: New LUA function?

Posted: Fri Mar 01, 2013 2:26 pm
by DaveDewhurst
AndiS wrote:Are Texture Sets and SetText too limiting for you?
Hasn't someone already done destination displays?
Or are you thinking about more complex things like proportional font?

There are scriptable scenery items, however, no one has found a good use for them as of yet. This GetTimeOfDay function could change that. You could expand the clock idea to animated figurines like they have it on old town halls. Unfortunately, those are rarely in view of a railway line.

But what about ringing the church bells every full hour (and quarter of an hour) to tell the time? At least for SADs route, the scripting and sound effort should pay off.
Station lights that go on at the correct time
Platforms fuller at peak times.
AI using correct Day/Night lights
etc
etc

Dave

Re: New LUA function?

Posted: Fri Mar 01, 2013 3:08 pm
by AndiS
DaveDewhurst wrote:Station lights that go on at the correct time
AI using correct Day/Night lights
Yeah - that was it! More specifically, I remember struggling (before the introduction of projected light) with additive light panes fixed to coaches and it was clear that you would need day and night versions and no one knew how to decide dynamically between them.

Now that you mention AI, I would add AI that does not whistle at night times (or whistle less, depending on the regulations).
Platforms fuller at peak times.
Wasn't there some feature in the platform population blueprint for that? I vaguely remember it being complex, with different population densities for different times. But I never tried it out. And I might confuse it with the road blueprints now, but I don't think so.

Overall conclusion: If you have a forum, you don't need a notebook nor a memory.

Re: New LUA function?

Posted: Fri Mar 01, 2013 3:17 pm
by MaikG
AndiS wrote:Are Texture Sets and SetText too limiting for you?
TextureSets are limited to 2x32 Letters in one object. I want to create a EBuLa for german trains and there you need 5x15 cells to display text with some have more than 64 letters to display. I wont script that matrix for texture sets. With dynamic (font based) text display it would be easy to do such a high dynamic display.
AndiS wrote:Hasn't someone already done destination displays?
Yes. On a loco with 16 positions of single seperated letters, but not as texture set. But we have tested it with a plattform destination display and it works "good" but its totaly limited and you have to declare those displays as signals.


And for the GetTimeOfDay syscall: it's old. Syscalls are all over there in that sim, but they are not documented, and you have to dig out them by trying worse things. And SysCalls are made for scenario scripting, but works also in vehicles. And note, use this calls with care. Do not create vehicles with wrong or destructing implementations of some syscalls, because if RSC wont that, they cut them out or make it unusable without seperate tools.