IRC logs for #openttd on OFTC at 2023-03-09
            
00:02:16 *** sla_ro|master has quit IRC ()
00:57:33 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
01:13:19 *** Wormnest has joined #openttd
01:27:05 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
01:58:46 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
01:59:51 *** WormnestAndroid has joined #openttd
02:05:58 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
02:16:03 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
02:25:12 *** WormnestAndroid has joined #openttd
02:29:13 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
02:29:40 *** WormnestAndroid has joined #openttd
02:43:36 *** Wormnest has joined #openttd
03:02:13 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
03:23:45 *** D-HUND has joined #openttd
03:25:17 *** WormnestAndroid has joined #openttd
03:27:10 *** debdog has quit IRC (Ping timeout: 480 seconds)
03:27:13 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
03:28:17 *** WormnestAndroid has joined #openttd
03:36:18 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
03:36:18 *** Wormnest has quit IRC (Ping timeout: 480 seconds)
03:36:45 *** Flygon has joined #openttd
03:43:41 *** WormnestAndroid has joined #openttd
03:51:43 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
04:10:25 *** WormnestAndroid has joined #openttd
04:13:57 *** Wormnest has joined #openttd
04:21:29 *** Wormnest has quit IRC (Quit: Leaving)
04:22:33 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
04:25:24 *** WormnestAndroid has joined #openttd
04:35:08 *** D-HUND is now known as debdog
04:54:56 *** keikoz has joined #openttd
06:01:02 *** keikoz has quit IRC (Ping timeout: 480 seconds)
06:18:41 *** Flygon_ has joined #openttd
06:25:38 *** Flygon has quit IRC (Ping timeout: 480 seconds)
06:43:58 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
06:44:46 *** WormnestAndroid has joined #openttd
07:12:52 *** sla_ro|master has joined #openttd
07:44:50 <andythenorth> I probably shouldn't even by trying this....
07:45:14 <andythenorth> ...but is there an approach in squirrel to create dynamic variable names?
07:45:47 <andythenorth> e.g. `local n = 1;
07:45:47 <andythenorth> local "foo" + n = cat;`
07:46:00 <andythenorth> resulting in `foo1` as the var name
07:46:27 <andythenorth> in python it can be done with exec() but I've never found a reason this would ever be a good idea πŸ˜›
07:47:18 <andythenorth> I'm creating GS story pages in a loop
07:48:00 <andythenorth> and each page has to be assigned to a var, e.g. `local foo = GSStoryPage.NewElement(page, elementprops);`
07:48:39 <andythenorth> I don't have a way to make the resulting variables unique, because they're in `foreach() {}` loop over a list
07:50:20 <andythenorth> I mean....I can just put the elements into a table
08:10:52 <LordAro> have you tried... arrays
08:15:17 <andythenorth> that too, but then I can't reference them by name later πŸ™‚
08:15:21 <andythenorth> only by position πŸ™‚
08:15:44 <LordAro> well, a table/dict/map then
08:15:47 <andythenorth> yup
08:16:04 <LordAro> you've spent too long in newgrf land :p
08:17:59 <andythenorth> specifically too long writing code generators, where identifiers can be concatenated πŸ˜›
08:22:48 <LordAro> well, yes
08:25:17 <andythenorth> hmm I could code generate this squirrel
08:25:23 <andythenorth> it's python generated anyway πŸ˜›
08:25:33 <andythenorth> 'no'
08:29:26 <andythenorth> ok I'm constructing GSText string args wrong somehow
08:29:36 <andythenorth> `STR_GRIND_TEST :{BLACK}{STRING}: {WHITE}{STRING}`
08:29:36 <andythenorth> `local element_text = GSText(GSText.STR_GRIND_TEST, "cabbage", "foo");`
08:29:49 <andythenorth> https://cdn.discordapp.com/attachments/1008473233844097104/1083305631353684028/image.png
08:29:49 <andythenorth> renders as
08:30:01 <andythenorth> i.e, doesn't render the substrings
08:30:36 <andythenorth> maybe my parenthese are wrongly nested
08:31:13 <Rubidium> maybe RAW_STRING? Not sure whether that's a thing in GS land though
08:32:06 <andythenorth> a forum thread suggests it isn't supported
08:32:23 <andythenorth> https://www.tt-forums.net/viewtopic.php?t=87379
08:32:50 <andythenorth> I can see other scripts using {STRING} this way, it just doesn't like the strings I'm passing as args
08:32:57 <andythenorth> I think it wants a GSText instance
08:34:41 <Rubidium> maybe it got broken recently?
08:36:02 <andythenorth> hmm
08:36:45 *** HerzogDeXtEr has joined #openttd
08:37:59 <andythenorth> https://cdn.discordapp.com/attachments/1008473233844097104/1083307687309226034/image.png
08:37:59 <andythenorth> {NUM} works
08:38:40 <dP> andythenorth: it was fixed recently
08:39:05 <dP> <https://github.com/OpenTTD/OpenTTD/pull/10492>
08:40:22 <dP> https://cdn.discordapp.com/attachments/1008473233844097104/1083308286868209664/Screenshot_from_2023-03-09_12-40-00.png
08:40:22 <dP> sus 😜
08:42:14 <andythenorth> thanks
08:42:16 <andythenorth> https://cdn.discordapp.com/attachments/1008473233844097104/1083308765358592050/image.png
08:42:17 <andythenorth> works
08:42:24 <andythenorth> why RAW_STRING not STRING?
08:42:32 <andythenorth> STRING needs a text instance perhaps?
08:42:46 <dP> string refers to lang strings
08:42:55 <andythenorth> I can't find any of this documented, but there might be some AI wiki page
08:43:31 <dP> it's the same as in `english.txt`
08:43:41 <petern> STRING probably wants a string ID
08:47:20 <andythenorth> yup
08:48:10 <Rubidium> dP: well... it got broken, just "recently" on glacial time scales... like a dozen years ago ;) So any "recent" (last decade) GS that uses {STRING} and passes an actual string instead of StringID is just plain broken
08:53:42 <andythenorth> πŸ™‚
08:56:54 <andythenorth> hmm how to get the name of a squirrel function
08:57:07 <andythenorth> ::foo = functio() {}
08:57:20 <andythenorth> ach nvm
08:57:34 <petern> javascript-style squirrel?
08:57:51 <andythenorth> it seems a bit javascripty
08:57:56 <andythenorth> javasquirrel
09:02:23 <andythenorth> seems squirrel has http://squirrel-lang.org/squirreldoc/reference/language/builtin_functions.html#function.getinfos
09:03:07 <andythenorth> ach not what I need, nvm
09:03:12 <andythenorth> dir(foo) anyone? πŸ˜›
09:03:23 <andythenorth> __name__ or something
09:04:04 <LordAro> looking at the wrong squirrel version too :p
09:05:20 <andythenorth> it's easier to search πŸ˜›
09:05:26 <andythenorth> but quite a lot of it doesn't work
09:09:28 <petern> Is it home-time yet?
09:11:15 <andythenorth> Squirrel Time!
09:34:27 <petern> Setting styles with NPOI is a right pain 😦
10:14:10 *** Speedy` has joined #openttd
10:20:19 <DorpsGek> [OpenTTD/OpenTTD] J0anJosep updated pull request #8480: Feature: Extended depots https://github.com/OpenTTD/OpenTTD/pull/8480
10:20:22 <DorpsGek> [OpenTTD/OpenTTD] J0anJosep updated pull request #9577: Feature: Multi-tile depots https://github.com/OpenTTD/OpenTTD/pull/9577
10:55:38 <Xarick> I came up from hibernation and got an instant crash: The thread tried to divide an integer value by an integer divisor of zero.
10:59:54 <Xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1083343401711316992/crash20230309104322.png
10:59:54 <Xarick> could it be the framerate windows?
11:00:01 <Xarick> got to try
11:00:33 <andythenorth> lol such inevitable things πŸ™‚ https://wiki.openttd.org/en/Development/Script/Squirrel%20pitfalls#assignment-statements-that-take-long-time
11:00:42 <andythenorth> not sure how the solution solves that though
11:04:30 <Xarick> nop
11:06:17 <Xarick> how do i generate debug symbols for openttd.exe, the pdb file?
11:09:20 <Xarick> ah, found it
11:57:47 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10548: Feature: Groups cache vehicle lists https://github.com/OpenTTD/OpenTTD/pull/10548#issuecomment-1461900551
12:05:20 <andythenorth> this channel is entirely 2 people who don't really understand the script API πŸ˜›
12:05:34 <andythenorth> what happened to grf-is-the-main-topic?
12:05:35 <andythenorth> or lunch?
12:23:16 <petern> Sossij roll
12:24:19 <andythenorth> https://cdn.discordapp.com/attachments/1008473233844097104/1083364645517131916/510669011_0_640x640.png
12:24:23 <andythenorth> I really normally do better
12:24:37 <andythenorth> been awake since 2am
12:33:58 *** Arty has quit IRC (Read error: No route to host)
12:34:12 *** Artea has joined #openttd
12:36:48 *** herms has quit IRC (Quit: bye)
12:40:33 *** herms has joined #openttd
13:09:02 <glx[d]> andythenorth: There is some way
13:24:31 <Xarick> do breakdown fumes count as a vehicle?
13:26:14 <Xarick> from 36k to 45k is quite an increase
13:26:24 <Xarick> if 9k are breakdowns?
13:30:43 <Xarick> wow, it really is, i turned breakdowns off, and vehicles are down to 36k
13:31:17 <Xarick> very funny that such a thing would count as a vehicle and degrade script vehicle lists performance
13:51:17 <glx[d]> visual effects are vehicles yes
13:55:02 <glx[d]> andythenorth: Awards GS does things like ```
13:55:02 <glx[d]> local z = "STR_NEWS_";
13:55:02 <glx[d]> switch (awd.Category)
13:55:02 <glx[d]> {
13:55:02 <glx[d]> case CategoryType.MEDAL:
13:55:03 <glx[d]> z += "MEDAL";
13:55:03 <glx[d]> break;
13:55:05 <glx[d]> case CategoryType.VEHICLE:
13:55:05 <glx[d]> z += "VEHICLE";
13:55:07 <glx[d]> break;
13:55:07 <glx[d]> case CategoryType.ECONOMY:
13:55:09 <glx[d]> z += "ECONOMY";
13:55:09 <glx[d]> break;
13:55:11 <glx[d]> case CategoryType.MISC:
13:55:11 <glx[d]> z += "MISC";
13:55:13 <glx[d]> break;
13:55:13 <glx[d]> }
13:55:15 <glx[d]> local ntext = GSText(GSText.STR_NEWS, GSText(GSText[z]), company, awd.Points, GSText(GSText["STR_KEY_"+aID]));
13:56:43 <glx[d]> dynamic class const access
14:00:59 *** WormnestAndroid has quit IRC (Remote host closed the connection)
14:03:30 *** sla_ro|master has quit IRC ()
14:35:44 *** WormnestAndroid has joined #openttd
14:52:21 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
14:52:49 *** WormnestAndroid has joined #openttd
15:01:08 *** nielsm has joined #openttd
15:14:13 <Xarick> how do i profile?
15:14:28 <Xarick> how to measure gui stuff
15:16:58 <Xarick> wanted to time this <https://github.com/OpenTTD/OpenTTD/pull/10548/commits/1108777d1a34d991c86dc65904e837d108c6558b>
15:21:08 <TallTyler> Hmm, GitHub bot isn't working?
15:21:22 <TallTyler> I just commented on and merged a PR
15:21:44 <TallTyler> Also, exactly 27,000 commits! πŸ™‚
15:21:57 <TallTyler> (on GitHub anyway)
15:22:03 <DorpsGek> [OpenTTD/OpenTTD] 2TallTyler merged pull request #10555: Fix #10554: Let Scrollbar::SetPosition clamp instead of assert. https://github.com/OpenTTD/OpenTTD/pull/10555
15:22:06 <DorpsGek> [OpenTTD/OpenTTD] 2TallTyler closed issue #10554: [Crash]: Assertion failure scrolling to collapsed variant in autoreplace window https://github.com/OpenTTD/OpenTTD/issues/10554
15:22:06 <petern> Xarick: Regular smoke and spark effects are also vehicles.
15:23:49 <Xarick> ah, TICC/TOCC
15:24:36 <TrueBrain> TallTyler: so that means cake; when can we expect the delivery? πŸ˜„
15:26:38 <TallTyler> I’ll have it in the corporate office in time for the 13.1 release party πŸ˜›
15:27:07 <TrueBrain> Sweet
15:31:19 <DorpsGek> [OpenTTD/OpenTTD] 2TallTyler approved pull request #10555: Fix #10554: Let Scrollbar::SetPosition clamp instead of assert. https://github.com/OpenTTD/OpenTTD/pull/10555#pullrequestreview-1333083566
15:31:42 <petern> Huh?
15:33:11 <TallTyler> The bot is quite slow this morning, that’s from ten minutes ago…
15:33:45 <petern> The merge message already arrived though, and that was after.
15:34:40 <TallTyler> Yeah
15:35:00 <TallTyler> As well as: https://www.reddit.com/r/ProgrammerHumor/comments/11lqj09/i_helped_guys/
15:35:08 <TallTyler> πŸ˜›
15:35:37 <petern> Haha
15:36:38 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 updated pull request #10512: Doc: Add Coding Style into the repo for easier access, also add vscode into gitignore https://github.com/OpenTTD/OpenTTD/pull/10512
15:50:48 <Xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1083416606450917456/image.png
15:50:48 <Xarick> it's faster!
15:51:08 <Xarick> vehicles are being removed from "ungrouped road vehicles"
15:53:19 <Xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1083417239568523274/image.png
15:53:19 <Xarick> "Group 0" nothing happening to it, just being refreshed
15:53:48 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 updated pull request #10512: Doc: Add Coding Style into the repo for easier access, also add vscode into gitignore https://github.com/OpenTTD/OpenTTD/pull/10512
15:55:07 <Xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1083417693736153178/image.png
15:55:07 <Xarick> "All road vehicles" - nothing changing on it, just refreshing list
15:55:17 <Xarick> it's faster in all cases
15:57:03 <Xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1083418182003466351/image.png
15:57:03 <Xarick> vehicle list station:
15:59:29 <Xarick> https://cdn.discordapp.com/attachments/1008473233844097104/1083418793331675306/image.png
15:59:29 <Xarick> vehicle list depot:
16:02:52 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 commented on pull request #10512: Doc: Add Coding Style into the repo for easier access, also add vscode into gitignore https://github.com/OpenTTD/OpenTTD/pull/10512#pullrequestreview-1333175961
16:07:13 <andythenorth> petern: alberth has sent me a prototype of a python pixel particle generator....
16:07:23 <andythenorth> the output looks interesting
16:08:06 <petern> Does it work in MODE 2?
16:08:14 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 updated pull request #10512: Doc: Add Coding Style into the repo for easier access, also add vscode into gitignore https://github.com/OpenTTD/OpenTTD/pull/10512
16:11:12 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 commented on pull request #10512: Doc: Add Coding Style into the repo for easier access, also add vscode into gitignore https://github.com/OpenTTD/OpenTTD/pull/10512#issuecomment-1462329411
16:12:40 <andythenorth> petern: the one I've seen is mode 0
16:13:12 <andythenorth> https://cdn.discordapp.com/attachments/1008473233844097104/1083422246359547944/file.png
16:13:29 <andythenorth> https://cdn.discordapp.com/attachments/1008473233844097104/1083422318090534973/file.png
16:13:46 <andythenorth> discord flattens animated gifs it seems πŸ˜›
16:17:12 <PopeofMemes> lmfao
16:19:15 <Xarick> Updated comment <https://github.com/OpenTTD/OpenTTD/pull/10548#issuecomment-1461900551>
16:19:38 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 commented on pull request #10512: Doc: Add Coding Style into the repo for easier access https://github.com/OpenTTD/OpenTTD/pull/10512#issuecomment-1462350639
16:22:14 <DorpsGek> [OpenTTD/OpenTTD] 2TallTyler commented on pull request #10512: Doc: Add Coding Style into the repo for easier access https://github.com/OpenTTD/OpenTTD/pull/10512#pullrequestreview-1333209031
16:31:15 *** keikoz has joined #openttd
16:35:53 *** sla_ro|master has joined #openttd
16:38:12 *** Wormnest has joined #openttd
17:23:31 *** tokai has joined #openttd
17:23:31 *** ChanServ sets mode: +v tokai
17:27:30 <Xarick> found a worst case situation
17:27:41 <Xarick> 64k groups
17:27:46 <Xarick> and 0 vehicles
17:28:13 <Xarick> it's faster iterating vehicles than groups in this case :p
17:28:23 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 opened pull request #10559: Doc: Add Coding Style https://github.com/OpenTTD/OpenTTD/pull/10559
17:28:53 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 closed pull request #10559: Doc: Add Coding Style https://github.com/OpenTTD/OpenTTD/pull/10559
17:30:12 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
17:34:33 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10548: Feature: Groups cache vehicle lists https://github.com/OpenTTD/OpenTTD/pull/10548#issuecomment-1462475641
17:34:41 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 updated pull request #10512: Doc: Add Coding Style into the repo for easier access https://github.com/OpenTTD/OpenTTD/pull/10512
17:35:28 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 updated pull request #10512: Doc: Add Coding Style into the repo for easier access https://github.com/OpenTTD/OpenTTD/pull/10512
17:44:53 <DorpsGek> [OpenTTD/OpenTTD] Limyx826 commented on discussion #10505: Interface size problem https://github.com/OpenTTD/OpenTTD/discussions/10505
17:45:44 *** herms has quit IRC (Quit: bye)
17:47:42 *** herms has joined #openttd
18:07:20 <DorpsGek> [OpenTTD/OpenTTD] glx22 commented on pull request #10548: Feature: Groups cache vehicle lists https://github.com/OpenTTD/OpenTTD/pull/10548#issuecomment-1462535392
18:28:33 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 commented on pull request #10512: Doc: Add Coding Style into the repo for easier access https://github.com/OpenTTD/OpenTTD/pull/10512#pullrequestreview-1333492342
18:29:04 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10548: Feature: Groups cache vehicle lists https://github.com/OpenTTD/OpenTTD/pull/10548#issuecomment-1462568480
18:52:46 *** Flygon_ has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
18:54:10 *** _Artea has joined #openttd
18:56:57 *** _Artea has quit IRC (Remote host closed the connection)
18:58:40 <Xarick> Can I remove the cache check? I can't find any issue being reported from my testings <https://github.com/OpenTTD/OpenTTD/pull/10548/commits/115de9ca88f543144e4a6c952d81de01afcfe25e#diff-84e5bd1673aba7f0fbb76c27ae19a02693636d290501c5af53d144ef05a88c08>
18:59:10 <pickpacket> Started a new game. What should I call my company?
19:03:15 <debdog> OTTO
19:05:22 <pickpacket> lol
19:05:29 <pickpacket> is that an abbreviation?
19:06:00 <debdog> it could be, I suppose
19:06:27 <debdog> just popped into my head
19:06:36 <discord_user_f4a0790> pickpacket: James
19:07:09 <pickpacket> discord_user_f4a0790: after my son :)
19:08:22 <discord_user_f4a0790> ha
19:08:24 <discord_user_f4a0790> even better then
19:08:32 <discord_user_f4a0790> it was just the first name that came to mind for me
19:09:03 <debdog> My next company I dub "Trees are overrated"
19:10:04 <DorpsGek> [OpenTTD/OpenTTD] PeterN dismissed a review for pull request #10553: Change: Truncated music set song names, and music set changing. https://github.com/OpenTTD/OpenTTD/pull/10553#pullrequestreview-1331161323
19:10:07 <DorpsGek> [OpenTTD/OpenTTD] PeterN updated pull request #10553: Change: Truncated music set song names, and music set changing. https://github.com/OpenTTD/OpenTTD/pull/10553
19:22:23 <LordAro> petern: puncture :(
19:30:08 *** Wolf01 has joined #openttd
19:34:58 <petern> Oh no
19:38:54 *** Artea is now known as Arty
19:42:23 <dP> is there a good way to do smth like this in c++? <https://pastebin.com/muuyZzG0>
19:42:42 <dP> I want each function to have its own storage, like static variable but one that can be globally reset
19:43:39 <dP> best I can think of is to pass some global counter and if it doesn't match the counter for last stored value reset it
19:43:41 <DorpsGek> [OpenTTD/OpenTTD] Kuhnovic updated pull request #10543: Feature: Region-based pathfinder for ships https://github.com/OpenTTD/OpenTTD/pull/10543
19:44:11 *** Artea has joined #openttd
19:45:27 *** Arty has quit IRC (Remote host closed the connection)
19:48:08 <DorpsGek> [OpenTTD/OpenTTD] Kuhnovic commented on pull request #10543: Feature: Region-based pathfinder for ships https://github.com/OpenTTD/OpenTTD/pull/10543#issuecomment-1462677736
19:58:02 <JGR> dP: You'd probably be better off designing around your storage requirements first, rather than trying to bolt them onto functions
19:58:54 <JGR> Adding functions/methods to data works better than the other way around
20:00:37 <dP> unfortunately, I'll have to redesign the whole command structure in that case
20:02:21 <JGR> Could you not store your data in some other container, and just capture pointers or whatever into your functors then?
20:03:04 <dP> I'll need a container that can store any type
20:03:23 <dP> and I don't particularly want to list every type I add into some variant
20:04:10 <JGR> Make a base type with a virtual destructor, and subclass as necessary?
20:06:42 <dP> I think I'll try doing it with context-aware static variables fist
20:06:51 <dP> more localized solution
20:08:23 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 approved pull request #10553: Change: Truncated music set song names, and music set changing. https://github.com/OpenTTD/OpenTTD/pull/10553#pullrequestreview-1333707846
20:17:42 <audigexJon> dP: Sounds like a job for.... Javascript!
20:30:57 *** Markk has quit IRC (Ping timeout: 480 seconds)
20:33:21 <andythenorth> I had a puncture once
20:33:24 <andythenorth> a long time ago
20:34:19 <andythenorth> glx[d]: makes sense
20:34:41 <andythenorth> so to be sure I understand, there _would_ be some per industry storage
20:34:52 <andythenorth> GS has get / set commands
20:35:01 <andythenorth> grf gets a var to read it?
20:35:06 <andythenorth> grf gets a callback also to set it?
20:35:27 <DorpsGek> [OpenTTD/OpenTTD] PeterN merged pull request #10553: Change: Truncated music set song names, and music set changing. https://github.com/OpenTTD/OpenTTD/pull/10553
20:38:00 <JGR> GS is inherently asynchronous with respect to the game state
20:38:08 <glx[d]> GS do a command to pass some info to grf (like any other commands), then the command do a newgrf callback
20:38:59 *** Markk has joined #openttd
20:39:43 <glx[d]> GS might also be able to read registers, but with the typical GS delay
20:40:52 <JGR> Read operations from GS shouldn't require any additional delay
20:41:22 <andythenorth> I couldn't picture how the grf would do a callback against GS
20:41:24 <glx[d]> well read is immediate, but the data could be very old when GS reads it
20:41:38 <andythenorth> hmm
20:41:48 <andythenorth> some of these limits are pretty inherent to GS anyway
20:41:48 <JGR> andythenorth: It wouldn't, how would that make sense?
20:42:31 <andythenorth> exactly, so I'm not seeing how the grf gets information from the GS πŸ™‚
20:42:45 <andythenorth> I miss where the state can be communicated
20:42:48 <JGR> The GRF can poke information into the GRF if required
20:43:27 <andythenorth> and then that's read as a var?
20:43:29 <glx[d]> via var10 and var18
20:43:38 <glx[d]> like any callback
20:43:52 <andythenorth> there is a json spec written for this for arbitrary communication, but it might be overkill
20:44:00 <andythenorth> https://wiki.openttd.org/en/Development/Design%20Drafts/GS-NewGRF%20Communication%20via%20JSON
20:44:13 <glx[d]> reading json from grf seems crazy
20:44:44 <JGR> I can see that it would be useful to pass more than two uint32 values
20:44:48 <andythenorth> ok so the GS command triggers the grf callback, the information is stuff in vars, and the grf then does what it wants with that
20:44:57 <andythenorth> so this is like 'take a message'
20:45:09 <JGR> But you could just stuff things into more variables or temp storage if need be
20:45:18 <andythenorth> what happens if GS is suspended while the callback is running?
20:45:35 <glx[d]> GS is suspended at that point as it's a command
20:45:43 <JGR> The GS is always suspended when a callback is running
20:46:02 <andythenorth> ok so that seems like it's not a problem?
20:46:19 <JGR> Callbacks are run as part of the game, not as part of a script
20:46:33 <glx[d]> it's the only safe way for network game
20:46:44 <andythenorth> sometimes I wish discord had miro board or similar drawing tool πŸ™‚
20:46:54 <andythenorth> boxes and arrows make these things clear quickly
20:47:16 <glx[d]> remember newgrf are active on all clients while GS is only on the server
20:48:09 <andythenorth> this seems like a cleaner route than abusing industry control flags as a 3 bit side channel πŸ˜›
20:48:34 <andythenorth> or providing a var for grf to read information from industry name
20:48:37 <glx[d]> at least you get 64 bits πŸ˜‰
20:48:58 <andythenorth> "Plindhattan Coal Mine [increase_production = true || dice_roll_chance = 4]
20:49:19 <andythenorth> there are some AI libraries for storing state in vehicle names etc πŸ˜›
20:49:25 <andythenorth> found them yesterday
20:50:30 <glx[d]> using vehicle names to store some states is quite smart, with all the limitations in save/load handling
20:50:39 <andythenorth> "Retire soon"
20:50:43 <andythenorth> "My favourite vehicle"
20:51:20 <Xarick> Ru: bidium <https://github.com/OpenTTD/OpenTTD/blob/master/src/script/api/script_vehiclelist.cpp#L116-L126> I think this requires being in a valid company mode, it won't work if you're deity. There is no EnforceCompanyModeValid_Void();
20:51:27 <andythenorth> a squirrel table of metadata for every vehicle probably eats ram fast in a big game
20:51:40 <Xarick> Ru: bidium
20:51:42 <Xarick> lol
20:51:44 <Xarick> doesn't work
20:51:53 <andythenorth> someone got a nice highlight though
20:51:58 <glx[d]> of course it doesn't work
20:53:17 *** nielsm has quit IRC (Ping timeout: 480 seconds)
20:53:22 <glx[d]> Enforce checks are mainly to prevent crashes
20:54:24 <glx[d]> but yeah default group should be for company mode only
20:54:31 <Xarick> okay, i guess
20:54:58 <glx[d]> as it makes no sense to make this list as deity
20:55:50 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333722472
20:56:00 <glx[d]> and groups API is not yet availble to GS πŸ˜‰
20:56:03 <Xarick> default group really requires a company
20:56:36 <Xarick> the other one, the "Group" is fine without it
20:56:50 <glx[d]> so current master is fine, but needs work to be exposed properly to GS
20:58:04 <Rubidium> good point, just introduce EnforceCompanyModeValid_Void I reckon
20:58:31 <glx[d]> many added Enforce stuff is just future proofing
20:58:46 <glx[d]> that's why there's a script to check that
20:59:48 <glx[d]> because some stuff not yet available to GS may be at some point
21:02:48 <andythenorth> What can I do with 64 bits passed to grf? πŸ™‚
21:03:48 <JGR> I think pretty much immediately there'll be a request to be able to send more than 64 bits at once πŸ˜›
21:04:08 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333811570
21:04:34 <andythenorth> Well var 18 could be a list of temp storages to read from πŸ˜›
21:05:14 <andythenorth> What about running the callback n times, on a counter?
21:06:33 <JGR> GRFs and GSs already tend to be buggy, an interface between the two should not have built-in footguns
21:07:00 <andythenorth> These are the problems πŸ™‚
21:07:49 <andythenorth> Key/value parser on a string? πŸ˜›
21:10:26 <andythenorth> We could just test some things πŸ€ͺ
21:10:30 <JGR> As a GRF author you probably don't want to get bug reports from users that your set is broken because they used some "helpful" script from bananas
21:12:44 <JGR> Things like trying to split data across multiple sequential callbacks will most likely lead to tears
21:14:31 <glx[d]> using some bits to indicate what the other bits contains is quite common in newgrf world
21:15:31 <glx[d]> biggest issue will be the possible random delay between the callbacks
21:16:29 <glx[d]> minimum 1 tick, but can be more depending on what the GS could decide to do between the commands
21:17:29 <glx[d]> so yeah data split sounds dangerous
21:18:35 <glx[d]> unless the different data sets are independant
21:22:40 <andythenorth> let's not do that then πŸ™‚
21:23:57 <andythenorth> glx[d]: we could list all the newgrf weird ways
21:24:02 <andythenorth> bits about other bits
21:24:12 <andythenorth> nibbles from words where there rest of the word is almost unrelated
21:24:32 <andythenorth> values depending on which cycle of a callback we're in
21:25:15 <andythenorth> information held in a specific temp register, which must not be accidentally overwritten
21:25:48 <andythenorth> anyway, we could maybe test some things?
21:25:52 <andythenorth> I'll be the only user anyway
21:26:20 <glx[d]> oh and saving may happen between the calls too, so on reload you probably won't get the next batch
21:27:12 <andythenorth> so we couldn't just put things on a stack?
21:27:20 <andythenorth> I was considering if we could abuse text strings or the text stack πŸ˜›
21:27:48 <glx[d]> stop thinking with a newgrf mind πŸ˜‰
21:29:08 <andythenorth> I think this is why json was proposed
21:29:09 <andythenorth> it's clean
21:29:26 <andythenorth> does not get boat-anchored to newgrf approaches
21:30:42 <JGR> It's not necessary to overcomplicate things
21:31:26 <glx[d]> data returned by newgrf can be in registers, and they can be then copied by the command to do a sane return
21:33:50 <andythenorth> is there a single messaging callback, or separate get / set callbacks?
21:35:43 <JGR> You could do a get callback without needing to do a command
21:37:11 <JGR> So separate presumably
21:38:07 <JGR> This does imply some sort of multiplexing of things to get/set for each GRF, which could soon become a problem
21:41:18 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333856379
21:42:21 *** keikoz has quit IRC (Ping timeout: 480 seconds)
21:47:11 <andythenorth> multiplexing in this case implying?
21:50:06 <JGR> You will inevitably want to get or set more than one type of thing
21:50:46 <JGR> Different GRFs will have different things to get or set, etc
21:53:26 <andythenorth> yes
22:12:37 *** sla_ro|master has quit IRC ()
22:13:48 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333893051
22:19:56 <andythenorth> wonder if grf industry really needs to communicate to GS
22:20:08 <andythenorth> GS communicating to grf has clear cases
22:22:30 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick updated pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411
22:23:18 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333902661
22:23:35 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333902918
22:24:20 <DorpsGek> [OpenTTD/OpenTTD] SamuXarick commented on pull request #10411: Expose more functions to game scripts https://github.com/OpenTTD/OpenTTD/pull/10411#pullrequestreview-1333903658
22:28:02 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
22:30:09 *** WormnestAndroid has joined #openttd
22:31:41 *** WormnestAndroid has quit IRC (Read error: Connection reset by peer)
22:31:43 *** WormnestAndroid has joined #openttd
22:33:19 <Xarick> er rubidium caught me off guard
22:35:31 <Xarick> How would I do the combined num of engines
22:35:47 <Xarick> combined num of vehicles is easy
22:37:30 <Xarick> getting engine replacement for all group and default group is really company specific, I can't really do a combined for this
22:39:00 <Xarick> one company might replace engine a with engine b, the other might replace engine a with engine c, and the other might not even replace engine a
22:39:19 <Xarick> hmm:(
22:40:38 <Xarick> I can perhaps force being in a ValidCompany when creating a list of vehicles from the default and all group
22:42:05 <Xarick> if that makes it more consistent
23:11:24 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
23:15:09 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
23:49:56 <DorpsGek> [OpenTTD/OpenTTD] anatolyeltsov updated pull request #10541: Feature: Industry production graph https://github.com/OpenTTD/OpenTTD/pull/10541