IRC logs for #openttd on OFTC at 2024-06-05
β΄ go to previous day
00:18:34 <yiffgirl> looks a lot better. could probably go even lower
00:18:34 <yiffgirl> what do you folk think?
02:02:01 *** amal[m] has quit IRC (Quit: Client limit exceeded: 20000)
02:09:15 *** ChanServ sets mode: +v tokai
02:15:03 *** Wormnest has quit IRC (Quit: Leaving)
02:16:04 *** tokai|noir has quit IRC (Ping timeout: 480 seconds)
02:25:54 *** debdog has quit IRC (Ping timeout: 480 seconds)
02:49:04 *** HerzogDeXtEr has joined #openttd
03:00:49 *** gnu_jj_ has joined #openttd
03:03:58 *** gnu_jj has quit IRC (Ping timeout: 480 seconds)
04:33:43 *** Flygon has quit IRC (Read error: Connection reset by peer)
04:43:28 <DorpsGek> - Update: Translations from eints (by translators)
05:00:46 *** XYZ has quit IRC (Ping timeout: 480 seconds)
05:26:36 <andythenorth> Should I just write my own array.find()?
05:31:40 <andythenorth> oh maybe superlib already did
05:32:01 <andythenorth> I keep forgetting that superlib has utils for common things that squirrel lacks
06:07:32 <andythenorth> hmm can't manipulate a GSList inside a loop over the list
06:22:38 *** SigHunter has joined #openttd
06:34:28 <peter1138> Iron Horse + debug build + valgrind = glacial
07:15:44 <peter1138> Hmm, forums back to being slow again.
07:20:36 *** _rei4122 has joined #openttd
07:20:36 <_rei4122> andythenorth: In most cases Squirrel, I would consider whether a table can be used instead of an array
07:20:36 <_rei4122> The consumption of ticks is probably the same whether it is an array or a table.
07:21:44 *** SigHunter has quit IRC (Ping timeout: 480 seconds)
07:27:58 *** SigHunter has joined #openttd
07:36:03 *** SigHunter has quit IRC (Ping timeout: 480 seconds)
07:47:06 *** toktik has quit IRC (Remote host closed the connection)
07:54:27 *** SigHunter has joined #openttd
08:27:50 *** Smedles has joined #openttd
08:28:21 <pickpacket> the consumption of tics, however, depends a lot on geographical location and time of year. Among other factors
08:33:27 *** SigHunter has quit IRC (Ping timeout: 480 seconds)
08:34:35 *** SigHunter has joined #openttd
08:52:14 *** SigHunter_ has joined #openttd
08:54:49 *** SigHunter has quit IRC (Ping timeout: 480 seconds)
09:17:18 <andythenorth> _rei4122: how would one find an item in the array if it was a table?
09:17:58 <andythenorth> store the values as the keys, not the values?
09:18:39 <andythenorth> also trying to access a table by integer index fails in squirrel
09:25:26 <andythenorth> peter1138: you probably have FIRS active?
09:28:59 <_rei4122> andythenorth: local a = ["A","B","C"];
09:28:59 <_rei4122> local t = {A=A,B=B,C=C};
09:32:01 <peter1138> andythenorth: No, just Iron Horse.
11:31:21 <andythenorth> I did a bad thing
11:31:23 <andythenorth> not sure what yet π
11:32:20 <andythenorth> I tried logging inside the function used by a valuator, as I don't understand what it's doing
11:32:32 <andythenorth> but seems logging can't be used inside a valuator, it crashes
11:32:42 <andythenorth> probably doing it wrong
11:51:57 <_glx_> Opcode per valuator call is inverse proportional to list length
11:53:39 <andythenorth> wonder what this will evaluate as `return industry in ::persistent_storage["owned_industries"];`
11:53:46 <andythenorth> I thought it would be a bool
11:54:23 <andythenorth> I have it as a one line function, which is used for Valuate
11:54:23 <andythenorth> industry_list.Valuate(VulcanIndustryOwnership.IsIndustryOwned);
11:54:23 <andythenorth> industry_list.RemoveBelowValue(1);
11:54:50 <andythenorth> I'm not getting results that make sense, so either IsIndustryOwned() is wrong, or bool can't be detected as int in squirrel
11:55:14 <andythenorth> logging it either crashes the valuator, or returns 0 or 1 (depending where I put the logging lines)
12:28:22 <andythenorth> ach again crashed the valuator
12:30:16 <andythenorth> I guess Valuate can't be use for lists that might have unpredictable size
12:31:53 <peter1138> Crashed, or excessive CPU usage?
12:38:37 <andythenorth> excessive CPU usage
12:41:28 <andythenorth> possibly GSLog is too expensive
12:50:49 <andythenorth> maybe Valuators don't really work
12:50:57 <andythenorth> might try just using arrays
13:08:18 <andythenorth> why is valuate so slow?
13:10:22 <andythenorth> 364 industries on the map
13:10:36 <andythenorth> valuating them with a simple function shouldn't be impossible
13:31:46 <peter1138> You definitely want to call GetIndustryType() 6 times instead of putting it in a local outside the loop.
13:32:01 <peter1138> (That won't affect much, but just generally...)
13:34:39 <Eddi|zuHause> my python brain wants to make a lamda out of that
13:34:55 <Eddi|zuHause> or a list comprehension
13:39:24 <Eddi|zuHause> ind_ids = [industries[ind_name].id for ind_name in [...]]; valuate(lambda ind: gettype(ind) in ind_ids)
13:50:28 <_jgr_> You'd probably be better off getting rid of the valuate entirely, in favour of just doing a normal loop over industry_list
14:07:44 <pickpacket> LordAro: I totally agree that four levels of parenthesis is too much for an if statement. I found it frustratingly difficult to deal with the fact that the whole thing is a negation to begin with
14:09:13 <pickpacket> I split it into multiple lines with explanatory comments when dealing with it myself. Would that be better than attempting to break it into multiple statements or even functions?
14:09:38 <peter1138> Valuate should be prefered but the instruction cost penalises it.
14:10:22 <LordAro> pickpacket: multi-line-if < multiple statements, imo
14:10:35 <LordAro> functions seems excessive, unless there are multiple places it could be used
14:28:11 <ahyangyi> Hmm, GS development sounds very *fun*
14:37:04 <andythenorth> yeah I need to stop using Valuate, I don't understand it
14:37:12 <andythenorth> and I can't log inside the function it calls
14:38:31 <andythenorth> but it....doesn't
14:38:39 <andythenorth> some industries just don't get assigned an owner
14:40:39 <andythenorth> they're removed after the first Valuate I think
14:40:48 <andythenorth> but I can't easily log
14:45:45 <_jgr_> The use of `index` is confusing here, that doesn't really look right?
14:47:39 <_jgr_> Ah, actually it's fine, I see what you are doing
14:48:24 <_jgr_> The whole thing is O(N^2) in the number of industries
14:49:09 <andythenorth> whether the industry has an owner is non-deterministic
14:49:34 <andythenorth> I have a GS button that reruns industry_list.Valuate(VulcanIndustryOwnership.IsIndustryOwned);
14:49:41 <andythenorth> the contents of the list vary between runs
14:51:03 <andythenorth> I can't figure out what the trigger is though
16:01:51 *** XYZ has quit IRC (Ping timeout: 480 seconds)
16:20:36 <peter1138> Well, how are you defining ownership?
16:32:44 *** gelignite has joined #openttd
16:41:22 *** SigHunter_ has quit IRC (Remote host closed the connection)
16:42:23 *** SigHunter has joined #openttd
16:58:53 <andythenorth> static function IsIndustryOwned(industry) {
16:58:53 <andythenorth> return industry in ::persistent_storage["owned_industries"];
16:59:22 <andythenorth> I need to write a debugger I think
16:59:34 <andythenorth> I have half of a bad one
16:59:43 <andythenorth> inspecting state is not easy
17:00:08 <andythenorth> and sometimes the bugs in my debugger compound the issue π
18:14:29 *** Wormnest has joined #openttd
18:21:51 <andythenorth> /me waiting for someone to take pity on my squirrel π
19:00:33 <ahyangyi> I'm not squirrel-literate :S
19:06:08 <andythenorth> what does a static function do vs. a function?
19:09:04 <_glx_> there's no static function in squirrel
19:09:59 <andythenorth> there's a keyword for it
19:10:03 <andythenorth> and superlib uses it a bit
19:11:05 <andythenorth> I think it possibly makes the function shared between all instances of the class?
19:11:11 <_glx_> Squirrel's classes support static member variables. A static variable shares its value between all instances of the class. Statics are declared by prefixing the variable declaration with the keyword static; the declaration must be in the class body.
19:11:12 <andythenorth> because the function is just a var in a table slot?
19:12:11 <andythenorth> I don't know what the context is for `this` here, I assumed it would be the class instance
19:12:19 <andythenorth> but it might be the caller of the function
19:13:37 <_glx_> this should be the instance, anyway I don't think `static function UpdatePage()` is valid
19:14:09 <andythenorth> GPT added some of them, I probably fed it SuperLib
19:14:23 <_glx_> and if it was, then you could not access this in it
19:17:19 <andythenorth> I've pushed proof that UpdatePage() can be accessed by the class instance
19:17:39 <andythenorth> unless the instance doesn't exist in the constructor maybe
19:22:37 *** debdog has quit IRC (Ping timeout: 480 seconds)
19:26:03 <andythenorth> had to pass the context around as a parameter
19:26:12 <andythenorth> not sure I want to know why
19:27:38 <andythenorth> I suspect the context for GrindStoryPagePersistenStorageButtonHandler will be EventManager, where it is called
19:27:59 <andythenorth> rather than the GrindStoryPagePersistentStorage class instance
19:28:19 <andythenorth> anybody else want to try writing GS? It's quite an adventure
19:32:42 <andythenorth> what do I need to do with GS dates in wallclock?
19:32:52 <andythenorth> the story page date is correct on creation
19:33:04 <andythenorth> but wrong after an update
19:33:13 <andythenorth> `GSStoryPage.SetDate(this.story_page, GSDate.GetCurrentDate());`
19:33:34 <_glx_> and it starts at 0 in wallclock
19:34:09 <andythenorth> is there a method to get the economy date?
19:34:14 <andythenorth> I saw a mode get added then removed
19:35:54 <_glx_> I though the doc was updated to tell which date was returned
19:36:23 <andythenorth> maybe it's WIP π
19:38:53 <_glx_> anyway all GSDate functions use economy time
19:39:31 <andythenorth> the StoryBook page initial date is set by OpenTTD?
19:41:43 <_glx_> SetDate and GetDate use calendar time
19:44:03 <_glx_> but there's no way to get current calendar time yet
19:44:49 <_glx_> scripts will need some API changes to support wallclock
19:47:00 <andythenorth> fair enough π
19:50:44 <andythenorth> hmm a small thing that would really help
19:50:52 <andythenorth> so we have newgrf debug
19:51:25 <andythenorth> for GS I _can_ write my own debug info, for example, to map industry IDs on the map to the industry name
19:51:39 <andythenorth> but I have to do it in story book, or flood the log with extraneous info
19:51:54 <andythenorth> and the story book is not super easy to navigate or search
19:52:14 <_glx_> squirrel has some debug mechanism, but nobody wants to write a debugger
19:52:50 <andythenorth> right now, just having the industry instance ID in the industry inspection window would be helpful π
19:53:24 <andythenorth> I can't log inside Valuate because it crashes
19:53:34 <andythenorth> so I'm having to try and inspect everything via storybook
19:53:49 <_jgr_> Putting more stuff in the existing debug windows is much easier than writing a script/Squirrel debugger
19:54:06 <andythenorth> industry type ID and instance ID would be helpful
19:54:27 <andythenorth> otherwise I have to do a story page for every industry, or one giant story page which is hard to search
19:54:45 <andythenorth> I've tried logging, but if I log with linebreaks, I run out of log and it gets cleared
19:55:17 <andythenorth> and if I log a string repr of an array, it's so wide, it takes forever to scroll horizontally, and is very hard to find the item that triggered the breakpoint
19:55:51 <andythenorth> I can log for specific industry instances to debug them, but it doesn't survive a newgame
19:57:59 <andythenorth> I guess I could patch the log scrollback locally
19:59:42 <andythenorth> I do have some things logging to storybook, but that's very slow to render the text and I got lolzed at π
20:02:46 <_jgr_> I've been a bit keen about adding stuff to the debug windows, but some stuff along these lines seems generally useful and not too objectionable for vanilla
20:03:33 <_glx_> yeah your fork has a lot more debug
20:04:50 <andythenorth> yes, these would be good
20:05:02 <andythenorth> I could switch to JGRPP alternately
20:05:50 <andythenorth> is this already a patch?
20:07:16 <_jgr_> There is no vanilla PR for it
20:09:22 <andythenorth> wonder if my jgr fork builds π
20:14:23 <andythenorth> yes there's some nice stuff there
20:14:29 <andythenorth> just the window contents is nice
20:14:44 <andythenorth> but also 'duplicate' and 'log this to console'
20:15:03 <andythenorth> wish I could duplicate the GS storybook π
20:16:22 *** gelignite has quit IRC (Quit: Stay safe!)
20:28:24 <andythenorth> yeah this is better QoL π
20:28:52 <andythenorth> Index 50, and I can see it in the Story Book
21:40:57 *** Wolf01 has quit IRC (Quit: Once again the world is quick to bury me.)
21:44:37 <andythenorth> tiny_font eh π
21:45:55 <andythenorth> think I made my industry allocator work also π
21:46:09 <andythenorth> sacked off Valuate, just used foreach
22:04:06 *** cockroach has joined #openttd
22:08:04 <cockroach> so I've been wondering, with the new wallclock time mode (I *love* it!), how do I convert seconds to months for FIRS industries? i.e. if the industry requires X crates every three months, how do I convert that to wallclock time?
22:11:36 <cockroach> is it simply the same amount of time as in the olden days? 3 minutes?
22:22:15 <Eddi|zuHause> basically, all things "economy" still work on the original timeframes
22:22:56 <Eddi|zuHause> 1 month ~ 1 minute
22:22:56 <cockroach> ah ok. so it's just the world (new vehicles & stuff) that's ticking slower.
23:33:14 <talltyler> cockroach: The new βindustry cargo scaleβ setting does change the time scale of FIRS, e.g. if you set the scale to 50% the industry will require engineering supplies every 6 months/minutes.
continue to next day β΅