--- Log opened Fri Jul 06 00:00:27 2018 20180706 02:25:43-!- mattsc [~mattsc@wesnoth/developer/mattsc] has quit [Quit: So long and thanks for all the fish.] 20180706 04:35:37-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 04:35:44-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 05:42:10-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 05:42:17-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 07:56:34-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 07:56:41-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 09:15:17-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 09:15:24-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 12:46:32-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 12:46:38-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 13:36:17-!- hk238 [~kvirc@unaffiliated/hk238] has joined #wesnoth-umc-dev 20180706 14:15:12< discordbot1> Does [gold] in an event tag also include income=? or do I need to use a [modify_side] 20180706 14:19:03< discordbot1> https://wiki.wesnoth.org/DirectActionsWML#.5Bgold.5D found it. 20180706 15:17:36< hk238> hi 20180706 16:22:32< hk238> hmm so I want to create these easter egg waves I wonder if it's hard to implement 20180706 16:22:39< hk238> how do i make a goblin that has 2 traits? :o 20180706 16:23:13< Ravana_> [unit] or [modify_unit] or similar 20180706 16:31:01< hk238> I mean with lua? :o 20180706 16:56:29< Ravana_> wesnoth.wml_actions.unit then 20180706 16:56:44< Ravana_> all actionwml can be called from Lua 20180706 17:21:47< hk238> oh okay :o 20180706 17:40:23< hk238> I'd like to create an easter egg goblin wave 20180706 17:40:43< hk238> where 1 goblin spawns, it has a name "Kool Gummy Bear" and a poison spear instead of regular 20180706 17:40:53< hk238> and first time you move adjacent to the goblin he shouts "Novichok!" 20180706 17:52:05< hk238> hm can you assign a table as a key? probably not? 20180706 17:53:16< discordbot1> Tables are allowed as keys. 20180706 17:53:29< discordbot1> Quite rarely used, though. 20180706 17:54:09< hk238> interesting can the key still be accessed by it's name? 20180706 17:54:16< hk238> like with a string? 20180706 17:54:54< discordbot1> No. You seem to be fundamentally misunderstanding how tables work. 20180706 17:55:06< discordbot1> You can only access values, not keys. 20180706 17:55:26< discordbot1> To access the value, you need the corresponding key. 20180706 17:56:02< hk238> no no I mean 20180706 17:56:32< hk238> can I access the "table key" with it's string name or do I have to somehow use the actual table ? 20180706 17:56:57< discordbot1> If you have a table like t = {x = 1}, then you can write t.x, which is just alternative syntax for t["x"]. 20180706 17:57:07< hk238> yeah 20180706 17:57:18< hk238> but if x is a table? 20180706 17:57:54< discordbot1> Then the syntax to create it would be t = {[x] = 1}. 20180706 17:58:15< hk238> weird 20180706 17:58:28< hk238> hmm 20180706 17:58:55< discordbot1> And yes, if you have the table bound to a local variable called x, then you can use the table through that variable as long as it's in scope and you don't reassign it. 20180706 17:59:16< hk238> I basically got this problem that I'm too clumsy at managing these different data structures 20180706 17:59:25< hk238> well I'll make a pastebin 20180706 18:00:16< hk238> https://pastebin.com/uN7bp8nR 20180706 18:00:30< hk238> here on line 3. and 4. the "major_spawns" and "minor_spawns" are supposed to be tables 20180706 18:00:45< hk238> and I'm having trouble using the other stuff to randomly select one of them 20180706 18:00:51< hk238> so it's kind of awkward 20180706 18:01:29< hk238> but the table which is a value gets transformed to a key, which has the value of the weighted probability 20180706 18:01:43< hk238> so it probably ceases being a table at that point 20180706 18:02:32< discordbot1> In lines 3 and 4, you aren't using tables as keys. 20180706 18:02:42< hk238> nope 20180706 18:02:50< discordbot1> minor_spawns and major_spawns are values. 20180706 18:02:50< hk238> online 9 20180706 18:03:10< Ravana_> line 9 has key "key", which is string 20180706 18:03:30< hk238> right 20180706 18:03:49< hk238> I guess I actually removed that part with this version.. 20180706 18:04:37< hk238> so yeah I guess it works then 20180706 18:04:43< hk238> :D 20180706 18:04:51< hk238> there's nothing that needs to be done 20180706 18:04:58< hk238> well assuming there's no other errors 20180706 18:05:20< hk238> or does that look erroneous somehow? 20180706 18:05:56< hk238> oh wait wait 20180706 18:06:07< hk238> I guess I need to put the other functions here as well 20180706 18:06:52< hk238> https://pastebin.com/rcip7Rk4 20180706 18:07:04< hk238> so line 43. to 50. is the function being called in the other pastebin 20180706 18:07:25< hk238> here "result.key" 20180706 18:07:44< hk238> so the pointer should become a key in this table or that's sort of the idea 20180706 18:08:43< discordbot1> Right. It indeed makes result.key a key in the result table. 20180706 18:09:17< hk238> and in the previous pastebin on line 9.. it's a table 20180706 18:09:23< hk238> or is supposed to be 20180706 18:09:33< discordbot1> Your another_sort_of_keys() won't work. 20180706 18:09:39< hk238> why not? 20180706 18:09:44< discordbot1> table.sort() has no idea how to sort tables. 20180706 18:09:52< discordbot1> It can only sort numbers and strings. 20180706 18:10:14< hk238> it's actually your sort function by the way.. but I guess that doesn't help 20180706 18:10:22< hk238> :D 20180706 18:11:46< hk238> hmm is that the only problem you think there is? 20180706 18:12:10< hk238> I could solve the sorting problem by fixing that commented out sorting function I guess 20180706 18:12:28< hk238> (it has some sort of error and I didn't fix it because there was your sorting function :D) 20180706 18:12:38< discordbot1> local indexed_probabilities = map(indexed_sorted_keys, function (i,v) return v end) 20180706 18:12:58< discordbot1> This line just makes a copy of indexed_sorted_keys. It's pointless. 20180706 18:13:23< hk238> hm that's true it's missing something 20180706 18:14:29< hk238> now I don't remember what I was trying to do 20180706 18:14:31< hk238> :D 20180706 18:15:47< hk238> ahh I need to, sorry for sayign but a cigarette.. afk is much better because it doesn't promote unhealthy habits 20180706 18:20:27< hk238> rubber ducking.. so I'm converting this array which has tables, and one of the keys is pointing to table, into a table where the key is the table in the pointer, and the value is the actual probability 20180706 18:21:01< hk238> so one of the problems is that it's no longer a sorted thing, so I need to get an index somehow, so I can give it to the random function (you made) 20180706 18:21:39< hk238> so I want to make two arrays that have a corresponding order of indices 20180706 18:22:07< hk238> the difference being one has the probabilities, another one has the tables, so I can use the same index (that random selecting function returns, the one you made originally 20180706 18:23:02< hk238> but instead I'm just copying the tables to the second one, where as I actually need to use the table to retrieve the probability.. so I need add that to the anonymous function where the v is 20180706 18:24:14< hk238> so I need to replace the v with resolved_weights_table[v] 20180706 18:24:26< hk238> I think... but this doesn't work because sorting doesn't work 20180706 18:24:34< hk238> so what to do? :D 20180706 18:25:48< hk238> well I guess fixing sorting process is one option 20180706 18:26:09< hk238> another one is to make a tailored random function that takes this type of datastructure so I don't need to make any of these conversions 20180706 18:29:41< hk238> well the simplest option is probably to skip the array table transform and instead use map that way the order of the indices is preserved and everything is simpler 20180706 18:30:48< hk238> then I'll just use the index to retrieve the pointer instead 20180706 18:32:29< hk238> https://pastebin.com/XrfJ9gjb 20180706 18:32:32< hk238> better perhaps? 20180706 18:32:50< hk238> except I changed element to value only in the parameters and not in the anon function.. 20180706 18:32:54< hk238> but other than that 20180706 18:33:57< hk238> well it should work the problems are solved 20180706 18:37:20< hk238> expecting to be buried under syntax errors 20180706 18:37:21< hk238> :D 20180706 19:04:05-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 19:04:11-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 19:17:38< Ravana_> have you set up debugging functions? like can you pause execution and see what values certain table has? 20180706 19:29:47-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 19:29:53-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180706 20:16:11< hk238> no I have not sorry but maybe I should 20180706 20:16:20< hk238> also I need to go to sleep so I'll finish this version tomorrow 20180706 20:34:22-!- hk238 [~kvirc@unaffiliated/hk238] has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/] 20180706 21:32:21-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180706 21:32:27-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev --- Log closed Sat Jul 07 00:00:29 2018