IRC logs for #openttd on OFTC at 2021-08-10
            
00:16:51 *** gnu_jj has joined #openttd
00:48:15 *** WormnestAndroid has quit IRC (Remote host closed the connection)
00:49:48 *** WormnestAndroid has joined #openttd
00:58:27 *** WormnestAndroid has quit IRC (Remote host closed the connection)
01:00:53 *** WormnestAndroid has joined #openttd
01:34:39 *** Strom has quit IRC ()
01:36:20 *** Strom has joined #openttd
02:02:04 *** Flygon has joined #openttd
02:07:15 *** Wormnest has quit IRC (Quit: Leaving)
02:58:24 *** D-HUND has joined #openttd
03:01:46 *** debdog has quit IRC (Ping timeout: 480 seconds)
03:04:29 *** glx has quit IRC ()
05:10:26 *** y2kboy23 has quit IRC (Quit: ZNC - https://znc.in)
05:11:39 *** y2kboy23 has joined #openttd
05:16:29 *** y2kboy23 has quit IRC ()
05:17:06 *** y2kboy23 has joined #openttd
05:50:02 *** nielsm has joined #openttd
06:07:12 *** tokai|noir has joined #openttd
06:07:12 *** ChanServ sets mode: +v tokai|noir
06:14:11 *** tokai has quit IRC (Ping timeout: 480 seconds)
06:22:01 *** sla_ro|master has joined #openttd
07:03:28 *** sla_ro|master has quit IRC ()
07:29:19 *** virtualrandomnumber has joined #openttd
08:44:28 *** andythenorth has joined #openttd
08:53:29 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
08:57:43 <andythenorth> yo
09:07:56 <peter1138> no
09:08:43 *** Wolf01 has joined #openttd
09:25:23 <andythenorth> lo?
09:25:36 <LordAro> fo
09:25:54 <peter1138> go
09:26:36 <andythenorth> GS is weird, there's no src dir
09:26:54 <andythenorth> so all the actual GS .nut files are mixed in with the red tape (changelog, install.sh) etc
09:27:24 <andythenorth> maybe I can unweird it
09:27:39 <peter1138> Why would a GS need an install.sh?
09:28:46 <andythenorth> because development
09:29:01 <andythenorth> goes it a symlink or something instead?
09:29:03 <peter1138> If you're developing... you can make a src dir...
09:29:59 <andythenorth> classic distraction
09:30:10 <andythenorth> I was going to test the grf thing, now I'm writing a makefile instead
09:31:22 <andythenorth> my editor doesn't have syntax stuff for squirrel
09:31:27 <andythenorth> javascript seems to work :P
09:36:29 <andythenorth> lol edited my script in the OpenTTD dir, then ran install from my project source
09:36:33 <andythenorth> bye bye edits :D
09:36:59 *** iSoSyS has joined #openttd
09:37:56 <LordAro> classic.
09:38:19 <andythenorth> oops crashed it
09:39:31 <DorpsGek> [OpenTTD/OpenTTD] andythenorth commented on pull request #9464: Add: [Script] Basic information about loaded NewGRFs for scripts. https://git.io/JRwOl
09:45:33 <DorpsGek> [OpenTTD/team] zgopecel opened issue #237: [id_ID] Translator access request https://git.io/JRwsn
09:46:17 <LordAro> if nothing else, that's a very low level error message
09:46:54 <andythenorth> I am copying pasting my loop from existing code using GSTownList()
09:47:04 <andythenorth> I hoped it would be the same interface
09:47:40 <andythenorth> do I have to learn squirrel? :P
09:47:49 *** iSoSyS has quit IRC ()
09:51:47 <peter1138> No, just use an AI to generate code.
09:52:37 <andythenorth> cool
09:52:43 <andythenorth> I can run that on AWS
09:53:00 <andythenorth> they have magic 'buy an AI' buttons now
09:55:21 <peter1138> Oops, I accidentally a chunky bevel chocolate biscuit/
09:55:28 <andythenorth> was it a club?
10:00:45 * LordAro has a packet of oreos
10:00:53 <LordAro> i predict that these will be gone very quickly
10:05:16 *** virtualrandomnumber has quit IRC (Quit: virtualrandomnumber)
10:07:48 * andythenorth obviously confused by C++
10:07:50 <andythenorth> https://github.com/OpenTTD/OpenTTD/pull/9464/files#diff-cb1737ccef6460576f8eb4fd21e8428e2b3e1a39cd27f8d50cb3b193753cca80R20
10:08:38 <andythenorth> the assignment of c is a bit magical, first it's a list, then it's an item in the loop?
10:10:00 <andythenorth> other code looks different to me
10:10:02 <andythenorth> https://github.com/OpenTTD/OpenTTD/blob/master/src/gfxinit.cpp#L281
10:11:42 <LordAro> pointers!
10:12:40 <LordAro> it's not actually any different, just auto instead of explicitly writing out GRFConfig*
10:13:14 <andythenorth> so the pointer to the list also is a pointer to the first item in the list?
10:13:15 <andythenorth> or something?
10:13:32 <LordAro> yes
10:13:46 <LordAro> linked lists are quite common in C
10:14:28 <andythenorth> it makes sense as long as someone explains it :P
10:14:39 <andythenorth> it's easier in some ways than higher level languages
10:26:08 <andythenorth> oof
10:26:19 * andythenorth tried iterating GSNewGRFList instead of GSNewGRFList()
10:26:22 <andythenorth> to see what happened
10:26:35 <andythenorth> output looks like dir() of a class in python :)
10:26:41 <LordAro> haha
10:26:51 <andythenorth> well it didn't crash
10:27:00 <andythenorth> but I've got some kind of list class and methods
10:28:19 <andythenorth> I should probably learn how to put a breakpoint into ScriptNewGRFList::ScriptNewGRFList or something
10:37:31 *** andythenorth has quit IRC (Quit: andythenorth)
10:39:41 *** andythenorth has joined #openttd
10:50:17 <LordAro> https://workplace.stackexchange.com/q/177359 nothing like a good workplace.se popcorn read
11:07:38 <TrueBrain> haha: RUN! RUN LIKE HELL! :P
11:08:28 <andythenorth> it's TrueBrain!
11:08:34 * andythenorth tries to imagine having a job
11:08:35 <TrueBrain> nah
11:14:35 <andythenorth> ok back to "why does this GS not work"
11:16:05 <LordAro> oreos update: gone
11:16:40 <andythenorth> as predicted
11:20:32 <andythenorth> so FIRS grfid is F1250008
11:20:42 <andythenorth> GSNewGRF.IsLoaded seems to want an int
11:21:02 <LordAro> 0xF1250008
11:21:04 <LordAro> hex
11:21:12 <LordAro> presumably.
11:21:32 <andythenorth> it accepts that as a valid value
11:21:37 <andythenorth> but it's returning false
11:22:12 <LordAro> sure it's loaded? :p
11:22:28 <andythenorth> yes
11:22:33 * andythenorth currently reading https://github.com/OpenTTD/OpenTTD/pull/9464/files#diff-cb1737ccef6460576f8eb4fd21e8428e2b3e1a39cd27f8d50cb3b193753cca80R27
11:22:55 <andythenorth> how do I see the value of _grfconfig
11:22:56 <andythenorth> hmm
11:23:05 <LordAro> with difficulty
11:27:40 * andythenorth having a tour through grf loading stuff
11:28:26 <LordAro> `printf("FOO %x\n", c->ident.grfid);` in that loop ought to do
11:29:48 * andythenorth tries
11:31:24 <andythenorth> oh
11:31:28 <andythenorth> endianness? :D
11:31:31 <andythenorth> prints out 80025f1
11:31:36 <LordAro> the thought did occur to me
11:32:16 <andythenorth> ok returns true with 0x80025f1
11:32:19 <andythenorth> happy days
11:32:28 * andythenorth tests more things
11:32:36 <LordAro> might need some clarification
11:32:43 <LordAro> or conversion
11:34:23 <andythenorth> think we might want to update the comment here also :) https://github.com/OpenTTD/OpenTTD/pull/9464/files#diff-102f136078845a6c6f7924b4d130e5e239be341e3befd8e9ecc99d77a9dd1f3aR47
11:34:27 <andythenorth> quite 'bridge' related :)
11:35:44 <LordAro> probably
11:36:03 <LordAro> who approved this? :p
11:36:24 <TrueBrain> hahaha, lol
11:36:32 <TrueBrain> seems michi_cc has some fixing to do :P :P
11:38:28 <DorpsGek> [OpenTTD/OpenTTD] andythenorth commented on pull request #9464: Add: [Script] Basic information about loaded NewGRFs for scripts. https://git.io/JRw9Z
11:39:25 <andythenorth> I should have tested the PR, but it's good to try yolo sometimes
11:39:43 <andythenorth> things that are already merged tend to get prioritised for fixing :P
11:39:48 <andythenorth> instead of sitting stuck for months
11:46:26 *** m811 has joined #openttd
11:49:24 *** moll has quit IRC (Ping timeout: 480 seconds)
11:50:51 <andythenorth> hmm https://github.com/OpenTTD/OpenTTD/pull/9464#issuecomment-895884050
11:51:16 <andythenorth> `^[[AFOO 10bfbfb` looks suspicious
11:51:44 <LordAro> ?
11:52:27 <andythenorth> printing out grfids in the loop for ScriptNewGRFList
11:52:35 <LordAro> the ^[[A ?
11:52:38 <andythenorth> yes
11:52:45 <LordAro> just a terminal control character, they leak out sometime
11:52:46 <LordAro> s
11:52:48 <andythenorth> ok
11:52:51 <LordAro> Ctrl+something
11:53:40 <andythenorth> if I change `this->AddItem(c->ident.grfid);` to `this->AddItem(0);` it no longer crashes
11:54:08 <andythenorth> but the result looks like a single value, not a list
11:54:16 <LordAro> well, yeah
11:54:22 <LordAro> becaues you've just added 0 lots of times
11:55:08 <andythenorth> oh is it like a set?
11:55:25 <LordAro> wouldn't have thought so
11:56:40 * andythenorth looks for repr() in squirrel
11:58:16 *** glx has joined #openttd
11:58:42 <andythenorth> oh maybe my squirrel is wrong
11:58:43 <andythenorth> ha
12:00:03 <glx> I suggest you to change API version in info.nut
12:01:13 <andythenorth> do the docs tell current version?
12:01:15 <glx> Because your GS is using 1.2 anyway, so no need for compat layer
12:01:41 <glx> Easy, API is the openttd version
12:02:07 <glx> So 1.2 for nightlies
12:02:20 <LordAro> you mean 1.12
12:02:50 <glx> Oh yeah, the screenshots tricked me
12:03:00 <TrueBrain> andythenorth: 0x80025f1 and 0x080025f1 are the same ;) So the "dropped" 0 is not really dropped :)
12:03:25 <andythenorth> it makes sense
12:03:36 <andythenorth> but mod authors won't get it :)
12:03:38 <TrueBrain> and yes, it might be polite to do a byteswap on the grfids .. someone a long time ago made a very big boo-boo with them .. and we swap them around in many places :)
12:03:56 <TrueBrain> andythenorth: this has nothing to do with mod-authors .. if your grfid is 0x00000000, it is also 0x0
12:03:58 <TrueBrain> that is just how numbers work
12:04:35 <glx> In c you can force to display the leading 0
12:04:49 <TrueBrain> not with numbers :P
12:04:57 <andythenorth> ok :)
12:04:57 <TrueBrain> only if you make it a string :)
12:05:00 <andythenorth> well it confused me
12:05:56 <TrueBrain> in the practical sense it will not really be an issue
12:06:08 <TrueBrain> the usage would be something like: if (grfid == 0x00001234)
12:06:11 <TrueBrain> which works fine :)
12:06:26 <andythenorth> oh if I had done the byte swap by writing it out, instead of guessing, the 0 would have shown up in the right place
12:06:33 * andythenorth just counted on fingers
12:06:48 <glx> Unless bytes are swapped 😉
12:06:56 <TrueBrain> and the byteswapping .. it is just ugh .. we only do it for NewGRFs and ... one of the other ones
12:07:00 <TrueBrain> all the other content doesn't do it
12:07:02 <TrueBrain> it is so silly
12:07:25 <TrueBrain> I might have written some rants about it :P
12:08:08 <andythenorth> it's nice that we also have no obvious convention on literals or dwords, so I end up with this because $reasons :) https://github.com/andythenorth/firs/blob/master/src/incompatible_grfs.py#L52
12:08:08 <glx> It's because grfid is read as an uint32, while it's written as 4 bytes
12:09:04 <andythenorth> ok I have run out of devloloper ideas for debugging ScriptNewGRFList::ScriptNewGRFList
12:09:20 <andythenorth> the loop is reading grfids correctly, I can print them to stdout
12:09:31 <andythenorth> but it doesn't seem to yield an iterable list to squirrel
12:09:58 <glx> Tried to use an intermediate variable to store the list ?
12:10:31 <TrueBrain> glx: that is a poor excuse for mixing BE and LE :P
12:10:55 <TrueBrain> https://github.com/OpenTTD/bananas-server/blob/main/bananas_server/openttd/send.py#L32 <- on protocol level it is inverted again, as example :)
12:11:08 <glx> Oh and list enumerations expect the use of begin and next
12:11:45 <glx> Not sure our lists are supported by foreach
12:14:44 <LordAro> ah yes, that could be it
12:14:54 *** roadt__ has joined #openttd
12:15:08 *** glx is now known as Guest3810
12:15:08 *** glx_ has joined #openttd
12:15:08 *** glx_ is now known as glx
12:15:08 *** ChanServ sets mode: +v glx
12:15:36 <TrueBrain> it was claimed it was tested code :D :P
12:16:03 *** Guest3810 has quit IRC (Quit: Quit)
12:16:15 <andythenorth> both of these work fine https://gist.githubusercontent.com/andythenorth/05aa1f3a991411c37d2a6e76aea5f42e/raw/4eb41b9f48f0a19c01aee4facc3b26950793bf00/gistfile1.txt
12:16:18 <andythenorth> with foreach
12:16:31 <andythenorth> the implementation of the lists looks very similar in OpenTTD also
12:17:19 <glx> ah yes, so ScriptList work with foreach
12:21:40 *** roadt_ has quit IRC (Ping timeout: 480 seconds)
12:25:29 *** TrueBrain_ii has quit IRC (Quit: killed)
12:33:06 <andythenorth> is ScriptList returning a squirrel table?
12:34:28 <glx> no, it's a ScriptList object
12:35:17 <andythenorth> so that's why typeof() yields 'instance'
12:35:24 <glx> yup
12:35:35 <glx> instance is external object usually
12:35:38 <andythenorth> so GSTownList is iterable as key/value pairs
12:35:47 <andythenorth> but GSNewGRFList just isn't
12:35:54 *** Samu has joined #openttd
12:36:03 <glx> hmm it should, it's a list
12:36:09 <glx> let's try it here
12:42:49 <glx> seems to work for me
12:44:14 *** sla_ro|master has joined #openttd
12:45:58 *** Speeder has joined #openttd
12:49:27 <glx> https://gist.github.com/glx22/10884ba986fffaec0d6254c05645eb48 <-- basic test, works as intended for me
12:56:26 <andythenorth> code is almost identical to mine
12:56:27 <andythenorth> interesting
12:58:03 <andythenorth> glx how many grfs in your list? :)
12:58:18 <glx> I tried 0, 1 and 2
13:00:30 *** sla_ro|master has quit IRC ()
13:00:35 <andythenorth> ok it's crashed by a local version of Road Hog
13:02:35 <glx> oops I can't use name as value
13:03:52 <glx> "restart" is so slow with FIRS
13:04:09 <andythenorth> hmm any version of Road Hog crashes the GS
13:06:44 <glx> I have road hog 1.4.1, let's try
13:07:07 <andythenorth> I found another grf that crashes - Canadian BK Tunnels
13:07:20 <andythenorth> I wondered if it was related to range of grfid
13:07:44 <andythenorth> both Hog and the Canadian grf start grfid with 9787
13:07:55 <glx> no crash with 1.4.1
13:07:59 <andythenorth> which was the cause of one of OzTrans rage quits, but eh
13:08:36 <andythenorth> no crash with just 1.4.1 in the list
13:08:42 <andythenorth> but if I have a list of > 1
13:08:44 <andythenorth> crash
13:09:10 <glx> my list has firs, iron horse and roadhog
13:09:25 <andythenorth> something specific to mac compile?
13:11:05 * andythenorth tries changing grfid on FIRS
13:12:33 <TrueBrain> funny, the default sorter is by value, and the values in this list are always 0 :)
13:12:39 <TrueBrain> might be worth changing it to sort by key instead :D
13:13:04 <glx> in any list I think value is 0 on creation
13:13:21 <glx> because you need to Valuate() after creation
13:14:05 <andythenorth> changing FIRS grfid to "\97\87\EA\FE" causes it to crash the GS, under certain conditions
13:14:33 <andythenorth> (same grfid as Road Hog)
13:14:43 <andythenorth> depends on the order of grfs in list
13:14:54 <andythenorth> for clarity, Road Hog is no longer in the list
13:15:25 <glx> well you can have only 1 grf with a given id
13:15:30 <andythenorth> yes
13:20:23 <TrueBrain> try changing the sorting order andythenorth , see if that changes anything :)
13:20:33 <andythenorth> of the grfs?
13:20:34 <andythenorth> I did
13:20:41 <glx> of the list
13:21:08 <TrueBrain> in GS :)
13:21:11 <glx> changing the order in the newgrf window won't change the order of the list
13:21:12 <TrueBrain> ->Sort(..)
13:21:24 <andythenorth> ok
13:23:38 * andythenorth looks up how to sort in squirrel
13:23:40 <andythenorth> guessing failed
13:24:19 <glx> https://docs.openttd.org/gs-api/classGSList.html
13:24:23 <andythenorth> ta
13:28:34 <andythenorth> foreach (grf, _ in GSNewGRFList().Sort(SORT_BY_VALUE, true))) {
13:28:34 <andythenorth>
13:28:42 <andythenorth> seems to not be the droids I am looking for
13:28:50 <TrueBrain> put it in a variable first :)
13:28:58 <TrueBrain> Sort() doesn't return the list :P
13:29:36 <TrueBrain> a = List \n a.Sort(..) \n foreach ..
13:29:51 <glx> local a = List
13:30:06 <glx> else it will complain about unknown a
13:30:06 <TrueBrain> lot of Squirrel syntax is missing ;)
13:30:08 <LordAro> https://pasteboard.co/KffdgIy.jpg mm, r5a.16xlarge
13:30:21 <TrueBrain> LordAro: pfff, 50%+ idle?
13:31:14 <TrueBrain> it is funny how we are all memory constrained these days ... :P
13:32:30 <andythenorth> if an open source project ever had money
13:32:39 <andythenorth> it could spend in on paying a technical writer
13:32:42 <andythenorth> it *
13:33:22 * andythenorth looking on github for gamescripts to copy
13:34:46 <LordAro> TrueBrain: not my application!
13:35:30 <andythenorth> searching github for .Sort is a fruitless task :)
13:35:40 <LordAro> andythenorth: we told the last one to go away because we didn't like their changes :p
13:36:07 <andythenorth> they were pissing around with case, no?
13:36:14 <andythenorth> not writing the API docs :|
13:36:24 <LordAro> true
13:36:28 <andythenorth> it's worrying how much I now write the API docs
13:36:31 <LordAro> but they might have done!
13:36:33 <andythenorth> given I don't really understand
13:37:52 <andythenorth> do I actually need to instantiate a SorterType?
13:38:00 <andythenorth> instead of just putting a constant in a parameter
13:38:56 <andythenorth> this errors, wanting an expression https://gist.githubusercontent.com/andythenorth/212a7b04f03a8b8fbb608f4b5035687d/raw/6dd8351f8fd58f03f49d3b6f7b64fb3137c9fadc/gistfile1.txt
13:40:15 <andythenorth> oh maybe a spurious )
13:41:24 <andythenorth> or is it a keyword SorterType=foo
13:41:53 <Samu> GSList.SortByValue
13:42:53 <Samu> grf_list.Sort(GSList.SORT_BY_VALUE, true);
13:42:56 <Samu> something like this?
13:43:12 <andythenorth> hurrah
13:43:14 <andythenorth> thanks Samu
13:43:31 <andythenorth> ok so that still crashes on grf
13:43:54 <Samu> Log.Info doesn't exist
13:44:03 <Samu> unless you're using a custom function
13:44:56 <Samu> it's GSLog.Info(grf);
13:45:25 <Samu> not sure if _ is a variable
13:45:28 <Samu> you can name it
13:45:55 <glx> _ is ok if you don't care about the value
13:46:16 <Samu> also not sure about the foreach on ScriptLists
13:46:25 <glx> and default sort is descending value
13:46:26 <andythenorth> ok AV9.8 also crashes the GS
13:47:16 <glx> it's really weird
13:47:34 <Samu> for (local i = grf_list.Begin(); !grf_list.IsEnd(); i = grf_list.Next()) {
13:47:43 <glx> Samu: foreach works too
13:48:06 <LordAro> that's where we started :p
13:49:49 <glx> adding AV9.8 to my test list
13:50:35 <andythenorth> ok so Samu's iterator doesn't fail
13:50:50 <andythenorth> so something trips up foreach
13:51:01 <glx> oh it finally crashed here
13:51:24 <andythenorth> but samu's iterator doesn't yield both key and value
13:51:45 <Samu> GSLog.Info("item: " + i + "; value: " + grf_list.GetValue(i));
13:52:04 <glx> value is 0 ;)
13:52:11 <glx> we want key
13:52:24 <Samu> key is i
13:52:49 <Samu> in script lists they're item/value pairs
13:52:59 <Samu> not really key
13:53:13 <andythenorth> makes more sense
13:53:20 <FLHerne> andythenorth: KDE is hiring people to update the docs :-)
13:53:25 <andythenorth> wise
13:53:31 <FLHerne> it's in this year's official roadmap thing
13:53:49 <andythenorth> docs are not fun https://github.com/OpenTTD/nml/issues/105
13:57:42 * andythenorth BIAB
13:57:48 <andythenorth> this mystery is mysterious
13:57:50 *** andythenorth has quit IRC (Quit: andythenorth)
14:18:54 *** gelignite has joined #openttd
14:25:30 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
14:26:24 *** WormnestAndroid has joined #openttd
14:27:30 <Samu> there is an issue with helicopters, they're not being built
14:29:20 <Samu> the way I am pairing towns for air routes was better before
14:29:39 <Samu> on the new code, I'm not sure how to fix this
14:29:53 <Samu> how to adapt
14:30:44 <Samu> i can't provide a min and a max distance between towns before knowing which type of aircraft I'm using
14:31:01 <Samu> but I am, and I shouldn't
14:32:56 <Samu> im providing a min and max based on the "best aircraft possible", which is a fast plane, but once i actually enter build mode, i can end up doing a heli route, where min and max distances just don't work
14:33:23 <Samu> i can't pair a town before
14:33:42 <Samu> but the code is designed to pair a town before
14:33:58 <Samu> got to think of a workaround
14:56:35 <DorpsGek> [OpenTTD/OpenTTD] J0anJosep updated pull request #8480: Feature: Extended depots https://git.io/JL5Hh
14:56:45 <glx> oh lol, found it
14:56:54 <glx> int val = this->Next(); but next is int64
15:23:44 <glx> ah indeed github webhooks are degraded :)
15:25:14 <DorpsGek> [OpenTTD/OpenTTD] glx22 opened pull request #9465: Fix 14f197c: [Script] int64 values don't fit into int https://git.io/JRrym
15:25:29 <glx> oh it's comming back
15:27:26 <LordAro> nice, old bug
15:40:06 *** andythenorth has joined #openttd
15:42:57 <glx> andythenorth: I found the bug
15:45:54 <andythenorth> :)
15:46:22 <glx> you're too good at triggering weird bugs ;)
15:46:45 <TrueBrain> so we have all these compilers, and non warned about a int64 -> int32 conversion? :P
15:46:55 <glx> yup
15:47:01 <LordAro> -Wnarrowing, iirc
15:47:14 <glx> usually MSVC likes to warn for that
15:47:29 <glx> but not here
15:48:02 <andythenorth> so was it an overflow?
15:48:25 <LordAro> truncation, rather than overflow
15:48:28 <LordAro> but same effect
15:51:25 <andythenorth> ok so grf <-> gs comms
15:51:39 <andythenorth> let's see if I've understood the circles yet :P
15:52:02 *** Progman has joined #openttd
15:52:03 <andythenorth> so a grf could yield an event, which would be put in a queue GS handles when it gets to it
15:52:21 <andythenorth> so a use case for that could be e.g. "this town wants something"
15:52:33 <andythenorth> like a dead letter drop :P
15:52:48 <andythenorth> but GS also has vars, not just events?
15:52:59 <TrueBrain> it is just one of the ideas to do this, but it is something I think is the most generic. It does require some agreement on the format of the event .. but that is for GS authors to figure out, not for us :)
15:53:00 <andythenorth> like...it can read properties on entities like industries
15:53:05 *** sla_ro|master has joined #openttd
15:54:02 * andythenorth wonders if there's a complementary route where GS calls a var on an entity like industry, which is handled by a new callback in grf
15:54:12 <andythenorth> so the grf can yield metadata in json
15:54:28 <TrueBrain> NewGRF wouldn't yield
15:54:47 <andythenorth> it can't return as a callback result?
15:54:50 <TrueBrain> and that scenario is mostly irrelevant, as the events are async anyway
15:56:13 <andythenorth> something like Industry.IsCargoAccepted is an event, or a var? https://docs.openttd.org/gs-api/classGSIndustry.html#a3716185d2a6ecb61489b5d336446f776
15:56:28 <TrueBrain> a "var" outside NewGRF is a very weird thing to use
15:56:31 <TrueBrain> just so you know :)
15:56:34 <TrueBrain> it will confuse the fuck out of people :P
15:56:49 <TrueBrain> and how can a function be an event? How does that work, you would think? :)
15:57:13 <andythenorth> I have no idea, that's why I'm asking
15:57:20 <TrueBrain> I now wonder if you understand what an event is :)
15:57:25 <andythenorth> not really
15:57:33 <TrueBrain> have you been talking about months about this, without understanding this part? :)
15:57:41 <TrueBrain> about = for, at least one of them
15:57:51 <LordAro> hmm, -Wnarrowing is enabled by -Wall for gcc
15:57:59 <andythenorth> I always avoided event driven stuff in Flash games if I could
15:58:00 <LordAro> i dunno why it's not picking it up then, in which case
15:58:02 <andythenorth> it was easier to use loops
15:58:14 <TrueBrain> events and loops are not mutual exclusive
15:58:15 <andythenorth> events aren't reliable for timing
15:58:21 <TrueBrain> (in fact, you mostly use loops with events :P)
15:58:36 <andythenorth> in Flash you registered handlers and events were bubbled
15:58:36 <TrueBrain> andddddd you mixed up events with callbacks again :)
15:59:01 <andythenorth> so e.g. onEnterFrame or whatever is an event, and you declare a function to handle it
15:59:04 <andythenorth> or multiple functions
15:59:07 <TrueBrain> we really should make you an infomercial of some kind :)
15:59:13 <andythenorth> depending how much string you want to debug
15:59:41 <andythenorth> is there a different even paradigm :P
15:59:42 <TrueBrain> yeah, and those onNNN we call a callback function :)
15:59:52 <andythenorth> event *
16:00:11 <TrueBrain> or "event handlers", but we are getting off-track
16:00:26 <TrueBrain> let me try yet-another-way
16:00:38 <TrueBrain> callbacks are ALWAYS handled in the same tick as they are executed
16:00:43 <TrueBrain> events are UNLIKELY to be handled in the same tick
16:01:13 <andythenorth> I get they go on a queue etc
16:01:42 <andythenorth> the bit I don't understand is how a method that returns properties of an entity relates to the event queue
16:02:00 <TrueBrain> that is a relation you created in your head
16:02:02 <TrueBrain> no clue why
16:02:05 <TrueBrain> but that happened :P
16:02:37 <andythenorth> well words
16:03:06 <TrueBrain> if you send an email to one of your employees to clean up his desk, you fire an event to him
16:03:15 <TrueBrain> he will read his email some time, not earlier than you hit send
16:03:22 <TrueBrain> when he does, he might or might not clean up his desk
16:03:30 <andythenorth> ok so events aren't the understanding problem
16:03:34 <andythenorth> that matches
16:03:37 <TrueBrain> there is no relation between the time of firing the event and the moment he acts on it
16:03:52 <andythenorth> ok let's rewind a bit
16:03:57 <TrueBrain> when you walk up to him, grab him by his ear and force him to clean his desk, and you don't leave till he is done
16:04:01 <TrueBrain> that is like a callback
16:04:14 <andythenorth> this reminds of when I said 'property' to DaleStan and got educated on why a property is not a variable and vice versa :)
16:04:15 *** WormnestAndroid has quit IRC (Ping timeout: 480 seconds)
16:04:41 <andythenorth> the methods that return current values from entities like industry, what are they called?
16:04:42 <TrueBrain> the timing between the start of a callback and the end heavily influences on what you can do in the meantime: absolutely nothing
16:04:48 <TrueBrain> you have to stand there and wait till he is done :P
16:05:23 <TrueBrain> give it a name ... function, procedure, .... long list of things how people call them
16:05:31 <andythenorth> e.g. IsCargoAccepted just reads some current attributes from Industry
16:05:44 <TrueBrain> IsCargoAccepted does something and returns a value to the script
16:05:57 <andythenorth> now, or async?
16:06:19 <TrueBrain> I am seriously wondering what is happening in your head :D How could that be async?
16:06:25 <TrueBrain> (from a script perspective)
16:06:35 <andythenorth> just checking every i, dotting every t
16:06:41 <TrueBrain> maybe a different wording helps more for you: sequential execution
16:06:52 <TrueBrain> it cannot do ANYTHING else till the function returns
16:07:02 <TrueBrain> similar, when a callback in a NewGRF is called, OpenTTD cannot do ANYTHING else till it returns
16:07:14 <andythenorth> ok so given all that, why can't it just query a newgrf from one of those functions?
16:07:23 <TrueBrain> in contrast to events, which are fire&forget (from the perspective of who fires it)
16:07:23 <andythenorth> that's literally what some of the newgrf callbacks do
16:07:31 <andythenorth> they return a computed value instead of an industry static prop
16:07:41 <TrueBrain> you made up that you cannot "query a newgrf"
16:07:43 *** WormnestAndroid has joined #openttd
16:07:48 <TrueBrain> I do not think anyone said anything remotely like that :P
16:08:12 <TrueBrain> as I said, it is completely irrelevant from an event/callback perspective, if a GS function triggers a NewGRF callback or not :)
16:08:15 <andythenorth> I am not arguing with any person :)
16:08:21 <andythenorth> I am arguing with my own confusion
16:09:02 <TrueBrain> a GS calls a function, and he gets a value back. He does not care what needs to be done to get him that value
16:09:06 <TrueBrain> it simply is not relevant to him
16:09:26 <andythenorth> ok
16:09:57 <andythenorth> so if a GS said 'do you have any json for me about entity X'
16:10:19 <andythenorth> a function could have yes, here's some json, or no, go away
16:10:40 <TrueBrain> possible, yes. But similar to "reading the NewGRF town registries", I would suggest not to go that route
16:11:55 <TrueBrain> a GS (and an AI) are build to be reactive; not proactive
16:12:42 <andythenorth> entirely?
16:13:05 <TrueBrain> that is how they are build. "entirely" doesn't really mean anything to me in that context
16:13:25 <TrueBrain> a house is build to live in. not sure how to respond if someone would ask next: entirely?
16:13:51 <andythenorth> might be that I have misunderstood GS quite a lot
16:14:17 <TrueBrain> a GS is never asked: what to do next?
16:14:21 <andythenorth> my picture of it was as the main loop of gameplay development
16:14:24 <TrueBrain> a GS is always looking for what to do next himself
16:14:24 <andythenorth> seems that's upside down
16:14:45 <TrueBrain> a GS is like a human
16:15:01 <TrueBrain> (in fact, that is one of the core ideas of the AI framework: never allow anything a human cannot)
16:15:18 <TrueBrain> nowhere the game pauses and asks you: how about this?
16:16:06 <andythenorth> interesting :)
16:16:10 <andythenorth> funny how wrong I had it
16:16:56 <TrueBrain> people have been trying to (ab)use GSes to become more proactive, but there is a reason it works weird and doesn't really do it in a way they want to
16:17:46 <andythenorth> I was just trying the 'Technology Advancement' GS, and wondering why it doesn't work
16:17:57 <andythenorth> but the author discovered also it doesn't https://www.tt-forums.net/viewtopic.php?f=65&t=87029
16:18:00 <andythenorth> maybe this is why
16:18:13 <andythenorth> something like technology advancement is the opposite of event driven
16:18:30 <TrueBrain> huh? I wouldn't know why
16:18:53 <TrueBrain> those two parts of the sentence have very little in common :D
16:18:54 <andythenorth> well it's trying to create events, not handle them?
16:20:19 <TrueBrain> I am sometimes confused by what is causing someone to be confused :D
16:21:20 <andythenorth> oh dear :)
16:21:25 <andythenorth> sorry
16:21:39 <TrueBrain> it seems your main pitfall is that you make connections that do not exist
16:21:50 <TrueBrain> and sometimes it is difficult to follow what you connected together
16:22:08 <TrueBrain> for example, there is absolutely nothing wrong for a GS to cause things to happen .. in fact, it is part of his job to do so
16:22:14 <andythenorth> usually I would just have a diagram
16:22:28 <andythenorth> most things are boxes and arrows in loops or terminations
16:22:40 <TrueBrain> this is a lot more fundamental :)
16:22:46 <TrueBrain> fundaments of Computer Science :P
16:22:58 <TrueBrain> let me try it one more way, see if this clicks:
16:23:17 <andythenorth> Go!
16:23:27 <TrueBrain> every system (in the domain of computers) needs something that drives it
16:23:37 <TrueBrain> something that indicates it has something to do, or needs to do something, etc
16:23:43 <TrueBrain> the pumping part
16:23:55 <TrueBrain> for NewGRFs it is simple: it does nothing, unless asked to do something
16:24:03 <TrueBrain> it is a very stupid beast
16:24:13 <TrueBrain> if we never ask it anything, it is never going to do anything
16:24:28 <TrueBrain> in other words, the pumping is done by OpenTTD, when he needs it, how he needs it
16:24:38 <TrueBrain> it is not sentient in any way or form
16:24:44 <TrueBrain> GS on the other hand, works completely different
16:24:55 <TrueBrain> it pumps itself
16:24:55 <TrueBrain> in a huge while (true) {} loop
16:24:59 <TrueBrain> if it ever exists, it dies
16:25:02 <TrueBrain> sad, but true
16:25:12 <TrueBrain> OpenTTD has no influence on how alive it is
16:25:23 <TrueBrain> if it is not pumping itself, OpenTTD can scream at it how ever it want
16:25:27 <TrueBrain> it won't react
16:25:45 <TrueBrain> so for OpenTTD to talk to a GS, it can drop these snippets of information, so the GS knows something happened he might be interested in
16:25:49 <TrueBrain> and we call that "events"
16:25:55 <TrueBrain> "A plane crashed!"
16:25:58 <andythenorth> so far so good
16:25:59 <TrueBrain> "An industry closed!"
16:26:16 <TrueBrain> those two ways of being driven are completely different, and have very little in common
16:26:22 <andythenorth> so far so good
16:26:31 <TrueBrain> and that is the only thing "different", in when we talk about event vs callback
16:26:35 <TrueBrain> and in sync vs async
16:26:36 <TrueBrain> in this context
16:26:42 <TrueBrain> everything else is the same
16:26:47 <TrueBrain> they can ask information about an industry
16:26:53 <andythenorth> this is all happy
16:26:53 <TrueBrain> they can influence things in an industry
16:26:54 <TrueBrain> etc etc
16:27:19 <TrueBrain> so something like "well it's trying to create events, not handle them?" is not a statement with any value, in this context
16:27:23 <TrueBrain> both can create events
16:27:29 <TrueBrain> but one is driven by events, where the other is not
16:28:00 <TrueBrain> GS is what you can call sentient, it has a mind of its own
16:28:06 <TrueBrain> NewGRF very much is not sentient
16:28:36 <TrueBrain> any click? :)
16:28:41 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain approved pull request #9465: Fix 14f197c: [Script] int64 values don't fit into int https://git.io/JRoJa
16:28:48 <andythenorth> yeah this is all no change
16:28:58 <TrueBrain> wow DorpsGek , only took you .. 37 minutes
16:29:49 <TrueBrain> yeah, that is all I had .. I was hoping it would click and you go: owh, yeah, now I get why that statement makes no sense :P
16:29:51 <TrueBrain> sorry :)
16:31:35 <andythenorth> let's see if I can summarise my puzzle in like 3 lines
16:32:13 <TrueBrain> I guess in conclusion: this is why NewGRF is always blocking, and communication TO GS is always non-blocking. And this is why a NewGRF can never "ask" something from a GS
16:32:15 <andythenorth> GS have a main loop; it's common in those to do big walks over foreach([list of game items]), possibly setting properties on them
16:32:25 <TrueBrain> (expecting a return)
16:32:33 <andythenorth> is that (1) fine, intended (2) a bit abusive (3) very abusive, against intended design
16:32:54 <TrueBrain> a GS has to find his own information; if looping is his way of doing that, that is what is needed
16:33:21 <TrueBrain> but you notice a lot of problems here, as it scaled poorly with "amount of items in that list"
16:33:33 <andythenorth> this is like the crux of my confusion
16:33:49 <TrueBrain> so ideal, it is driven by events more than by "finding out on his own"
16:33:49 <andythenorth> is it "you shouldn't really do that" or "be cautious"
16:34:00 <TrueBrain> you have to do that, but you have to be smart about it
16:34:07 <TrueBrain> looping all towns every tick, not smart
16:34:25 <TrueBrain> doing complex algebra for every town, not smart
16:34:35 <andythenorth> ok...so in a Flash game shoot em up if you query the hitbox of every enemy on every main loop, you will have FPS problems
16:34:43 <andythenorth> so you don't
16:34:48 <andythenorth> you do other things instead
16:35:18 <TrueBrain> in fact, if you ask every tick: did the user click this button?
16:35:19 <TrueBrain> that is also very stupid
16:35:20 <TrueBrain> instead, you tell the system to tell you when he clicked
16:35:24 <TrueBrain> and you just monitor the event-queue for it
16:35:25 <andythenorth> onMouseUp :P
16:36:22 <andythenorth> ok
16:39:28 <andythenorth> so...how to communicate extended metadata about game entities from grf to GS?
16:39:50 <andythenorth> e.g. a tech tree GS might want to know 'tech tree level of vehicle X'
16:39:50 <TrueBrain> many ways to do it, but again, my suggestion: make GRF able to fire an event to a GS
16:40:28 <andythenorth> hmm, we might have used a lot of words because I suggested idea A not B first :P
16:40:46 <TrueBrain> you tend to skip a lot of things going on in your head, yes :)
16:41:07 <TrueBrain> not always a bad thing :P
16:41:10 <andythenorth> idea B was that grf gets some kind of 'on game load' callback from *OpenTTD*, and it can return an event to the GS queue
16:41:24 <andythenorth> this looks rather like onLoad() in jquery, so I dismissed it for odd reasons
16:41:53 <andythenorth> that event could be a massive json table of all the vehicles / cargos / etc the grf provides, with metadata
16:42:24 <andythenorth> I considered it just being static action 14, but the grf probably needs to check parameters etc
16:42:24 <TrueBrain> but what-ever we do, the biggest hurdle will always be consensus over the format, or some GSs will only works with certain NewGRFS
16:42:29 <andythenorth> it will be the latter
16:42:32 <TrueBrain> but that is something for the community to figure out
16:42:44 <andythenorth> the platonic ideal of 'any GS with any grf' is nonsense
16:42:59 <andythenorth> it's more like 'some GS with any grf'
16:43:02 <TrueBrain> and the idea of predefining all these properties people can come up with, is impossible
16:43:06 <andythenorth> yes
16:43:18 <TrueBrain> (which is what we have plenty of in OpenTTD)
16:43:23 <andythenorth> we have too much :)
16:44:39 <TrueBrain> anyway, letting a GS read stuff from a NewGRF is opening ourselves to a lot of hurt in my opinion .. as it strongly depends on the GRF how the response is
16:44:46 <TrueBrain> so a lot of hassle to get that problem-free
16:45:20 <TrueBrain> doing it the other way around is easier to orchestrate
16:45:53 *** gelignite has quit IRC (Quit: Stay safe!)
16:46:00 <andythenorth> you mean orchestrating the content between authors, or orchestrating sync vs async?
16:46:08 <TrueBrain> but again, that is a personal opinion
16:48:11 <TrueBrain> between GS creators and NewGRF creators
16:48:48 <andythenorth> it's just cargos vs. vehicles, or railtypes vs. vehicles :)
16:48:54 <andythenorth> we are well versed in this
16:49:07 <TrueBrain> you always have to consider people will abuse any system you give them (which is fine)
16:49:08 <andythenorth> just don't read forums, and rely on discord to help authors :P
16:49:22 <TrueBrain> but that means if a GS can query a GRF in this free format, he has to be able to handle all the shit a GRF can give him back
16:49:30 <andythenorth> or ignore it?
16:49:35 <TrueBrain> which is just a world of hurt
16:49:46 <TrueBrain> doing it the other way around gives some more control and sanity to it all
16:49:50 <TrueBrain> but again, my view on this :)
16:49:57 <andythenorth> I don't mean ask the GRF for instructions on what to do
16:50:10 <andythenorth> just in case that's not clear
16:50:16 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 approved pull request #9461: Fix 68f2213: Don't use GetPoolSize() for end of pool iterator https://git.io/JRotH
16:50:26 <TrueBrain> any information you return allows that to be the case :)
16:50:30 <TrueBrain> how ever you slice it ;)
16:50:30 <andythenorth> anyway, there are no ideas I had that can't be done with events
16:50:40 <andythenorth> dunno about other people
16:51:11 <andythenorth> oh actually querying the grf wouldn't just be simple and generic also
16:51:15 <TrueBrain> to name a few issues: if you would use registers, timing is a real issue
16:51:23 <TrueBrain> a GS is not guaranteed to do a blob of work in a single tick
16:51:33 <TrueBrain> so it could start reading a few things from a NewGRF, get interrupted
16:51:36 <andythenorth> depending on the features, the GS would need to put extra feature-specific information into the callback vars
16:51:38 <andythenorth> ugh
16:51:38 <TrueBrain> and continue on reading something completely different
16:51:44 <TrueBrain> shit like that, is what I mean with a world of hurt
16:52:12 <andythenorth> hmm ok
16:52:20 <andythenorth> worse is better
16:52:40 <TrueBrain> with events, a GS might be slow and pick up on old events
16:52:44 <TrueBrain> but at least the context would be contained
16:52:51 <TrueBrain> possibly I am completely wrong in that claim
16:53:16 <andythenorth> who knows :)
16:53:30 <andythenorth> it's not like an A XOR B choice
16:53:39 <andythenorth> events are simpler so do those
16:54:04 <andythenorth> currently for comms we have...nothing...except some side channel abuses I have discovered
16:55:21 <andythenorth> almost all the ideas I have fall into two categories
16:55:49 <andythenorth> (1) dump a massive chunk of metadata out so GS can use it as extra information about vehicles, industries etc
16:56:01 <andythenorth> that only needs to happen once really
16:56:37 <andythenorth> (2) put some 'health and happiness' type information on the event queue for towns / industries / vehicles, which doesn't need to be handled immediately
16:57:37 <glx> better example is crash events, script will know a vehicle as crashed, but at the time of handling the event the vehicle id may hav become invalid
16:58:17 <TrueBrain> better example of what, sorry? :)
16:59:00 <glx> for the async and possible long delay between fire and handling
16:59:49 <TrueBrain> btw, that issue strongly related to https://github.com/OpenTTD/OpenTTD/issues/8498 , as that is an issue for humans too :)
17:00:23 <glx> yeah it's exaclty like the news backlog :)
17:00:27 <TrueBrain> awh, I made the "start server" gui lovely small and tidy :D
17:00:35 <TrueBrain> I like this a lot more than the old window :D
17:00:52 <TrueBrain> https://cdn.discordapp.com/attachments/337701432230805505/874698799111602206/unknown.png
17:00:58 <DorpsGek> [OpenTTD/OpenTTD] glx22 merged pull request #9465: Fix 14f197c: [Script] int64 values don't fit into int https://git.io/JRrym
17:01:13 <andythenorth> it's an interesting balance between 'perfection of all the things', 'generic solutions are best' and 'JFDI can we please just sanitise town <-> grf interaction via GS' eh :)
17:02:01 <andythenorth> anyway, using Michi's feature I want to try and make a tech tree GS :P
17:02:16 <andythenorth> which works only with Iron Horse
17:02:26 <andythenorth> this will be an adventure in version mismatches :)
17:03:19 <DorpsGek> [OpenTTD/OpenTTD] glx22 merged pull request #9461: Fix 68f2213: Don't use GetPoolSize() for end of pool iterator https://git.io/JBhBU
17:04:28 <glx> at least your script can check for newgrf presence (and the right version), then can assume a lot of things (like a human knowing the grf would do)
17:04:39 <andythenorth> TrueBrain the aspect ratio on the old start server window :D
17:05:12 <glx> and it can also kill itself if the required newgrf are missing
17:06:03 <andythenorth> the edge case I see is (1) player has outdated version of GS (2) new Iron Horse is released which has a version bump for grf reasons but IS compatible with the GS (3) the GS disables anyway
17:06:11 <andythenorth> maybe the player will just update
17:06:13 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain opened pull request #9466: Change: remove the ability to control "max spectators" https://git.io/JRo3J
17:06:27 <andythenorth> oh I might be able do A > B and use an 'upgrade' message
17:06:44 *** HerzogDeXtEr has joined #openttd
17:06:51 <andythenorth> maths to the rescue
17:07:44 <TrueBrain> now it is time to remove a very annoying and ugly GUI ..
17:08:21 <glx> and not really useful
17:09:01 <LordAro> TrueBrain: hype!
17:09:25 <TrueBrain> oof, forgot to remove strings
17:10:31 <andythenorth> hmm
17:10:45 <andythenorth> adventures in GS!
17:10:55 * andythenorth considers just making a troll GS to test things
17:10:59 <andythenorth> like Chaos Monkey
17:11:22 *** Progman has quit IRC (Remote host closed the connection)
17:11:30 <andythenorth> or Nightmare mode
17:11:45 <TrueBrain> does glx's PR fixes the things you reported in michi_cc's PR?
17:11:51 <andythenorth> yes
17:11:51 <TrueBrain> if so, might be nice to update that PR :)
17:11:56 <andythenorth> I commented just now
17:12:01 <TrueBrain> sweet
17:12:05 <andythenorth> but on the old comments, not a new one so no dorpsgek
17:12:12 <andythenorth> staff strikes, angry towns, arbitrary taxes
17:12:23 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9466: Change: remove the ability to control "max spectators" https://git.io/JRo3J
17:12:25 <andythenorth> 'this vehicle type has faults, they've all been grounded in depot'
17:12:28 <LordAro> doesn't fix the bad docs
17:12:40 <TrueBrain> weren't you doing that LordAro ? :P :P :P :P
17:12:47 <andythenorth> we're paying someone to?
17:13:10 <andythenorth> 'this industry caught fire and closed'
17:13:26 <andythenorth> Minor Disasters GS
17:16:32 <DorpsGek> [OpenTTD/OpenTTD] James103 commented on issue #9458: [Bug]: desync after joining server https://git.io/J4Sll
17:17:17 <TrueBrain> nobody closed that ticket yet? Oof
17:19:08 <TrueBrain> there
17:19:09 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain commented on issue #9458: [Bug]: desync after joining server https://git.io/J4Sll
17:19:12 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain closed issue #9458: [Bug]: desync after joining server https://git.io/J4Sll
17:20:01 <TrueBrain> right, now to find how to open the right window after join ... eeeuuhhhh
17:22:14 <TrueBrain> segfault because I am trying to show the client list .. nice :D
17:22:28 <glx> ShowClientList() ?
17:22:33 <TrueBrain> ofc
17:24:40 <glx> weird, unless something is wrong in the window itself
17:24:59 <glx> does it work if you open it via gui ?
17:25:28 <TrueBrain> I do appreciate it, but just realise I am being verbal about the work I am doing :)
17:25:47 <TrueBrain> locating a good place to open such window is difficult, as we do not have one currently :P
17:29:21 <TrueBrain> the game really depends on certain things already being set before getting to some parts of our GUI, funny :D
17:30:49 <Rubidium> network_client.cpp:931-939?
17:31:30 <TrueBrain> yeah, that is what I did .. but next I had to fix the GUI to work when called there :P
17:31:34 <TrueBrain> guess that is fine
17:31:47 <TrueBrain> the "own_ci" isn't filled yet
17:31:58 <TrueBrain> I now just allowed the code for that to be null
17:32:34 <Rubidium> oh, the server sends that only once it received a MAP_OK? That's a bit of a PITA
17:32:41 <TrueBrain> yeah .. it is
17:34:37 <Rubidium> maybe change the server to send them earlier, e.g. somewhere before the first map data? Or is that going to mess up the other clients getting information about a still joining client?
17:35:44 <Rubidium> although receiving that updates the local player, which the network_client bit messes with too. Yikes
17:36:14 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain opened pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoWg
17:36:27 <TrueBrain> and yes, I called it a feature :)
17:36:54 <TrueBrain> https://github.com/OpenTTD/OpenTTD/pull/9467/commits/a2bb8d3fe38ef75cfd3d2e8c292ff8250f593446#diff-91d2d60e68e89890789db7e11ae237ce1c14daec423f75dd3cedc56e1cb81ffcR1619 <- my solution for now
17:37:06 <TrueBrain> now a MOTD :)
17:39:09 <glx> should be safe, it's spectator on join anyway
17:40:26 <TrueBrain> via console you can be a company
17:40:27 <TrueBrain> so it might be wrong for a short window of time
17:40:46 <TrueBrain> I just didn't care enough :P
17:41:07 <glx> ah using ip:port#company
17:41:08 *** virtualrandomnumber has joined #openttd
17:43:56 <TrueBrain> lol, turns out we have most of the code to sync motd / servername already
17:43:56 <TrueBrain> sweet
17:49:05 <TrueBrain> right, how to show the MOTD ... do we want to allow colours etc?
17:49:07 <TrueBrain> or just text?
17:50:45 *** gelignite has joined #openttd
17:51:08 <andythenorth> How does server owner set MOTD? In the UI, or from a config file?
17:51:20 <andythenorth> UI doesn't have a WYSIYG editor :P
17:51:46 <Rubidium> it gets it from /etc/motd ;)
17:51:55 <TrueBrain> yeah, and I decided in my head to not make this more complicated than needed :D
17:52:12 <andythenorth> if people *need* colours we can patch later?
17:53:58 <DorpsGek> [OpenTTD/OpenTTD] LordAro approved pull request #9466: Change: remove the ability to control "max spectators" https://git.io/JRo4d
17:56:56 <TrueBrain> hmm .. if the MOTD is changed by the server, should that cause it to pop up again?
17:57:09 <TrueBrain> (easier to implement it like that :P)
18:03:17 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain merged pull request #9466: Change: remove the ability to control "max spectators" https://git.io/JRo3J
18:03:35 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoWg
18:08:02 *** Flygon has quit IRC (Quit: A toaster's basically a soldering iron designed to toast bread)
18:15:35 <andythenorth> so...anyone want to tell me that GS can already parse json? o_O
18:15:45 <andythenorth> that would be a nice outcome if so :)
18:15:47 <TrueBrain> I think JSON is not the right format
18:15:51 <TrueBrain> I think a key/value table is better
18:15:54 <TrueBrain> nested, if possible
18:16:02 <andythenorth> ok
18:16:29 <andythenorth> so more like GET :P
18:16:31 <andythenorth> oof
18:17:02 <andythenorth> is there an existing key/value format we could steal?
18:17:13 <andythenorth> or do we have to learn about escapes and crap the boring way? :)
18:17:14 <TrueBrain> Squirrel has tables
18:17:37 * andythenorth reads docs
18:19:04 <TrueBrain> how to do newlines in {RAW_STRING} .. eeuuuuhhhhhh
18:19:25 <andythenorth> so for a static GS compile (nothing to do with newgrf comms)...I could just template some tables into a .nut with a templater
18:19:57 <TrueBrain> yup
18:19:59 *** virtualrandomnumber has quit IRC (Quit: virtualrandomnumber)
18:20:13 <andythenorth> all we need now is...
18:20:18 <andythenorth> lol
18:20:30 * andythenorth goes from 0 to 100 on feature requests
18:20:36 <andythenorth> (1) multiple GS per game
18:20:44 <andythenorth> (2) distribute grf + GS together :P
18:22:28 <TrueBrain> hmm ... is there a function to parse an OpenTTD string, I wonder ...
18:22:33 <TrueBrain> GSes do this, not? :D
18:30:52 <TrueBrain> all I want is to convert newlines to actual newlines ..
18:30:55 <TrueBrain> now they become ?? :D
18:31:14 <TrueBrain> hmm .. maybe replace it with the right SCC code
18:33:26 <TrueBrain> https://cdn.discordapp.com/attachments/337701432230805505/874722107462914138/unknown.png
18:33:31 <TrueBrain> the second line is server-configurable
18:45:34 *** Wormnest has joined #openttd
18:47:11 <Rubidium> them becoming ?? is probably the string validation of the network protocol removing the \n with ?
18:47:43 <Rubidium> the SCC 'code' for newlines is by the way '\n' ;)
18:48:09 <TrueBrain> meh .. I just did away with newlines .. seems to work fine too
18:54:45 <michi_cc> I see there was some GS fun?
18:54:57 <TrueBrain> bugs were found :P
18:55:48 <michi_cc> As I'm not really going to use those functions, somebody else has to decide if the grfids should be byte-swapped or not.
18:56:06 <TrueBrain> I think it will prevent a lot of WTFs
18:56:23 <TrueBrain> or we should add a function to get the GRFID
18:56:25 <DorpsGek> [OpenTTD/OpenTTD] DorpsGek pushed 1 commits to master https://git.io/JRoVQ
18:56:26 <DorpsGek> - Update: Translations from eints (by translators)
18:56:48 <TrueBrain> (in a way people expect them)
18:57:22 <andythenorth> +1
18:59:43 <TrueBrain> it is mainly for the "if (grfid == 0x....)" stuff btw
19:08:52 *** jottyfan has joined #openttd
19:09:40 * andythenorth tries to make a silly tech tree GS
19:10:19 <andythenorth> I think it lacks some needed methods to set vehicle availability
19:11:43 <glx> like https://docs.openttd.org/gs-api/classGSEngine.html#a7cb222ce6deb5418ee527c9a378d71b0 ?
19:12:23 <DorpsGek> [OpenTTD/OpenTTD] rubidium42 commented on pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoo8
19:12:35 <DorpsGek> [OpenTTD/OpenTTD] michicc opened pull request #9468: Fix 8706dcd9: [Script] Byte-swap grfids to match normal expectations. https://git.io/JRoo4
19:12:37 <andythenorth> Firrel suggests that doesn't work as expected https://www.tt-forums.net/viewtopic.php?p=1233855#p1233855
19:13:05 * andythenorth reading the source of Technology Advancement GS
19:13:19 <andythenorth> also didn't work when I tested it
19:13:34 <glx> but you used the date cheat
19:14:03 <andythenorth> not today
19:14:14 <andythenorth> I left a game running on FFWD for 60 years
19:14:38 <andythenorth> I think DisableForCompany() doesn't prevent the usual introduction date
19:14:54 <andythenorth> it just disables the engine 'now'
19:16:03 <andythenorth> looks like CmdEngineCtrl
19:16:06 <glx> yes the game can change stuff after GS did it
19:17:00 <TrueBrain> GetStringHeight can return 0 for very small strings .. lovely
19:18:51 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain approved pull request #9468: Fix 8706dcd9: [Script] Byte-swap grfids to match normal expectations. https://git.io/JRoKm
19:19:42 <andythenorth> seems we have a bool on engines `company_avail`
19:20:53 <andythenorth> TL;DR daylength won't be solved within current GS API :)
19:21:06 *** jottyfan has quit IRC (Quit: jottyfan)
19:24:25 <LordAro> andythenorth: you surprise me.
19:24:52 <TrueBrain> ugh, I HATE THE GUI .. boy, this is ... ugh ...
19:25:08 <TrueBrain> for some reason my NWID_SELECTION keeps using vertical space
19:25:09 <glx> and it used to be worse
19:25:12 <TrueBrain> and I do not know why
19:29:21 <TrueBrain> right, fixed that ..
19:29:35 <TrueBrain> now to figure out why "bla" doesn't show anything
19:35:21 <DorpsGek> [OpenTTD/OpenTTD] michicc merged pull request #9468: Fix 8706dcd9: [Script] Byte-swap grfids to match normal expectations. https://git.io/JRoo4
19:35:34 <andythenorth> :)
19:35:50 <andythenorth> do I have enough battery left to compile OpenTTD :P
19:37:33 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain commented on pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoPL
19:38:34 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain commented on pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoPl
19:39:13 <glx> but it is supplied
19:39:15 <glx> IIRC
19:40:04 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain commented on pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoPo
19:40:05 <glx> https://docs.openttd.org/gs-api/classGSWindow.html#aa61dcef4f227e6e428e09c7e8ff89e35a5f69ab6a8c6384336523c0b4ae2d614c ;)
19:40:37 <TrueBrain> glx: fair, GSes using that value will break
19:40:46 <TrueBrain> not sure I really care :D
19:40:57 <glx> I don't think any are using it anyway
19:42:05 <glx> just update game_changelog.hpp and it should be ok
19:43:08 <TrueBrain> 0 game-scripts use WM_ :P
19:43:12 <TrueBrain> owh, that is a good point
19:43:16 <andythenorth> ok so GS tech tree isn't possible, what shall I try next that's silly :P
19:43:19 <andythenorth> Sinking Ships GS?
19:44:00 <andythenorth> michi_cc did you see the note about 'bridge' in code comments? :)
19:44:14 <michi_cc> Did you check the commit?
19:45:02 <andythenorth> oof :)
19:45:08 <andythenorth> now I look silly
19:45:57 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoWg
19:46:14 <TrueBrain> glx: there, fixed :)
19:49:32 <glx> same for GSWindow.NetworkLobbyWidgets ;)
19:51:53 <glx> oh and the 4 removed WID_NSS_SPECTATORS_ in GSWindow.NetworkStartServerWidgets
19:52:09 *** Progman has joined #openttd
19:52:10 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain opened pull request #9469: Server motd https://git.io/JRo1y
19:52:25 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain commented on pull request #9469: Feature: servers can now set a Message Of The Day https://git.io/JRo1H
19:52:26 <glx> but all these are not reachable by GS anyway, because it's not yet running
19:52:49 <TrueBrain> is it really the right thing to mention them?
19:52:57 <TrueBrain> "you couldn't use this, but we removed it"
19:52:59 <TrueBrain> feels weird
19:53:35 <glx> well they could use them, but the windows would never be open when GS run
19:54:30 <LordAro> "removed the thing that was broken and no one used anyway"
19:56:18 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9467: Feature: make "join game" button join the game, instead of first showing a lobby window https://git.io/JRoWg
19:56:24 <TrueBrain> overly pedantic is the term I think :)
19:57:42 <TrueBrain> awh, I broke my build ... how did tha thappen :D Rebase issues much?
19:59:39 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9469: Feature: servers can now set a Message Of The Day https://git.io/JRo1y
20:02:08 <andythenorth> oof squirrel isn't python :)
20:02:17 * andythenorth having brains issues
20:03:58 <TrueBrain> the rebase really didn't go as it should .... so many things now broken :'(
20:04:19 <andythenorth> oof
20:06:05 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9469: Feature: servers can now set a Message Of The Day https://git.io/JRo1y
20:06:07 <TrueBrain> right, it now does what it used to do again .. :D
20:07:05 *** gelignite has quit IRC (Quit: Stay safe!)
20:07:23 <TrueBrain> https://user-images.githubusercontent.com/1663690/128927288-747303e1-eb89-410f-b38c-6d42666970dc.png
20:07:27 <TrueBrain> the last line is translatable :)
20:07:39 <DorpsGek> [OpenTTD/OpenTTD] glx22 commented on pull request #9469: Feature: servers can now set a Message Of The Day https://git.io/JRoyH
20:08:19 <DorpsGek> [OpenTTD/OpenTTD] TrueBrain updated pull request #9469: Feature: servers can now set a Message Of The Day https://git.io/JRo1y
20:09:53 <andythenorth> hmm can't see a GS method to close industry
20:10:34 <andythenorth> ok that won't be a thing
20:10:42 <TrueBrain> LordAro: you found a whitespace again?
20:10:55 <LordAro> TrueBrain: DorpsGek did :p
20:11:10 * andythenorth thinks closure is actually a bool on industries
20:11:11 <TrueBrain> to OCD or not to OCD :D :D
20:11:12 <LordAro> easy to spot in a non-html context :p
20:11:15 <andythenorth> closeit or something
20:11:27 <andythenorth> maybe only in context of monthly loop
20:11:31 <glx> GS can only unallow closure
20:11:36 <glx> with a flag
20:11:40 <andythenorth> hmm
20:11:50 <andythenorth> I can understand the implementation reasons that's not possible
20:11:51 <glx> and also production changes
20:11:53 <andythenorth> but it seems odd
20:12:31 <andythenorth> I think I need a brain wipe like in Total Recall
20:12:47 <andythenorth> I have way too much misunderstanding about intended role of GS
20:13:15 <glx> industry comportement is a newgrf thing :)
20:13:35 <glx> GS can just block some stuff, like production change and closure
20:13:39 <andythenorth> so it seems :)
20:13:57 <andythenorth> GS has almost no set methods for industry
20:14:00 <andythenorth> this is weird
20:14:42 <glx> it's intended, newgrf would probably don't like to fight with GS ;)
20:15:48 <glx> but GS can limit an industry access to a company
20:16:36 <andythenorth> so far I'm 2 / 2 on ideas that can't be done
20:17:55 * andythenorth needs new ideas
20:18:45 <glx> on the other hand GS can control town growth based on how industries are served
20:19:16 <andythenorth> I am looking at cargo monitor currently
20:19:26 <TrueBrain> I DID IT!
20:19:28 <TrueBrain> "Failed to cancel workflow. "
20:19:29 <TrueBrain> :D :D :D
20:19:34 <andythenorth> :)
20:20:06 <andythenorth> I wanted to do some other cases to stretch GS ideas
20:20:15 <TrueBrain> seems GHA broke again
20:20:24 <andythenorth> the cargomonitor and town growth are pretty much ALL GS THAT EXIST :)
20:20:27 <andythenorth> so we know those work fine
20:20:48 <andythenorth> like...there are no GS that don't use cargo monitor or town growth or both
20:21:20 <glx> 10 minutes ago based on status.github.com TrueBrain ;)
20:21:39 <glx> it's not a good day for github
20:21:47 <TrueBrain> no it is not
20:22:38 <TrueBrain> right ... that leaves 1 item on my wish-list .. auto-download BaNaNaS content when joining a server ..
20:22:47 <TrueBrain> but I am not going to do that :)
20:26:42 <andythenorth> can't reload a GS in-game yes/no?
20:26:45 <andythenorth> have to restart?
20:26:53 <glx> you have to restart
20:27:05 <andythenorth> hmm
20:27:13 <andythenorth> fun times :)
20:27:22 <TrueBrain> TrueGS, simple wrapper around VSCode in browser with a "restart" button?
20:27:43 <LordAro> oh no
20:27:46 <TrueBrain> I rather fancy how that works in TrueGRF :) Feels rather smooth :)
20:27:46 <andythenorth> I am trying a GS that detects a fault with certain types of vehicle and sends them all to depot
20:27:49 <glx> but restart in console is enough
20:28:00 <andythenorth> but it's a fucker to test because I have to build a network every time
20:28:16 <TrueBrain> just save a game, and load it again :)
20:28:20 <glx> hehe save the game and reload yes
20:28:22 <andythenorth> ok
20:28:38 <TrueBrain> GS will be like: I WAS NEVER HERE
20:29:18 <andythenorth> it's more like 'print out loads of init logging I added"
20:31:57 <andythenorth> hmm preconditions
20:32:14 <andythenorth> also I need to be in a company mode?
20:32:29 * andythenorth trying StartStopVehicle
20:33:03 <glx> GSCompanyMode() is for this case (and others)
20:35:03 <andythenorth> do I literally just call GSCompanyMode(0)?
20:35:52 *** HerzogDeXtEr has quit IRC (Read error: Connection reset by peer)
20:36:03 <andythenorth> can't find any other GS using it yet
20:38:30 <LordAro> i believe so
20:38:36 <glx> it works like GSTestMode()
20:38:40 <LordAro> not sure how you switch away from it though
20:38:47 <andythenorth> maybe it should be GSCompanyMode(GSCompany.ResolveCompanyID(COMPANY_SELF));
20:38:50 <LordAro> again, docs could do with some improvement :p
20:39:06 <glx> you don't have COMPANY_SELF in GS ;)
20:39:07 <andythenorth> well there are relatively few GS so it hasn't been worth doing
20:39:20 *** nielsm has quit IRC (Ping timeout: 480 seconds)
20:39:33 <andythenorth> is this incorrect?
20:39:33 <andythenorth> https://docs.openttd.org/gs-api/classGSCompany.html#af62358efbc24594d388048863a50e0d4
20:39:58 <andythenorth> that's for AIs?
20:40:10 <glx> but GSVehicle.GetOwner() should give you the right value
20:41:26 <glx> the doc is common to both AI and GS, so sometimes it's not accurate
20:42:03 <glx> and most of it was written when only AI existed
20:43:06 <andythenorth> https://gist.githubusercontent.com/andythenorth/66bee3c1c1481b066291fc47d5c3b440/raw/ce610cdb7bd18f30c2cbeff7560e84a6f0702ed7/gistfile1.txt
20:43:23 <andythenorth> the logging works, the start/stop does not :)
20:44:09 <andythenorth> maybe I need to call IsValidVehicle() first?
20:44:18 <andythenorth> docs say it's a precondition
20:45:24 <LordAro> no, that just means it will error if it's not true
20:45:46 <LordAro> (if you're already sure, then you don't need to check it again)
20:46:08 <andythenorth> if I log it, it's true
20:46:37 <glx> hmm you may need to store the result of GSCompanyMode()
20:47:34 <glx> like https://github.com/OpenTTD/OpenTTD/blob/b14681891dce4b0060308d6a477a22c4f0b77edd/regression/regression/main.nut#L393
20:48:18 <andythenorth> yes :)
20:48:27 <andythenorth> works
20:48:44 <andythenorth> oh my GS crashed pikka's AI
20:48:46 <andythenorth> oops
20:48:53 <andythenorth> didn't like startstop I think
20:49:21 <andythenorth> ok this can be Driver Strike GS
20:50:17 <andythenorth> I think I can check if vehicles have a town in orders
20:50:19 <glx> and https://docs.openttd.org/gs-api/classGSError.html#afc0836a3d06bd9f57cb8bad95bd1114b is your friend :)
20:52:17 <andythenorth> ok my mind is blow enough for one day
20:52:31 <andythenorth> this is a very specific kind of scripting :P
20:52:52 * andythenorth plays solitaire....again
20:54:45 <glx> btw GS are probably easier to write than AI (because you don't have to try to make money)
20:55:43 <andythenorth> GS is communist!
20:56:38 <glx> GS has free money, it can even give/steal money to/from companies
20:57:48 <andythenorth> did we have buttons in story book yet?
20:58:04 * andythenorth considers Railroad Tycoon 3 style stock trading
20:59:15 <glx> there is a GSEventStoryPageButtonClick so there should be buttons
21:19:13 *** sla_ro|master has quit IRC ()
21:21:45 *** Samu has quit IRC (Ping timeout: 480 seconds)
21:25:41 <andythenorth> night
21:25:42 *** andythenorth has quit IRC (Quit: andythenorth)
21:25:56 *** Progman has quit IRC (Remote host closed the connection)
21:45:39 *** Tirili has joined #openttd
21:54:44 <Timberwolf> Yeah there are, I use the buttons in my industry output measuring script.
21:55:30 <Timberwolf> I considered RRT style trading, dunno how to reconcile it with the game's own stock model.
22:22:00 *** Tirili has quit IRC (Remote host closed the connection)
22:23:24 *** Tirili has joined #openttd
22:28:26 *** WormnestAndroid has quit IRC (Remote host closed the connection)
22:28:40 *** WormnestAndroid has joined #openttd
22:41:42 *** Wormnest has quit IRC (Quit: Leaving)
23:30:35 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)