NoGo - A Scriptable Game Framework - v1.5

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v0.3

Post by TrueBrain »

Meh; I feel bad. I forgot to change 1 single line. Sorry :)

Going to update to latest trunk too, which sadly means that the new version will not be compatible with the current savegames made with NoGo (and also the reason the version is now 1.0).

New version is cooking. Only change: fixed import()
The only thing necessary for the triumph of evil is for good men to do nothing.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.0

Post by TrueBrain »

And today a new version. I spend most of the day refactoring widget code so we can now have ... pampampam ...

Changelog v1.1:
- You can now highlight all widgets that are ingame named. With naming it means it has an enum value, and it means it has some code that reacts on its clicking (well, mostly). Basically: all buttons in the game. There cannot be a button with a function without an enum value (well, sortof anyway), so you should be able to highlight everything. Curious how big the list is: http://devs.openttd.org/~truebrain/nogo ... indow.html

One technical problem: atm you can have a WindowClass that is shared with different windows. You cannot detect if for example the road toolbar is open, or the rail toolbar. That also means you are not sure if the widget you want the highlight is the right one, as the enums overlap. This will be fixed in future additions, but this should hopefully be enough to get you going :)

This basically means you can now official write the tutorial. One upcoming addition will be a window that can popup, with specific instruction. Mostly aimed for the tutorial, so you can welcome the player etc etc, but I am sure you can find other uses for that too (MOTD, Server rules, ...).

After that, my list is empty. I will then spend some time cleaning up things, re-reading, double-checking, and basically preparing it for inclusion. No guarantees that it happens, but I am at least going to prepare for it.

Build should be done in a few, like always.

Bugs, problems or things that really have to be added, now is the time to let me know.

PS: this doesn't mean: come up with your wildest idea; keep suggestions at this point things that really have to be added, that are really needed, for you to build a nice basic GameScript.
The only thing necessary for the triumph of evil is for good men to do nothing.
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

Re: NoGo - A Scriptable Game Framework - v1.1

Post by MinchinWeb »

Libraries work! Yeah! :D

Thanks for all the work you're done on this TrueBrain.

A couple of ideas for the framework:
  • - debugging break for game scripts. Right now, if you're debugging an AI, there's a text box you can set it to break the AI if a certain text appears in the debug screen (bottom of the AI debug console, assuming you have AI developer tools on). It would be nice if that worked for gamescripts too. I'm not sure how to implement it though...I'm pretty sure the AI version just pauses the game, which doesn't stop a gamescript...
  • - error message on crash. Right now, if a gamescript fails, it does so silently, and so you don't know it's crashed unless you go looking for it. If an AI crashes, an error message shows up alerting the player. My concern is that we (as gamescript creators) won't get any bug reports and so won't be able to fix things if they break.
  • - a way to ask the player a yes/no question. Maybe this should be an extension of your popup window.
  • - is there a way to check directly if a company with a given index exists?
Alberta Town Names - 1500+ real names from 'Acme' to 'Zama City'
MinchinWeb's Random Town Name Generator - providing 2 million plus names...
WmDOT v13 - An AI that doubles as your highway department
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Kogut »

Is it possible to add function to highlight tile? And get location of main viewport (top-left and bottom-right tiles)?
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Zuu »

Kogut wrote:And get location of main viewport (top-left and bottom-right tiles)?
That would require the GS to have access to the client list and not just the company list.


Speaking of MP, it could be useful to have a API function to tell if the GS run in a single player or multi player game.


Edit: Another feature that I think has been discussed, but not implemented is to bind a GS to a specific scenario.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Kogut »

Zuu wrote:Speaking of MP, it could be useful to have a API function to tell if the GS run in a single player or multi player game.
Done! ( http://devs.openttd.org/~truebrain/nogo ... cd69aca0b2 )
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

MinchinWeb wrote:(..)
  • - is there a way to check directly if a company with a given index exists?
ScriptCompany::ResolveCompany. Has been there since day 1, even for AIs :D
Zuu wrote:(..)
Speaking of MP, it could be useful to have a API function to tell if the GS run in a single player or multi player game.
Already done (a while ago)
Zuu wrote:(..)
Edit: Another feature that I think has been discussed, but not implemented is to bind a GS to a specific scenario.
A scenario saved with a GS, will always open that GS (when available). So that is implemented. Same goes for savegames. The only thing 'missing' what I can see, is that you can load the scenario even without the GS. But I am not sure if we want to fix that :D I might add a warning that you just loaded a scenario/savegame of which the GS was not available.
The only thing necessary for the triumph of evil is for good men to do nothing.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Kogut »

TrueBrain wrote:
Zuu wrote:(..)
Edit: Another feature that I think has been discussed, but not implemented is to bind a GS to a specific scenario.
A scenario saved with a GS, will always open that GS (when available). So that is implemented. Same goes for savegames. The only thing 'missing' what I can see, is that you can load the scenario even without the GS. But I am not sure if we want to fix that :D I might add a warning that you just loaded a scenario/savegame of which the GS was not available.
I think that Zuu wants to protect GS from running in scenario other than original (it is easier to make tutorial on tutorial map rather that tutorial working on the arbitrary map)
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Zuu »

Kogut wrote:
TrueBrain wrote:
Zuu wrote:(..)
Edit: Another feature that I think has been discussed, but not implemented is to bind a GS to a specific scenario.
A scenario saved with a GS, will always open that GS (when available). So that is implemented. Same goes for savegames. The only thing 'missing' what I can see, is that you can load the scenario even without the GS. But I am not sure if we want to fix that :D I might add a warning that you just loaded a scenario/savegame of which the GS was not available.
I think that Zuu wants to protect GS from running in scenario other than original (it is easier to make tutorial on tutorial map rather that tutorial working on the arbitrary map)
Perhaps a function in GSInfo to tell if the GS should show up for new games or not. (you could set this to false just before uploading it to bananas) Perhaps along with a banans-flag to not display it in the list, but only offer as dependancy?
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

Sounds like a good idea :) I see what you want to go with that, so yeah, will make it happen :)
The only thing necessary for the triumph of evil is for good men to do nothing.
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

