Page 13 of 17

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

Posted: 21 Dec 2011 23:20
by Eddi
that is totally unrealistic... the rich always pay less taxes :p

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

Posted: 21 Dec 2011 23:21
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:

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

Posted: 22 Dec 2011 01:43
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 3314 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 3300 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.

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

Posted: 23 Dec 2011 02:40
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?

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

Posted: 23 Dec 2011 21:24
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.

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

Posted: 23 Dec 2011 22:06
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.

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

Posted: 23 Dec 2011 23:15
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 :)

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

Posted: 23 Dec 2011 23:34
by TrueBrain
After some IRC time: fixed in r23665.

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

Posted: 26 Dec 2011 10:15
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?

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

Posted: 26 Dec 2011 15:07
by Zuu
Tutorial places signs as the first company.

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

Posted: 30 Dec 2011 01:19
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 :( ).

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

Posted: 30 Dec 2011 10:44
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)

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

Posted: 30 Dec 2011 12:31
by Wasila
Is it possible to add a script to a running game?

And yes, I won't complain when it crashes.

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

Posted: 30 Dec 2011 12:58
by macee
Is it possible with NoGo script to place towns and industries in the Scenario Editor based on list of coordinates?

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

Posted: 30 Dec 2011 13:09
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.

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

Posted: 03 Jan 2012 16:40
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 ;)

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

Posted: 03 Jan 2012 20:23
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)

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

Posted: 03 Jan 2012 20:26
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.

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

Posted: 04 Jan 2012 06:38
by fabca2
Hi trueBrain,
Very nice feature, thanks.

I would like to suggest two buttons :

BUTTON_HELP
BUTTON_INFO

Regards

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

Posted: 04 Jan 2012 21:22
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).