Trainz Events | Fan Sites | Competitions | Museums | Content Creators | Learning Centre | Chat | Forum

 
 

July 14th
Making scenarios better!

Well, today has been a draining day and my report tonight is aimed at the Trainzscript Community.

Although this post is for the "scripters", it will have an impact on users who enjoy playing scenarios. The scenario writer is now able to interact with the user through the new minibrowser as never before. This will lead to scenarios with multiple pages of information, the ability to accept input/choices from the player, and the ability to provide all of this in a friendly, graphical manner.

I have spent the day coming to understand the new minibrowser system and all it's idiosyncrocies. Once I got my head around it all I can say is that I'm impressed! The minibrowser that we use today under UTC is fully supported and minibrowser code that works under UTC will work under TRS (as far as I can tell so far). You will find yourself moving to the new minibrowser system however, as it has a lot more flexibility. Don't worry though - there's not much that has changed and there is no steep learning curve if you already understand the UTC browser.

For starters, there is a new method of creating a browser window:
Browser window1 = Constructors.NewBrowser();

But here are some nifty new features after I've called the above line of code in my script:
window1.SetWindowRect(180,180,Interface.GetDisplayWidth()-180,Interface.GetDisplayHeight()-180);
You can now set the size of the browser after getting the resolution details of the user's Trainz setup!

In UTC, I never liked the big fat grey borders, well, in TRS ...
window1.SetWindowStyle(Browser.STYLE_NO_FRAME);
I can just turn it off!!

The browser supports both HTML file loading and HTML Srings (to offer dynamic info)

So, to open a browser - FULL screen ...
Browser window1 = Constructors.NewBrowser();
window1.SetWindowRect(0,0,Interface.GetDisplayWidth(),Interface.GetDisplayHeight());
window1.SetWindowStyle(Browser.STYLE_NO_FRAME);
window1.LoadHTMLFile(filename);

But wait, there's more!

You are no longer limited to just one browser!!
Browser window2 = Constructors.NewBrowser();
window2.SetWindowRect(25,65,160,170);
window2.SetWindowStyle(Browser.STYLE_NO_FRAME);
window2.LoadHTMLString(htmlstring);

So, now I have my main browser open with information - code in the back running to interpret mouseclicks and commands. But I also have a small browser running in the top left of the screen showing a graphic via an html string.

But wait - there's more!

If you have a look at the screenshot below, you will notice that the two browser objects have no borders, but look closely at the little one on the top left ..... it supports alpha channels! It doesn't even look like a minibrowser - I can now place graphics any where on the screen and if I want, code to accept mouseclicks etc behind them.

So that's been my day today! Testing the new minibrowser and making suggestions, calling out issues with it etc. Before I leave Auran at the end of the week, I will be writing a small tutorial documenting how to use the basics of the new minibrowser so that when we get TRS we will be able to dive right in and not have to learn "by trial and error".

I'm "brain exhausted" and heading back to my hotel!!

Cheers
Greg (Shutter)

 
 


 


Shutter

 

 






Privacy Policy | Requirements
All text and images N3V Games Pty. Ltd. ABN:43-118-743-534, 2000 - 2017. All rights reserved.