Re: NoGo - A Scriptable Game Framework - v1.1

Post by TrueBrain »

Just a heads-up: we decided to massively rename how widgets are named. This part just got into trunk, and will be in NoGo in 1.2. So don't use the highlight stuff a lot yet, you will have to rename a lot ;) Expect 1.2 tonight or tomorrow, depending when I get this new setting done ;)
The only thing necessary for the triumph of evil is for good men to do nothing.
Eddi
Tycoon
Tycoon
Posts: 8282
Joined: 17 Jan 2007 00:14

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Eddi »

if you add a window with yes/no question, it might be useful to keep that expandable. like "welcome to tutorial. pick a vehicle type that you want to learn: {road|rail|air|ship}"
fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

Re: NoGo - A Scriptable Game Framework - v1.1

Post by fabca2 »

Also, to have a tutorial window, where developer can add control (like a button) for example skip a part of tutorial.
A kind of dynamic objet/widgets (window, button, text, listbox...) that can trigger event (button)
hum, maybe a little too complex ? just an idea ?
Torrasque
Engineer
Engineer
Posts: 94
Joined: 19 Aug 2004 13:33
Contact:

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Torrasque »

That's great work!

There are a few things I couldn't do:

Code: Select all

GSIndustry.GetLastMonthTransportedPercentage( industry, cargo )[code]
A similar function, but where we could specify a company would be cool. ( To know which company transported the most cargos )

Also, an api for money transfert ( perhaps in GSAccounting or GSCompany ) from/to a player or from/to the "void" would be cool.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Zuu »

Torrasque wrote:

Code: Select all

GSIndustry.GetLastMonthTransportedPercentage( industry, cargo )
A similar function, but where we could specify a company would be cool. ( To know which company transported the most cargos )
Have you tried

Code: Select all

local transport = null;
{
   local dummy = GSCompanyMode(1);
   transport = GSIndustry.GetLastMonthTransportedPercentage( industry, cargo )
}
This should get the transport percentage of the company with index 1 and store it in the variable "transport". The curly brackets are there to limit the scope of the CompanyMode so that your usual company is restored at the end.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Torrasque
Engineer
Engineer
Posts: 94
Joined: 19 Aug 2004 13:33
Contact:

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Torrasque »

Zuu wrote:
Have you tried

Code: Select all

local transport = null;
{
   local dummy = GSCompanyMode(1);
   transport = GSIndustry.GetLastMonthTransportedPercentage( industry, cargo )
}
This should get the transport percentage of the company with index 1 and store it in the variable "transport". The curly brackets are there to limit the scope of the CompanyMode so that your usual company is restored at the end.
I didn't thought about it, but I don't think it works. This:

Code: Select all

local transport = null;
{
   local dummy = GSCompanyMode(1);
   transport = GSIndustry.GetLastMonthTransportedPercentage( industry, cargo )
   GSLog.Info("Industry 1 :"+transport);
}
{
   local dummy = GSCompanyMode(2);
   transport = GSIndustry.GetLastMonthTransportedPercentage( industry, cargo )
   GSLog.Info("Industry 2 :"+transport);
}
Print the same value for both company.

How do we know which function are affected by GSCompanyMode?
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Zuu »

Does your game have 3 companies? (mind that in-game company index start at 0, while in the GUI it starts at 1)
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Torrasque
Engineer
Engineer
Posts: 94
Joined: 19 Aug 2004 13:33
Contact:

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Torrasque »

Zuu wrote:Does your game have 3 companies? (mind that in-game company index start at 0, while in the GUI it starts at 1)
Yes, there is my company and three AI.
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Zuu »

Have you placed a sign on the industry using GSIndustry.GetLocation() and prited the cargo label to GSLog to make sure these are correct?

Edit: could you perhaps provide a minimal example GS to reproduce this. I guess TrueBrain will have use for that in order to reproduce the bug.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: NoGo - A Scriptable Game Framework - v1.1

Post by Kogut »

Probably it is not a bug as AIIndustry::GetLastMonthTransported and value visible for humans in industry details window is single variable for industry, without separate data for companies.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 4 guests