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

Eddi
Tycoon
Tycoon
Posts: 8289
Joined: 17 Jan 2007 00:14

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

Post by Eddi »

that is totally unrealistic... the rich always pay less taxes :p
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

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

Post by Supercheese »

Eddi wrote:that is totally unrealistic... the rich always pay less taxes :p
OTTD money/profits/expenses are already extremely unrealistic. So why not have unrealistic taxes? :wink:
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

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

Post by MinchinWeb »

Bug: After downloading the newest version of Zuu's "TransportGoals" script, both v1 and v2 show up as available game scripts. Zuu did rename the script, but the shortname remains the same. I'm running r23655 on Windows 7x64
screenshot#1.png
screenshot#1.png (4.26 KiB) Viewed 2977 times
@TrueBrain: I keep trying to isolate the bridge NOT_REACHED bug, but I still haven't had any luck...
Update:Well, I'm getting a new error now (actually the same error, but a different line number). My test script is attached below. The libraries needed were posted in my last post.
Fullscreen capture 21122011 104437 PM.bmp.jpg
Fullscreen capture 21122011 104437 PM.bmp.jpg (40.92 KiB) Viewed 2963 times
I haven't been able to confirm it, but it seems that these errors only come up while the script is running at the end of the map generation phase, but before the game itself starts. For example, with WmDOT, I set the seed to a known value, and the game crashed (Line 67 in this case) during the script phase of map generation. If I restart the game with the same seed (so that should be the same map), but delay the GameScript to wait until map creation is finished (by use of a Sleep(1) command), the GameScript will run all the way through without crashing the game.

Bug 2:GSRoad.RemoveRoad() and GSRoad.RemoveRoadFull() don't seem to work when building as the game.
Attachments
WMTest-GS-20111220.zip
Test Script
(3.27 KiB) Downloaded 70 times
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
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

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

Post by 11Runner »

For the GSNews class:

Is it possible to implement a listener the news item when it is clicked, hovered, etc. That way, when the listener is activated, the game script could move the viewport or any other action the developer desires.

EDIT:

Since event listeners could involve creating threads, possibly a new GSEventNewsAction or similar?
Image

SynTrans - A Synaptic Networking 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.5

Post by Zuu »

When I tried to add goals to the goal window I found out that it shows the goal of all companies without including a column with the company name. Is it per design that it is up to the GS to clarify for which company that the company specific goal are for?

In TransportGoals I have explicitly included this information in my strings. However, I see that CityDomination 2 doesn't do that.

For most players it is perhaps an idea to simply hide the company specific goals of other players. Only GS developers will be interested in seeing the goals of all companies.


Another thing is that the API doesn't allow marking a goal as done, only removal of it.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
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.5

Post by Zuu »

11Runner wrote:For the GSNews class:

Is it possible to implement a listener the news item when it is clicked, hovered, etc. That way, when the listener is activated, the game script could move the viewport or any other action the developer desires.

EDIT:

Since event listeners could involve creating threads, possibly a new GSEventNewsAction or similar?
I think it would be good if the GSNews API allows passing a tile location along with the news message that is viewed if the user clicks on the news item. This way there will not be a delay between the user clicking on the news item and the Game Script reacting. Since a GS can only poll for events it can not always be instant enough to react directly on clicks.

I would also say that it is easier for the script if that data can be passed along to OpenTTD than having to store a news ID along with tile somewhere to be able to react on a news click event.
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.5

Post by TrueBrain »

Zuu wrote:When I tried to add goals to the goal window I found out that it shows the goal of all companies without including a column with the company name. Is it per design that it is up to the GS to clarify for which company that the company specific goal are for?

In TransportGoals I have explicitly included this information in my strings. However, I see that CityDomination 2 doesn't do that.

For most players it is perhaps an idea to simply hide the company specific goals of other players. Only GS developers will be interested in seeing the goals of all companies.


Another thing is that the API doesn't allow marking a goal as done, only removal of it.
Huh? The Goal GUI API has a parameter 'company'. If it is COMPANY_INVALID, it shows under 'global goals'. If you are the company, you see it under 'company goals'. If it is not for your company, you don't see it at all. And if it doesn't work like that, please let me know, as that would be a bug :)

As by documentation btw: http://nogo.openttd.org/api/trunk/class ... d61297d54f

