Page 1 of 1

My index finger hurts

Posted: 13 Sep 2013 15:53
by Lemike
Hello

First of all, thanks a lot for developing this game, it reaches quite some level of awesomeness. I did play it for quite some time and it never crashed or lost any save games, well done guys!

Back to topic, I'm having a rather small game with only around 350 electric trains which have in average 7 waggons each. I wanted to convert those to MagLev, so I sent all of them to the depot.
If I had to buy the replacement trains by hand I had to click two times for the engine, n+1 times for the wagons, one time to copy orders and one time to send out the finished train so the next one gets the waggons attached automatically. That would sum up to 4200 clicks for my tiny little network even without counting the addional clicks for building and connecting the new depots.

Questions:
Is there a way to do such an operation without the acute danger of a tenosynovitis?
Since I didn't find any of those actions (buy engine/waggons, copy orders without clicking) in the hotkeys.cfg, is there a way to add hotkeys to existing buttons? This would help also for setting up orders, I have to click to open the "orders" window.
In general, is there a scripting interface(like in Lua or Python, I'm afraid of pointers :wink: ) so one could write his own macros to speed up such repetitive things and populate the overview lists with more information?

Regards Lemike

Re: My index finger hurts

Posted: 13 Sep 2013 16:06
by planetmaker
Does vehicle cloning help you?
Do shared orders help you?
Does group management help you?
http://wiki.openttd.org/Hidden_features
http://wiki.openttd.org/Shared_orders#Shared_orders

You could also look at using the 'universal railtype' and then use autoreplace even.

Re: My index finger hurts

Posted: 13 Sep 2013 17:23
by Lemike
Thanks for the quick response, I appreciate it :)
planetmaker wrote:Does vehicle cloning help you?
Yes, I love that function, especially with ctrl so it also takes the shared orders as well. On my current problem replacing with MagLev trains it doesn't really help since the trains are spread across multiple random depots. I put all the ore trains in one group, not a group for each station.
planetmaker wrote:Do shared orders help you?
It certainly does, especially when I move(didn't find a move function so I had to delete it and build a new one) a waypoint or station.
planetmaker wrote:Does group management help you?
It helps to replace engines but I'm missing some more columns there i.e. a column for each destination, also the ability to sort those like first sort by 2nd column, then 3rd as we know it from LibreOffice.
I'm going to write those in the suggestion section on the forum. Shall I necro a similar thread or make a new one?
planetmaker wrote:You could also look at using the 'universal railtype' and then use autoreplace even.
I guess need an "Addon" for that. But this universal rail feature woudn't be available on online games, right?
If that's the case I'm going to make a suggestion post to make all the depots universal so we only had to replace the tracks in future.

Regards Lemike

Re: My index finger hurts

Posted: 13 Sep 2013 18:11
by ChillCore
Lemike wrote: Since I didn't find any of those actions (buy engine/waggons, copy orders without clicking) in the hotkeys.cfg, is there a way to add hotkeys to existing buttons?
Yes, by modifying the source and linking default keys to the commands hidden behind the buttons that trigger the specified behaviour.
In general, is there a scripting interface(like in Lua or Python, I'm afraid of pointers :wink: ) so one could write his own macros to speed up such repetitive things and populate the overview lists with more information?
you could link multiple actions in the same command I think, never tried it but I do not see why not.
There is squirrel for writing AIs and Scripts; NML can be used to write NewGRF, but those can not be used for adding hotkeys to the base game.
OpenTTD is written in C++.
If you can compile yourself you could have a look at the source and pretty much copypaste code from other hotkeys.
Shall I necro a similar thread or make a new one?
Necro is fine if you stay on topic and have something new to add, otherwise a new thread is prefered.
I guess need an "Addon" for that. But this universal rail feature woudn't be available on online games, right?
Clients can not join servers if the NewGRF do not match exactly so that problem is already being taken care of.
You can either start your own server with the NewGRF you desire or join one that has the ones you want.
Note that when a server uses Bananas content only you will be given the option to download the missing ones ingame, read: if you start the server with that content only you do not have to make sure that the people joining you have the missing content. (this option includes content that is in the meantime replaced with new content and can no longer be seen from the normal ingame download window.

ps:
We call addons NewGRF here with stands for New Graphics Replacement File; although the name never changed they can do much more then that by now.

Re: My index finger hurts

Posted: 13 Sep 2013 18:18
by planetmaker
ChillCore wrote:We call addons NewGRF here with stands for New Graphics Replacement File; although the name never changed they can do much more then that by now.
NewGRF = New Game Resource File ;-)

Re: My index finger hurts

Posted: 13 Sep 2013 19:02
by ChillCore
planetmaker wrote:
ChillCore wrote: We call addons NewGRF here with stands for New Graphics Replacement File; although the name never changed they can do much more then that by now.
NewGRF = New Game Resource File ;-)
We do do we?
Thank you for correcting me. ;)

Re: My index finger hurts

Posted: 13 Sep 2013 19:22
by Lemike
Thanks for that very usefull informations, I guess I have to dip my toe a bit into C++ and Squirrel ;)

Have a nice day

Lemike

Re: My index finger hurts

Posted: 13 Sep 2013 20:23
by 3298
ChillCore wrote:you could link multiple actions in the same command I think, never tried it but I do not see why not.
If your "command" is a hotkey, then no, not in trunk. I wrote a patch for that, though. It is on the bug tracker, it never got any comments there, only an earlier version in my transparency patch thread got some coding style comments. Currently it needs a tiny bit of manual merging, but anyone with a little bit of C++ experience should be able to fix that.

