Minetest logo

IRC log for #minetest, 2017-11-15

| Channels | #minetest index | Today | | Google Search | Plaintext

All times shown according to UTC.

Time Nick Message
00:13 EvergreenTree joined #minetest
00:21 lumberJ joined #minetest
00:37 troller joined #minetest
00:37 YuGiOhJCJ joined #minetest
00:38 sovetskiy joined #minetest
01:05 nowhere_man joined #minetest
01:17 redblade7 joined #minetest
01:37 lumberJ joined #minetest
02:10 AntumDeluge joined #minetest
02:27 bas080 joined #minetest
02:31 EvergreenTree joined #minetest
02:31 turtleman joined #minetest
02:58 Ozzie joined #minetest
02:58 Ozzie Hello?
02:59 craigger joined #minetest
03:21 ssieb joined #minetest
03:45 swift110 joined #minetest
05:05 YuGiOhJCJ joined #minetest
05:39 bas080 joined #minetest
05:58 torgdor joined #minetest
06:19 swift110 joined #minetest
06:43 nowhere_man joined #minetest
06:51 YuGiOhJCJ joined #minetest
07:19 aheinecke joined #minetest
07:27 CWz joined #minetest
07:37 blaise joined #minetest
08:21 Darcidride joined #minetest
08:33 jluc joined #minetest
08:52 Tazy joined #minetest
08:54 lisac joined #minetest
09:13 YuGiOhJCJ joined #minetest
09:19 bas080 joined #minetest
09:29 YuGiOhJCJ joined #minetest
09:35 YuGiOhJCJ joined #minetest
09:38 Someguy123 joined #minetest
09:58 jluc joined #minetest
10:15 ensonic joined #minetest
10:20 bas080 joined #minetest
10:20 troller joined #minetest
10:36 stormchaser3000 joined #minetest
10:38 YuGiOhJCJ joined #minetest
10:42 Jordach joined #minetest
10:49 bigcalm joined #minetest
10:50 troller joined #minetest
11:25 Tux[Qyou] joined #minetest
11:32 Fixer joined #minetest
11:45 sovetskiy joined #minetest
11:54 deltasquared joined #minetest
11:57 troller joined #minetest
13:06 pitchum joined #minetest
13:08 EvergreenTree joined #minetest
13:14 zyabin101 joined #minetest
13:17 VargaD joined #minetest
13:23 CWz joined #minetest
13:49 ImNotHere joined #minetest
13:56 jluc joined #minetest
14:03 ThomasMonroe joined #minetest
14:06 Savage3lla joined #minetest
14:07 Someguy123 joined #minetest
14:23 VargaD joined #minetest
14:29 antims joined #minetest
14:31 Someguy123 joined #minetest
14:33 xmith joined #minetest
14:47 troller joined #minetest
14:53 Patrykcraft1223 joined #minetest
14:55 Patrykcraft1223 hi
14:59 Patrykcraft1223 joined #minetest
15:01 neinwhal joined #minetest
15:13 troller joined #minetest
15:15 CalebDavis joined #minetest
15:55 Billre joined #minetest
16:10 Hackberry joined #minetest
16:25 Wuzzy joined #minetest
16:31 swift110 joined #minetest
16:36 YuGiOhJCJ joined #minetest
16:37 YuGiOhJCJ joined #minetest
16:49 Darcidride joined #minetest
16:50 lisac joined #minetest
16:53 YuGiOhJCJ joined #minetest
17:08 CWz joined #minetest
17:17 Enricoo joined #minetest
17:28 EvergreenTree joined #minetest
17:29 YuGiOhJCJ joined #minetest
17:34 Krock joined #minetest
17:46 GreenDimond joined #minetest
17:47 GreenDimond I am messing with time stuff, and it isnt working.
17:47 GreenDimond https://gist.github.com/GreenXenith/b44b8caca5b0dbd0cee31f5995cd4647
17:48 GreenDimond I made a command to check `nextmin` output, but it returns `nil`.
17:48 GreenDimond Any idea why?
17:48 sfan5 because you define it without assigning a value
17:49 GreenDimond nextmin? Well, I thought I wanted it to be blank so I could assign it inside the function.
17:51 GreenDimond what would I assign it to instead, sfan5?
17:51 sfan5 i don't know, it's your code
17:52 GreenDimond sfan5: Um? I want nextmin to be minute + 1 if second > 40 blablabla its in the addmin function. How do I set a variable to that?
17:53 sfan5 you just do it?
17:53 GreenDimond I didnt think you could put if statements in variables?
17:54 sfan5 you can't
17:54 GreenDimond exactly
17:54 GreenDimond I dont get why you dont get what I am asking
17:54 GreenDimond xD
17:54 sfan5 just put an if statement there that does what you described
17:54 GreenDimond what do I set nextmin to in order for the addmin function to work though?
17:55 GreenDimond oh
17:55 GreenDimond wait
17:55 GreenDimond do I even need the function()?
17:56 GreenDimond sfan5: updated gist.
17:58 bas080 joined #minetest
18:13 Wuzzy hi all
18:14 Wuzzy How can I detect in Lua if any given pos is part of a forest (from the mapgen's view) in v6?
18:14 Wuzzy or jungle, or tundra, or taiga, …
18:16 YuGiOhJCJ joined #minetest
18:18 Tuxedo[Qyou] joined #minetest
18:18 sfan5 i don't think the mapgen exposes any biome data
18:21 Wuzzy i am confident you could do some perlin magic here
18:21 Wuzzy i mean, the mapgen perlin noises *are* exposed
18:21 Wuzzy e.g. the v6 tree noise
18:22 Wuzzy I *think* i could use this noise to calculate for any given pos if its in a forest or not
18:22 sfan5 well you can copy the biome decision code from the mapgen
18:22 Wuzzy :(
18:22 Wuzzy can't i just use the noise data somehow?
18:23 sfan5 that's essentially what you'd be doing
18:23 Wuzzy lol
18:24 Wuzzy should be relatively safe, i guess?
18:24 Wuzzy since v6 is rarely changed
18:24 Wuzzy also, why does mapgen *still* not expose biomes, heat, humidity anyway? :( this info is inredibly important
18:25 Wuzzy or is it already done for future 0.5.0?
18:26 sfan5 ask paramat
18:27 Jousway joined #minetest
18:29 Darcidride_ joined #minetest
18:30 xmith joined #minetest
18:32 Krock related, Wuzzy: https://github.com/minetest/minetest/pull/6455
18:39 imr joined #minetest
18:39 imr joined #minetest
18:39 xmith joined #minetest
18:42 Telesight joined #minetest
18:42 ssieb joined #minetest
19:00 YuGiOhJCJ joined #minetest
19:07 GreenDimond joined #minetest
19:08 GreenDimond n00b question: How do I give a node a local variable that can be accessed from any function within the node?
19:09 Krock that's called metadata
19:09 GreenDimond oh.
19:09 Krock https://github.com/minetest/minetest/blob/master/doc/lua_api.txt#L1772
19:10 GreenDimond so I cant just use a variable.
19:10 Krock if it was an entity, then you could. however, doesn't work for nodes
19:10 GreenDimond ah, ok.
19:10 GreenDimond so if I wanted a variable that is an integer, I would use meta:set_int instead?
19:11 Krock yes. but that'll be a fake integer, as it's stored as a string FYI
19:11 GreenDimond Is there a better way then?
19:11 Krock no
19:11 GreenDimond ok
19:11 GreenDimond should still work anyway
19:11 GreenDimond ty :D
19:11 Krock !next
19:11 MinetestBot Another satisfied customer. Next!
19:15 AlexYst joined #minetest
19:16 YuGiOhJCJ joined #minetest
19:21 GreenDimond ok new problem. I get an `invalid position (expected table got userdata)` error when placing the node (it sets metadata on_place).
19:22 GreenDimond do I need to move it to after_place_node or is something else wrong?
19:23 Krock yes, use after_place_node to ensure the meta reference is already there
19:23 GreenDimond oh, ok :)
19:24 Krock or also on_construct
19:25 Krock on_place is triggered when you click. on_construct + after_place_node are called from a node that already exists on the map
19:25 GreenDimond I already have an after_place_node, so ill just put it in that.
19:27 swift110 joined #minetest
19:31 bas080 joined #minetest
19:39 Tuxedo[Qyou] joined #minetest
20:01 deltasquared joined #minetest
20:58 GreenDimond joined #minetest
20:59 AntumDeluge joined #minetest
20:59 GreenDimond My node is supposed to get the current os second and minute after_place. It does, but if I dig the node and place it again, it thinks it's still that same second and minute, even though it isn't.
21:00 deltasquared GreenDimond: you're not storing any values or state outside of the callback function are you?
21:01 GreenDimond um
21:01 GreenDimond I set `local minute = tonumber(os.date("%M"))` outside the node
21:01 GreenDimond ill paste my code
21:02 deltasquared GreenDimond: if it's "outside" that's probably your problem, the minute value would be set once when that was ran and not changed thereafter
21:03 deltasquared is there any reason you can't shove that inside on_dig() itself?
21:03 GreenDimond https://gist.github.com/GreenXenith/37c00bf410e1c0338e76c09d20d7843d
21:04 deltasquared GreenDimond: yep. I can kinda see how you might have gotten into this situation. thing to remember is that the actual file is only run once
21:04 GreenDimond Is there a way I can keep the variables outside the function?
21:04 deltasquared GreenDimond: why would you need to
21:05 GreenDimond Ease of code
21:05 deltasquared I mean there is, but it'd be easier to move them inside, it won't break anything.
21:05 GreenDimond Um
21:05 GreenDimond there are multiple functions that use those
21:05 deltasquared GreenDimond: if you move those lines verbatim inside the function it'll get called every time, it'll work
21:05 deltasquared let's try another way, why would it *not* work? (stick with me here)
21:06 deltasquared let us find your assumption here
21:06 GreenDimond I would think it wont work because it's local
21:06 GreenDimond thats usually my problem
21:06 GreenDimond and because its local it gets called and set once, and doesnt get set again.
21:06 sfan5 that's not what "local" means
21:07 deltasquared sfan5: oh good, backup arrived ;)
21:07 GreenDimond I know thats not what it means
21:07 GreenDimond but thats what usually happens to me xD
21:07 deltasquared GreenDimond: weeeellll technically the reason the local is only set once *here* is because it's in the "scope" of the file, and the file is only executed once.
21:08 deltasquared but you pass a function as a callback, so *that* will get run on every node dig
21:08 GreenDimond So I am pretty much forced to put them inside the node callbacks
21:08 deltasquared so everything inside the function will be repeated. including the creation of the variables by calling the tonumber(os.date(...)) bits
21:08 GreenDimond yippee
21:08 sfan5 >but thats what usually happens to me xD
21:08 sfan5 that's not how programming works
21:09 sfan5 computers are deterministic
21:09 sfan5 either you do it correctly and it works everytime, or you don't and it won't work
21:09 GreenDimond Thats not what I meant...
21:09 GreenDimond I meant that I usually use the local incorrectly or not at all so it doesnt work
21:10 deltasquared hmm. have you read any lua programming guides? I'm not going to lie, but with all due respect if this causes you problems then you're going to have a bad time further down the line
21:10 GreenDimond I have read plenty :/
21:10 GreenDimond And I have modded plenty :/
21:11 sfan5 read but not understood apparently
21:11 GreenDimond ^
21:11 deltasquared agreement came from the horse's mouth, as it were :P
21:11 GreenDimond I get what local means. I dont get why it usually trips me up.
21:12 GreenDimond local things stay inside whatever function/file they are in, and cannot be called outside of that.
21:12 deltasquared to be fair, where and when things get evaluated used to cause me a bit of trouble.
21:12 sfan5 inside whatever scope they are declared in*
21:13 deltasquared GreenDimond: if it helps, as a general rule of thumb, question yourself whenever you try to write "local ... " outside of a function.
21:14 ruskie joined #minetest
21:14 GreenDimond unless it's something like a table?
21:14 GreenDimond like `local modname = {}`?
21:14 sfan5 yes that's fine
21:14 GreenDimond ok good
21:15 GreenDimond Good news, the node is properly finding the correct second. Bad news, my other problem which I am not going to mention yet is still not solved >:/
21:15 deltasquared "not going to mention yet" will trigger my xyproblem detects something fierce
21:15 deltasquared *detectors
21:16 AlexYst joined #minetest
21:16 GreenDimond I have been having a problem that I set up some debug outputs for, and the debug outputs dont agree with a command I made to check the same thing in-game.
21:17 deltasquared what is being output in this case? a calculated value from somewhere I would assume, or maybe something returned from an API call
21:18 GreenDimond ill show you the code
21:18 GreenDimond mind you, it is very very messy right now with commented out stuff and debugs all over the place.
21:18 GreenDimond https://gist.github.com/GreenXenith/edf7e579fcd9166f70a7c666eef65e59
21:19 deltasquared sfan5: I have to admit I was not expecting to wind up the friendly neighbourhood programming homework assistant this evening, but here we are :P
21:20 GreenDimond line 128-139 is where I am having the problem, of which output conflicts with the output of the command on line 398-407.
21:20 GreenDimond And this is not homework ;P
21:22 GreenDimond The debug returns that it was filled, so sets to filled = true. however, the command in-game returns filled = false
21:23 GreenDimond Oh, I suspect that will all be very hard to understand, as I am in the middle of transitioning the entire thing from manual commands to automated with times.
21:24 deltasquared well for starters stat_placed I would have returned from check_stats_has_placed() instead of assigning to file-scope globals
21:25 deltasquared right, so attribute calls... not used that myself but whatever... *incoherent mumbling while reading*
21:26 GreenDimond I am not worried about the file-scope globals right now, they work for the time being and will be removed later anyway.
21:26 deltasquared hmm, for some reason I don't think that's quite how... *reads docs*
21:27 GreenDimond quite how what works?
21:27 GreenDimond I assure you, all this code worked fine when it was manual commands.
21:27 deltasquared oh granted, as a data passing mechanism it works in this case, but it triggers alarm bells.
21:27 deltasquared the globals I mean
21:27 kaeza joined #minetest
21:29 deltasquared I'm failing to see how 128-139 in on_construct and that registered chat command have anything to do with each other.
21:30 GreenDimond oh
21:30 GreenDimond my bad, was thinking about my previous problem, I meant line 176.
21:31 GreenDimond 169-177
21:31 GreenDimond no
21:31 GreenDimond arg
21:31 GreenDimond yes, 169-177, line 172.
21:31 GreenDimond line 172 is the output that conflicts
21:32 GreenDimond somehow the placer has the filled attr, but the command says otherwise.
21:32 deltasquared well first off on line 169 I think you may have made a mistake in calling get_attribute. look closely, and at the documentation for it
21:33 GreenDimond hmm
21:33 deltasquared if that's supposed to be set_attribute I don't think it works how you think it does even then, set_attribute() doesn't return anything.
21:33 GreenDimond no its not supposed to be
21:33 GreenDimond 169 is get_att
21:33 deltasquared get_attribute only has one argument.
21:33 deltasquared idk what would happen, my guess is that the second arg would be ignored
21:34 deltasquared or rather, it's only supposed to have one argument
21:34 GreenDimond hmmm
21:34 GreenDimond so
21:34 deltasquared I think what it was supposed to be is "if placer:get_attribute(...) == "true" then ... "
21:34 GreenDimond I would need `if minetest.is_yes(placer:get_attribute("filled")`
21:35 GreenDimond ))*
21:35 deltasquared I guess. though I would wonder if there was a more elegant way of storing a yes/no inside a needs-to-be-a-string field here
21:35 deltasquared I would probably make it so it's a single-char string to mean true, and non-existant for false
21:36 deltasquared and don't care about the actual string contents, as long as it's there
21:36 GreenDimond I dont mind my current method
21:36 deltasquared tell that to your potential maintainers ;)
21:36 GreenDimond I plan to maintain this as long as possible xD
21:36 deltasquared bar that though, yes what you suggested should work.
21:37 GreenDimond testing...
21:37 kaeza it's more clear to use `is_yes`, than a non-empty/empty string test
21:38 kaeza or whatever
21:38 kaeza anyway, hi
21:38 GreenDimond woah
21:38 kaeza haow
21:38 GreenDimond so far, 'tis working methinks
21:38 deltasquared kaeza: POPOZAO!
21:38 deltasquared ahem.
21:39 kaeza the what
21:39 GreenDimond so now it fills
21:40 GreenDimond but I suspect I have another get_att problem cuz' it aint reseting the player att filled
21:42 deltasquared time to go scrutinise it a bit then ;)
21:42 deltasquared "left as an exercise for the reader", as it were
22:13 xmith joined #minetest
22:26 EvergreenTree joined #minetest
22:32 xmith joined #minetest
22:34 AlexYst joined #minetest
23:19 MinetestBot [git] DTA7 -> minetest/minetest_game: Add nil checks for placer a2d7678 https://git.io/vF1oc (2017-11-15T23:16:28Z)
23:52 swift110 joined #minetest

| Channels | #minetest index | Today | | Google Search | Plaintext