So I don't really get what you try to say. Examples etc are much appreciated with such reports, as then I know we are talking about the same :)
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.5

Post by TrueBrain »

After some IRC time: fixed in r23665.
The only thing necessary for the triumph of evil is for good men to do nothing.
kflyer
Engineer
Engineer
Posts: 7
Joined: 13 Jun 2010 01:51

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

Post by kflyer »

TrueBrain, thanks - this is great. I'm really enthusiastic about being able to build for other companies. Are there any GSs already that make use of this function? If not, how to implement it?
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.5

Post by Zuu »

Tutorial places signs as the first company.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
11Runner
Engineer
Engineer
Posts: 92
Joined: 01 Sep 2011 19:23
Location: Oregon, USA

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

Post by 11Runner »

Is it the intention to have a maximum of 15 goals (1 goal per company)? It seems that when my script tries to create for than 15, it fails (and GSError.GetLastErrorString() is unuseful :( ).
Image

SynTrans - A Synaptic Networking AI for OpenTTD
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

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

Post by TrueBrain »

Nope. Time for you to go to http://bugs.openttd.org/ and report what you are doing :D (small scripts are best scripts)
The only thing necessary for the triumph of evil is for good men to do nothing.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

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

Post by Wasila »

Is it possible to add a script to a running game?

And yes, I won't complain when it crashes.
macee
Engineer
Engineer
Posts: 19
Joined: 20 May 2011 20:14

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

Post by macee »

Is it possible with NoGo script to place towns and industries in the Scenario Editor based on list of coordinates?
TrueBrain
OpenTTD Developer
OpenTTD Developer
Posts: 1370
Joined: 31 May 2004 09:21

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

Post by TrueBrain »

No to both.

NoGo only works on newgames, not in scenario editor
NoGo scripts can only be started with a new game, not with a running.
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.5

Post by TrueBrain »

It has been a while since I last gave NoGo a real update. Today is one of these days.

I added GSGoal.Question, where you can push a question window to a company (all clients of that company), or to call companies. The text inside can be anything you like. You can select at most 3 out of the 18 possible buttons to show. When the user clicks it, you get an event, which you can then handle.

Optionally, you can close the question on all clients, for example for timeout reasons.

Every question has an unique id, which you can control from your GS. It is possible to open many many questions at once; feel free.

Be a bit aware of the fact that in coop-network-games it is possible that you receive two replies from the same company. Filter on it if you have to. This is unavoiable.

The list of buttons:

BUTTON_CANCEL
BUTTON_OK
BUTTON_NO
BUTTON_YES
BUTTON_DECLINE
BUTTON_ACCEPT
BUTTON_IGNORE
BUTTON_RETRY
BUTTON_PREVIOUS
BUTTON_NEXT
BUTTON_STOP
BUTTON_START
BUTTON_GO
BUTTON_CONTINUE
BUTTON_RESTART
BUTTON_POSTPONE
BUTTON_SURRENDER
BUTTON_CLOSE

If you can come up with other useful texts, we can have up to 32 buttons. So we have a few to go. Let me know what you think about this, and enjoy ;)

PS: it will be in tonights nightly ;)
The only thing necessary for the triumph of evil is for good men to do nothing.
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.5

Post by Zuu »

Since there is no guarantee that you get a response when a user clicks one of the buttons, I think it would be useful to have something like GSGoal::IsQuestionOpen(uniqueId).

(also posted to FlySpray, tagged as a NoGo feature request)
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.5

Post by TrueBrain »

Just time out after a while and close the window (with CloseQuestion). Much more robust solution tbh :)

For tutorial you can just use GSWindow of course.
The only thing necessary for the triumph of evil is for good men to do nothing.
fabca2
Transport Coordinator
Transport Coordinator
Posts: 312
Joined: 14 Apr 2004 15:18
Location: Fr

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

Post by fabca2 »

Hi trueBrain,
Very nice feature, thanks.

I would like to suggest two buttons :

BUTTON_HELP
BUTTON_INFO

Regards
User avatar
MinchinWeb
Traffic Manager
Traffic Manager
Posts: 225
Joined: 01 Feb 2011 12:41
Contact:

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

Post by MinchinWeb »

Very Cool TrueBrain.

What about a button that would let you select a tile? (or at least reserve a spot of such a button and implement it later).
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
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 1 guest