Back on topic: My own solution for railtype switching would be to build one train for each order list, copy its orders from a train of the old railtype, then CTRL+clone it from the vehicle window. Then I take the depot window and click on the small red symbol in front of the first train, wait until the train has left the depot, click without moving the mouse to release the next train, and so on. Total clicks (for a set of trains with shared orders): as many clicks as required to build one train, plus two clicks per additional train sharing the order list.
The timetables need an adjustment anyway because the trains on the new railtype are usually faster than the previous ones, but that's a task for later.

Re: My index finger hurts

Posted: 14 Sep 2013 10:29
by ChillCore
Lemike did ask for a way to write macros. ;)

I do not want to confuse Lemike too much, neither do I want to take away the pleasure of the mental exercise ...

Anyway in short,
With comand I meant the console-command that is called when pressing the hotkey.
You can indeed not chain console-commands in the same place as where the hotkey behaviour is specified.
Simply replacing this 'command-call 'with a proper function call will do the trick.

I have done so in a patch that is not yet released nor did I talk about it besides hinting to it, too soon too early for the kind of revolution I am planning. ;)

Can you please provide a link to the flyspray entry?
Just curious what our approach is exactly. ;)

Re: My index finger hurts

Posted: 14 Sep 2013 10:50
by Alberth
Macros to assist the player in doing things for him will quickly tilt the playing field at competitive MP games.

It would become easy to automate advertising, buy new engines every two years, lay complicated junctions, etc etc etc.
As such, it would stop being a game of playing skill, and instead a game of being able to copy macros.

If you want to automate play, write an AI.

Re: My index finger hurts

Posted: 14 Sep 2013 10:55
by Eddi
Note that, when the squirrel interface was introduced for AIs, the ability to have a script to aid the human player was deliberately disabled, for the reasons that Alberth said. (and it would only need a few small changes to allow. it was, however, never specified which changes they are)

Re: My index finger hurts

Posted: 14 Sep 2013 11:05
by ChillCore
Ah yes ... the cheaty bit ... forgot about that for a sec.

My patch I refered to does nothing of that kind, it is not used in gameplay at all and would need to be comited too before becoming usable at all. ;)

Re: My index finger hurts

Posted: 14 Sep 2013 13:38
by 3298
ChillCore wrote:Can you please provide a link to the flyspray entry?
Just curious what our approach is exactly. ;)
Sure, it's this one.
Its only purpose is to allow a user to launch multiple hotkey actions with a single keypress. No new hotkeys are defined, no defaults are changed. Thinking about it, the latter is an issue because there are some sets of hotkey actions on the same key in trunk that don't really belong together: D skips an order in the order window, and GLOBAL+D activates the dynamite in the landscaping toolbar; F deletes an order, focuses the sign list filter box and it also does break_string in the AI/GS debug window (don't know what that does, I'm not an AI/GS developer), the number keys activate building tools in the various infrastructure toolbars and switch to AI companies in the debug window; C does match_case in the debug window and centers the viewport on the cursor; RETURN continues a paused AI/GS and opens the chat.
If you are interested in the discussion about the patch, read this post and the three posts after that.

That patch does assist the player a bit, but because there are no new hotkeys I don't consider it a cheating tool. It can only do some simple things like hiding houses when pressing the hotkey for the bus station. It wouldn't be of much help when converting trains to a new railtype unless someone adds new hotkeys to OpenTTD.

Re: My index finger hurts

Posted: 14 Sep 2013 17:15
by Lemike
Thanks for those answers.

I guess the best solution to the too-many-clicks-required problem will be the modification of the game itself to add more hotkeys. In the other hand, I think adding an ingame menu for customizing woudn't be the worst idea since any game I can think of has such a thing. Also adding the hotkey to the tooltip woudn't be the worst idea. Don't excpect too much that soon since I'm a novice in coding and I only know a few things about C++. If you want me to I'll start with the graphics of the menu first.

Regards Lemike

Re: My index finger hurts

Posted: 15 Sep 2013 07:48
by Zuu
3298 wrote:it also does break_string in the AI/GS debug window (don't know what that does, I'm not an AI/GS developer)
The f-key does focus the edit box for pausing a script when a log message matches a filter string in AI/GS debug window. However, only if that window is open and only if you have the gui.ai_developer_tools setting enabled. The same goes for several other of the AI/GS hotkeys that you have mentioned.

Re: My index finger hurts

Posted: 15 Sep 2013 09:32
by 3298
Zuu wrote:only if that window is open
Yes, of course, just like with all the other non-global hotkeys.
Zuu wrote:and only if you have the gui.ai_developer_tools setting enabled. The same goes for several other of the AI/GS hotkeys that you have mentioned.
That makes these a lower priority, but the fact that these conflicts exist at all is an issue. The hotkey conflicts a normal user would encounter are D and F - there is even a bugtracker entryabout D. Anyway, I just wanted to give a complete list of conflicting hotkeys. (Note to myself: Copy that list to my entry on the bugtracker so it doesn't get lost in an unrelated forum thread.)

buttons [ ] \ ' ; / .

Posted: 15 Oct 2014 00:04
by DNK
Having a real great wish to adjust those keys mentioned.
They are not present in hotkeys.cpp
The question: is there a possibility to use those keys in game.
Not being coder, but wish to try this key setup ^so much^, that can try to do some scripting work by myself, if only you tell me it have some chances to be realised in general.
(due to hotkeys.cpp I can see - there are standart rules for the letters and special keys like del, backquote etc directing to what the key should answer but not sure I understand the whole idea of how it works).
One more thing: those marvelous ctrl+clicking functions, can be changed to (for example) alt+click?
Thanks in advance.