Controlled by newgrf; newgrf spec may not change.Fanatik wrote:- GSIndustry::Close(industry)/Remove(industry)
NoGo - A Scriptable Game Framework - v1.5
Moderator: OpenTTD Developers
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: NoGo - A Scriptable Game Framework - v1.5
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
- andythenorth
- Tycoon
- Posts: 5658
- Joined: 31 Mar 2007 14:23
- Location: Lost in Music
Re: NoGo - A Scriptable Game Framework - v1.5
For industry / newgrf / NoGo interaction, I had an idea which is not feasible for NoGo as far as I can understand it. I'm posting it anyway...
- allow NoGo to handle IndustryMonthlyLoop (industry_cmd.cpp) as an event
- give it two passes over the industries, the first is to read properties / variables
- the second is to set production level variables (prod_level[0], prod_level[1]) for each industry
- the second pass appears to newgrf exactly as current production cb, unchanged, and newgrf can choose to defer to game (NoGo), or handle its own production change (no spec change)
- the first pass could possibly be exposed to newgrf, allowing newgrf to handle reporting values to NoGo
This would work for handling closure for all industry classes, and handle production for primaries that don't use production cb. Handling secondary industry production should be well out of scope for NoGo and is the domain of the newgrf.
The industry random production change could be handled identically to monthly. (I would bin the random one as pointless, but that's unlikely to happen).
- allow NoGo to handle IndustryMonthlyLoop (industry_cmd.cpp) as an event
- give it two passes over the industries, the first is to read properties / variables
- the second is to set production level variables (prod_level[0], prod_level[1]) for each industry
- the second pass appears to newgrf exactly as current production cb, unchanged, and newgrf can choose to defer to game (NoGo), or handle its own production change (no spec change)
- the first pass could possibly be exposed to newgrf, allowing newgrf to handle reporting values to NoGo
This would work for handling closure for all industry classes, and handle production for primaries that don't use production cb. Handling secondary industry production should be well out of scope for NoGo and is the domain of the newgrf.
The industry random production change could be handled identically to monthly. (I would bin the random one as pointless, but that's unlikely to happen).
FIRS Industry Replacement Set (released) | HEQS Heavy Equipment Set (trucks, industrial trams and more) (finished)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Unsinkable Sam (ships) (preview released) | CHIPS Has Improved Players' Stations (finished)
Iron Horse ((trains) (released) | Termite (tracks for Iron Horse) (released) | Busy Bee (game script) (released)
Road Hog (road vehicles and trams) (released)
Re: NoGo - A Scriptable Game Framework - v1.5
I would like a function like this: GSCompany::GetQuarterlyCargoDelivered(CompanyID company, uint32 quarter, CargoID cargo_type);
Re: NoGo - A Scriptable Game Framework - v1.5
Helo!
Sorry my bad english!
I wrote this code:
and the cargoLabel is always PASS.
Why?
Sorry my bad english!
I wrote this code:
Code: Select all
local cargoList = GSCargoList();
for (local i = 0; i < cargoList.Count(); i++) {
local currentCargoType = cargoList[i];
local cargoLabel = GSCargo.GetCargoLabel(currentCargoType);
GSNews.Create(GSNews.NT_GENERAL, "cargo " + i + ": " + cargoLabel + "!", GSCompany.COMPANY_INVALID);
}
Why?
Last edited by idioty on 29 Apr 2012 14:44, edited 1 time in total.
Sorry my bad english, I don't speak english!
Re: NoGo - A Scriptable Game Framework - v1.5
I see no Log calls in your code. Please provide that as well so we know where you are inspecting the value.
Also, generally it is not a good idea to rely on the cargo labels. They are mostly there for debug purposes.
Also, generally it is not a good idea to rely on the cargo labels. They are mostly there for debug purposes.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: NoGo - A Scriptable Game Framework - v1.5
I edited my code!
I want get the cargo name. I want to show in News this name...
I want get the cargo name. I want to show in News this name...
Sorry my bad english, I don't speak english!
Re: NoGo - A Scriptable Game Framework - v1.5
Hi there - not 100% sure that this is the place to be asking, but is there an easy way to concatenate GSText items, such that you can use more than one with, say, GSTown.SetText?
Concatenation of normal strings is fine, but that doesn't let you use colour tags, and adding a string to a GSText object just ends up giving the object instance name as a string. I see that it can be done in a roundabout way by setting a parameter of the GSText to a string and putting another one in, but this can be quite a pain for variable numbers of objects (I was using it to list the neighbouring towns in the NAI script, and have had to resort to 3 strings for 1, 2 or 3 neighbours so far.)
Also, is there a way to make a town want other specific cargoes, be it by setting more specific goals or adding to the existing list? I already messed around with the different demand types since FIRS returns goods as petrol and water as goods in-game, and would like to expand the demands at higher population levels to include things like building materials and alcohol. From what I've seen so far this can't really be done at the moment.
On that note, is there a way to detect if a specific newGrf is in operation? That way the cargo type corrections for things like FIRS can be automatic, and wouldn't throw a hissy-fit when it isn't loaded.
Concatenation of normal strings is fine, but that doesn't let you use colour tags, and adding a string to a GSText object just ends up giving the object instance name as a string. I see that it can be done in a roundabout way by setting a parameter of the GSText to a string and putting another one in, but this can be quite a pain for variable numbers of objects (I was using it to list the neighbouring towns in the NAI script, and have had to resort to 3 strings for 1, 2 or 3 neighbours so far.)
Also, is there a way to make a town want other specific cargoes, be it by setting more specific goals or adding to the existing list? I already messed around with the different demand types since FIRS returns goods as petrol and water as goods in-game, and would like to expand the demands at higher population levels to include things like building materials and alcohol. From what I've seen so far this can't really be done at the moment.
On that note, is there a way to detect if a specific newGrf is in operation? That way the cargo type corrections for things like FIRS can be automatic, and wouldn't throw a hissy-fit when it isn't loaded.
Re: NoGo - A Scriptable Game Framework - v1.5
Currently there is no method to specify demands for cargos which have no town effect. We considered adding support for that, but so far there is no working concept for it.
There is no way for a script to detect specific NewGRFs, nor will there ever be a method for it. But you can check the availability of specific cargotypes. So, if you have special behaviour for alcohol, you can check for the presence of the cargo "BEER". That way your script will work with any NewGRF which provides this cargo, no matter whether it is FIRS or something else.
References:
GSCargo.GetCargoLabel(): http://nogo.openttd.org/api/1.2.0/class ... 1b4ff5478a
Cargo labels of all defined cargo so far: http://newgrf-specs.tt-wiki.net/wiki/CargoTypes
There is no way for a script to detect specific NewGRFs, nor will there ever be a method for it. But you can check the availability of specific cargotypes. So, if you have special behaviour for alcohol, you can check for the presence of the cargo "BEER". That way your script will work with any NewGRF which provides this cargo, no matter whether it is FIRS or something else.
References:
GSCargo.GetCargoLabel(): http://nogo.openttd.org/api/1.2.0/class ... 1b4ff5478a
Cargo labels of all defined cargo so far: http://newgrf-specs.tt-wiki.net/wiki/CargoTypes
⢇⡸⢸⠢⡇⡇⢎⡁⢎⡱⢸⡱⢸⣭⠀⢸⢜⢸⢸⣀⢸⣀⢸⣭⢸⡱⠀⢰⠭⡆⣫⠰⣉⢸⢸⠀⢰⠭⡆⡯⡆⢹⠁⠀⢐⠰⡁
Re: NoGo - A Scriptable Game Framework - v1.5
Ah! Yes, checking the cargo types does make more sense - thanks for pointing that one out. Shame about the cargo demands thing too.
However, I'm still at a loss over how to concatenate GSText objects - adding them results in it saying the operation is undefined, and I detailed the other outcomes in my last post.
However, I'm still at a loss over how to concatenate GSText objects - adding them results in it saying the operation is undefined, and I detailed the other outcomes in my last post.
Re: NoGo - A Scriptable Game Framework - v1.5
note, that the GUI has a limitation where it only lists the first cargo for a given towneffect, so even though Petrol, Alcohol and Building Materials all have TE_GOODS, the GUI will only say "Requires Petrol", while it actually counts all three.
Re: NoGo - A Scriptable Game Framework - v1.5
Does that mean that any of the items can fulfill the condition? I'm sure it doesn't mean that a town needs all of them, since towns will grow without building materials.
However, why does water return goods in that case? In FIRS tests the goods delivered don't fulfill the goods category (appearing as petrol on the ui).
However, why does water return goods in that case? In FIRS tests the goods delivered don't fulfill the goods category (appearing as petrol on the ui).
Re: NoGo - A Scriptable Game Framework - v1.5
yes, it is "any of these", not "all of these".
Goods appear in the TE_WATER category because FIRS redefines it as such. this was done because you need at least one cargo in this category for desert towns, and FIRS has no space for actual water.
Goods appear in the TE_WATER category because FIRS redefines it as such. this was done because you need at least one cargo in this category for desert towns, and FIRS has no space for actual water.
Re: NoGo - A Scriptable Game Framework - v1.5
Ah, that makes things much clearer. Thanks for all the info!
Re: NoGo - A Scriptable Game Framework - v1.5
Perhaps it's a bit late to ask, but can the scripts instead of being interpreted be turned into decision trees (like happens with newgrfs) so the scripts don't need to be interpreted each time?
The reason I'm asking this is because I tend to play on large maps together with a friend and we tend to fill the map up with HUGE cities and lots of wonderful trains.
A while ago we tried with some scripts and the performance hit made the game unplayable on an older machine.
The reason I'm asking this is because I tend to play on large maps together with a friend and we tend to fill the map up with HUGE cities and lots of wonderful trains.
A while ago we tried with some scripts and the performance hit made the game unplayable on an older machine.
Re: NoGo - A Scriptable Game Framework - v1.5
Sorry for Necroing this thread, but I just want to congratulate TrueBrain on writing this and having it added to trunk. Great work!
It's been a long time since I first wrote the Openttd Challenge Spinoff, but finally there's the option of having goal gameplay with the basic game. hurrah!
I'll have to see if the features list tickles my brain to write a game script
It's been a long time since I first wrote the Openttd Challenge Spinoff, but finally there's the option of having goal gameplay with the basic game. hurrah!
I'll have to see if the features list tickles my brain to write a game script
Creator of the Openttd Challenge Spinoff, Town Demand patch
After action reports: The path to riches, A dream of skyscrapers
After action reports: The path to riches, A dream of skyscrapers
Re: NoGo - A Scriptable Game Framework - v1.5
I have great memories of your Challenge Spinoff. I would love to see a revival.Korenn wrote:Sorry for Necroing this thread, but I just want to congratulate TrueBrain on writing this and having it added to trunk. Great work!
It's been a long time since I first wrote the Openttd Challenge Spinoff, but finally there's the option of having goal gameplay with the basic game. hurrah!
I'll have to see if the features list tickles my brain to write a game script
Re: NoGo - A Scriptable Game Framework - v1.5
in the GSTile.IsDesertTile(GSTown.GetLocation(TownID)) the check always returns "false" even when the town is clearly on the desert. Looks like the IsDeserTile function only returns true if the tile is empty (i.e. has no buildings, roads or anything else on it). Is this an intended behavior, and if so, can a function be added to GSTown object to check if the town is in the desert?
Re: NoGo - A Scriptable Game Framework - v1.5
This problem have been reported earlier. It has just not been solved because noone have prioritized this over other things that they wanted to do more.
I think there should be a task at bugs.openttd.org about this issue. If not, you could add it there as a reminder.
I think there should be a task at bugs.openttd.org about this issue. If not, you could add it there as a reminder.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Junctioneer (a traffic intersection simulator)
Re: NoGo - A Scriptable Game Framework - v1.5
Didn't find it in the bug tracker, but maybe I wasn't searching properly.
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: NoGo - A Scriptable Game Framework - v1.5
Zuu wrote:This problem have been reported earlier. It has just not been solved because noone have prioritized this over other things that they wanted to do more.
I think there should be a task at bugs.openttd.org about this issue. If not, you could add it there as a reminder.
Maybe read again Zuu's posting. It offers conclusive hints on how and where to find it.aantono wrote:Didn't find it in the bug tracker, but maybe I wasn't searching properly.
EDIT: If it's not in the bug tracker, you might want to open an issue about it - if it's there, someone will find it and merge or link the topics.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
Who is online
Users browsing this forum: No registered users and 23 guests