Page 1 of 1

LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Mon Sep 14, 2015 7:21 am
by RudolfJan
Hi all,

Since a few months i'm working on a toolkit to make it much easier to create LUA scripts for scenarios. As a by product, the toolkit will contain also a number of handy scenario editing tools. A very first version is now available for download:

https://drive.google.com/open?id=0B5xmS3GoYKV1UjBJeHhIOFlOSzQ

My intention is to issue a new release about everry month, using this URL.

What can you do with this first version?
    Create a list of routes and scenarios. Not yet for routes packed in .ap files, but that will come soon.
    You can open the scenario folder in windows explorer (no more need to serach trhough lists of GUIDs)
    You can view some scenario properties
    You can view the instructions list
    Deleta rolling start saves and current saves from the tool (one mouse click)
    You can edit scenario properties and scenario.bon from the tool
    You can edit and compile LUA scripts from the tool.

In the next release, you probably can do some more things:
    View more scenario properties
    Get a skeleton LUA script, including all relevant trigger events
    Read routes and scenarios in .ap lists

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Mon Sep 14, 2015 7:44 am
by JerryC
Any tool that can make creating scenarios less like a poke in the eye with a sharp stick is a welcome addition!

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Mon Sep 14, 2015 2:58 pm
by Chacal
This sounds great, I can't wait to try it!

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Tue Sep 15, 2015 1:23 pm
by RudolfJan
Working hard on version 0.2 now. First improvements are working now.

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Thu Sep 17, 2015 5:39 am
by OldProf
JerryC wrote:Any tool that can make creating scenarios less like a poke in the eye with a sharp stick is a welcome addition!


I was going to respond to this post, in defense of the scenario editor, but then I looked at your signature motto and realized that there was no need to do so. !*YAAA*! !!howdy!!

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Fri Oct 02, 2015 2:48 pm
by JerryC
Very funny. Remember that before complaining about my next product having no scenarios. !*YAAA*!

Anyway, this is a great tutorial. It has actually even helped to set up messages for triggering locomotive controls that are not dependent on external scenarios. However, I have to ask if you have ever actually been able to trigger a function or a message in an AI vehicle? I have tried to trigger both text and audio messages using an AI train and have had no success. I've tried using both the AI train's unit number and using the AI consist name. What i'm trying to do is trigger a dispatch message to the player train when the AI passes a certain point.

There does seem to be more than one way to skin the cat though. Failing the AI trigger, I suppose you might be able to trigger it by getting the next signal state.

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Sat Oct 03, 2015 6:29 am
by OldProf
JerryC wrote:... However, I have to ask if you have ever actually been able to trigger a function or a message in an AI vehicle? I have tried to trigger both text and audio messages using an AI train and have had no success. I've tried using both the AI train's unit number and using the AI consist name. What i'm trying to do is trigger a dispatch message to the player train when the AI passes a certain point.

There does seem to be more than one way to skin the cat though. Failing the AI trigger, I suppose you might be able to trigger it by getting the next signal state.


I'm ready to swear that triggering a written on-screen message with an AI engine was possible at one time, but I don't think it's possible anymore. I'll put together a test scenario and see what happens.

A much more serious wish on my part is being able to start an AI train moving when the player train passes a particular track marker.

"If wishes were fishes, we'd all have a fry," as my mother used to say.

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Sat Oct 03, 2015 11:35 am
by JerryC
I tried the "Get next signal state" approach (no pun intended) last eve, but with no success. That does not mean this method does not work though; my LUA-Kung Fu is weak. I shall have to study further.

According to what i've ready from other sources since writing the GP40 scenarios last year, you should be able to do all sorts of things to the AI through the Script: blow horns, turn on the lights, stop, start - but i've yet to be able to make them do anythng. If I do remember correctly, the HSC route has several scenarios that call on the AI to do things, using the unit number just like the tutorial states.

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Tue Oct 13, 2015 11:35 am
by RudolfJan
JerryC wrote:I tried the "Get next signal state" approach (no pun intended) last eve, but with no success. That does not mean this method does not work though; my LUA-Kung Fu is weak. I shall have to study further.

According to what i've ready from other sources since writing the GP40 scenarios last year, you should be able to do all sorts of things to the AI through the Script: blow horns, turn on the lights, stop, start - but i've yet to be able to make them do anythng. If I do remember correctly, the HSC route has several scenarios that call on the AI to do things, using the unit number just like the tutorial states.

I did some experiments, but no success till now. If I am in the right mood, I will try again...

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Thu Oct 15, 2015 8:54 am
by OldProf
Sorry this took so long -- I forgot about it!

Anyway, I wrote a short scenario to test whether an AI train can send an on-screen message to the player without any LUA scripting: I'm pleased to report that the answer is yes!

Details: I gave the AI train three instructions.
1. Trigger with message: message appeared on screen.
2. Drive to with message: message did not appear on screen.
3. Trigger with message: message appeared on screen.

So, it's obvious that an AI's trigger instructions can send a message that appears on the screen while the player is carrying out instructions. Caution: if the AI's message is triggered just as a message generated by the PT's instructions appears, the AI message will bump the PT message off the screen!

!!howdy!!

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Thu Oct 15, 2015 9:02 am
by Chacal
Interesting... this means we can simulate radio calls to dispatcher from AI trains, as a way to inform the player of the whereabouts of other trains.
Thanks for the research.

Re: LuaCreator a new tool for scenario editiing and scripting

Unread postPosted: Thu Oct 15, 2015 12:01 pm
by RudolfJan
OldProf wrote:Sorry this took so long -- I forgot about it!

Anyway, I wrote a short scenario to test whether an AI train can send an on-screen message to the player without any LUA scripting: I'm pleased to report that the answer is yes!

Details: I gave the AI train three instructions.
1. Trigger with message: message appeared on screen.
2. Drive to with message: message did not appear on screen.
3. Trigger with message: message appeared on screen.

So, it's obvious that an AI's trigger instructions can send a message that appears on the screen while the player is carrying out instructions. Caution: if the AI's message is triggered just as a message generated by the PT's instructions appears, the AI message will bump the PT message off the screen!

!!howdy!!

This is great, thanks for sharing, but maybe you should use the Alert message:

Code: Select all
SysCall("ScenarioManager:ShowAlertMessageExt", header, text, duration, event)

If you add another alert message it will appear just below the previous one in the upper right corner. It's my favourite message type, because it is not so intrusive on game play.