--- Log opened Sat Jul 07 00:00:29 2018 20180707 02:16:57-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180707 02:17:04-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180707 04:16:04< discordbot1> if i make a change to my campaign, do I need to restart the whole game or just reload the campaign from the campaigns menu? 20180707 04:17:38< discordbot1> you need to press F5 at the main menu to reload the cache 20180707 04:18:00< discordbot1> then, if you changed WML, load the start-of-scenario save of the scenario you were working on 20180707 04:18:59< discordbot1> if you have code in separate Lua files (ie, not Lua in .cfg files inserted via [lua]), you can just use the Back to Turn n option in-game to reload the Lua without ever exiting to the main menu 20180707 04:19:25< discordbot1> If I only change WML, is the first step necessary? 20180707 04:19:37< discordbot1> yes 20180707 04:20:02< discordbot1> Thanks! 20180707 04:20:45< discordbot1> programming in WML is a pain in the ass πŸ˜› 20180707 04:22:44< discordbot1> Insinuating I should just learn LUA instead of wasting my time with WML? 20180707 04:23:05< discordbot1> in order to make a campaign, you'll need to know some WML though 20180707 04:23:05< discordbot1> Both have their places. 20180707 04:23:14< discordbot1> Didn't mean the negative connotation of insinuate! 20180707 04:23:18< discordbot1> You can't make a campaign entirely in Lua 20180707 04:23:19< discordbot1> doing events in lua is a bit blergh 20180707 04:23:32< discordbot1> But you can implement the abstract logic in Lua via stuff like custom WML tags 20180707 04:23:56< discordbot1> you can implement your own action and conditional tags 20180707 04:25:26< discordbot1> even using the [lua] tag can often make your code a lot shorter 20180707 04:26:13< discordbot1> since the syntax is a lot more compact and less unwieldy to set up complex logic with 20180707 04:35:43< discordbot1> Don't do WML, kids 20180707 04:36:39< discordbot1> Actually, I believe learning WML first is essential to learn to use Wesnoth's Lua engine correctly. 20180707 04:36:58< discordbot1> There are a few quirks of Wesnoth's design that only make sense when seen through the lens of WML. 20180707 04:37:06< discordbot1> Hm. 20180707 04:37:23< discordbot1> Any examples? 20180707 04:38:17< discordbot1> Standard filters (and WML tables in general). Image path functions. Several unit attributes not being directly modifiable through proxy unit objects. 20180707 04:39:14< discordbot1> If you saw all those through Lua first you'd assume we're crazy and that we don't know how to design a game engine. 20180707 04:39:28< discordbot1> Haha. 20180707 04:40:10< discordbot1> Well, that reminds me of one weird thing I discovered when trying to use WML filters in Lua. 20180707 04:40:47< discordbot1> Which is that if you have one tag nested inside another, you need and empty { { 20180707 04:41:18< discordbot1> space between two brackets, as if it was an empty table with subtables 20180707 04:41:20< discordbot1> that 20180707 04:41:26< discordbot1> that's { ,{ 20180707 04:41:33< discordbot1> I think or 20180707 04:42:14< discordbot1> Ah, no. 20180707 04:42:32< discordbot1> I don't quite understand why. Also if you are starting a WML filter with a "not" tag 20180707 04:42:34< discordbot1> or "and" 20180707 04:42:42< discordbot1> { { "filter_adjacent_location", { x = 4, y = 2 } } } 20180707 04:42:53< discordbot1> yep 20180707 04:43:22< discordbot1> It's technically a table containing the tag name on the first position and the children as a table on the second position. 20180707 04:43:57< discordbot1> yes, but there is an empty table before that 20180707 04:44:08< discordbot1> No, not really. 20180707 04:44:10< discordbot1> the table with content is a subtable 20180707 04:44:26< discordbot1> The surrounding brackets there describe a table that contains the [filter_adjacent_location] tag's equivalent table. 20180707 04:44:28< discordbot1> there's also this but I've never seen anyone use it https://wiki.wesnoth.org/LuaWML/Location_set 20180707 04:44:33< discordbot1> There can be more children in it. 20180707 04:44:34< discordbot1> { { "not",{ terrain="Bla } } } 20180707 04:44:40< discordbot1> for example 20180707 04:44:43< discordbot1> (Whether they be attributes or other WML tags.) 20180707 04:44:52< discordbot1> will not work if I skip the first empty table 20180707 04:45:08< discordbot1> { "not",{ terrain="Bla" } } 20180707 04:45:20< discordbot1> Yes, but the first "empty" table is not actually empty is what I'm saying. 20180707 04:45:40< discordbot1> And it can have an arbitrary number of elements since they all describe its WML children. 20180707 04:46:02< discordbot1> ah you mean it's basically { [1]={ "not",{ 20180707 04:46:10< discordbot1> This might be easier to understand if you bear in mind that [scenario] is a subtag of the root WML document. 20180707 04:46:14< discordbot1> use the wml tag metatable. lua local T = wml.tag local locs = wesnoth.get_locations(T.not { x = 1, y = 1 }) 20180707 04:46:20< discordbot1> The root WML document does not have a tag of its own. 20180707 04:47:28< discordbot1> But it can have attributes (although in practice this is never used, except in .pbl files.) 20180707 04:47:45< discordbot1> (.pbl files are freestanding WML documents where everything is in the root of the document.) 20180707 04:47:48< discordbot1> Okay... 20180707 04:49:13< discordbot1> Nice one, Vultraz. 20180707 04:49:32< discordbot1> Yeah, I think I've seen it somewhere before. 20180707 04:51:06< discordbot1> What about this one, though? 20180707 04:51:20< discordbot1> { id="cmr_info_menu", description="Mod Info", image="misc/qmark.png", synced="no", { "show_if", { { "have_unit", { lua_function="cmr_current_player_check" } } } }, (..) 20180707 04:51:55< discordbot1> here i'm forced to do the same thing if I have a wml tag going directly after another 20180707 04:52:08< discordbot1> too many brackets arund have_unit 20180707 04:52:24< discordbot1> ah no, that's because it's not the full code 20180707 04:52:58< discordbot1> Wait actually 20180707 04:53:17< discordbot1> Around it? 20180707 04:53:46< discordbot1> You mean the closing brackets? Because that seems to match. The 2 Brackets before it seem to be mandatory 20180707 04:53:52< discordbot1> oh? 20180707 04:53:53< discordbot1> πŸ€” 20180707 04:54:00< discordbot1> Yes, that's what I'm wondering about. 20180707 04:54:20< discordbot1> It's the same thing, but the explanation must be different 20180707 04:54:27< discordbot1> Unless I'm missing something. 20180707 04:54:33< discordbot1> oh well 20180707 04:54:45< discordbot1> I think I only was able to get it to work this way. 20180707 04:54:49< discordbot1> guess im mistaken 20180707 04:54:52< discordbot1> But thank you guys for your explanations. 20180707 05:21:35-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180707 05:21:41-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180707 05:57:40-!- hk238 [~kvirc@unaffiliated/hk238] has joined #wesnoth-umc-dev 20180707 06:44:34< hk238> hm 20180707 06:44:49< hk238> there maybe a problem with this table converter or at least the way I'm using it 20180707 06:44:56< hk238> Choicerer here by any chance? 20180707 06:49:07< hk238> hmm how can I print the contents of a table into console? 20180707 06:50:55< hk238> I think this error is being generated by Choicerer's table converter but I'm not sure if I'm using it incorrectly or if the table I'm passing this function is actually a table so somehow getting the contents into the console would be useful.. Print seems to give some sort of exression like 03x23523 or something 20180707 06:52:12< hk238> at least the syntax errors are gone 20180707 06:52:13< hk238> :D 20180707 06:53:01< discordbot1> To print a table, you need to manually loop over its keys and values with pairs() or ipairs(). 20180707 06:53:09< hk238> oh 20180707 06:58:44< hk238> okay so the table is correct I think it's choicerer's function that's failing to handle this table 20180707 06:59:03< hk238> I think it might be that it's an array and this function is expecting a table with keys maybe 20180707 07:00:10< hk238> oh yeah that's what it is it's doing pairs(t) that doesnt work on arrays presumably? 20180707 07:00:44< hk238> it is called table converter afterall and I'm using it on array so I guess that's the problem 20180707 07:01:43< hk238> how could I store a lua array into a WML variable and then convert it back to a lua array? 20180707 07:02:07< hk238> basically this table is in intermediate storage in WML variables and then it's used again by a lua function defined as a new turn event or something like that 20180707 07:02:43< discordbot1> pairs() does work on arrays. 20180707 07:02:53< hk238> it does? 20180707 07:02:59< hk238> hmm 20180707 07:03:06< discordbot1> It just doesn't have any guarantees about iteration order, unlike ipairs(). 20180707 07:03:51< hk238> I think the problem is with this part though and I'm assuming Choicerer's function actually works so it's just that I'm giving it wrong type of stuff 20180707 07:04:01< hk238> but the stuff is correct when I do the print values thing 20180707 07:04:21< hk238> so that means that it's meant to take tables with keys and values and Im giving it an array of arrays 20180707 07:04:52< hk238> but since Choicerer is not here to explain how to correct this I think I have to figure out another way to store this array as a WML variable any ideas about that? 20180707 07:05:37< discordbot1> I don't have time to talk, unfortunately. I'm going AFK. 20180707 07:06:01< hk238> ok np 20180707 07:08:31< hk238> I made "for_each_index" function for the looping :d 20180707 07:11:21< hk238> hmm, helper.set_variable_array 20180707 08:23:27< discordbot1> Deprecated 20180707 08:24:36< discordbot1> use wml.array_access.get 20180707 08:24:47< discordbot1> https://wiki.wesnoth.org/LuaAPI/wml 20180707 08:56:46< discordbot1> oh, nice, those are documented now. I remember the first time that and wesnoth.set_variable/wesnoth.get_variable were deprecated I switched to a previous iteration of that, and then suddenly a whole bunch of things got renamed a few months later without warning because the wml module hadn't been documented yet. 20180707 08:59:25< hk238> new map versions done just fixing this code remains but now it's time for sauna 20180707 08:59:44< hk238> thx vultraz I'll try and look into those 20180707 09:51:07< hk238> hm 20180707 09:51:27< hk238> so wml.array_access.set creates a WML variable from a lua table, basically? 20180707 09:51:43< hk238> let's see if I can make this work with that 20180707 09:55:39< discordbot1> IIRC it might need a table structured in a particular way. so depending on what you need to do, you could also call [set_variables] from lua and fill out [value] as needed. 20180707 09:57:39< hk238> https://pastebin.com/xikPeLJx 20180707 09:57:50< hk238> does this look like a proper use of "wml.array_access.set" ? 20180707 09:58:22< hk238> like I'm trying to include a key (on line 7) into the wml variable defined with the statement from line 2 to line 6 20180707 10:00:08< hk238> let's test if there's errors... 20180707 10:01:30< hk238> yes there are 20180707 10:02:11< hk238> it says WML table or scalar expected, got table 20180707 10:02:26< discordbot1> yeah 20180707 10:02:40< discordbot1> WML tables are something like: 20180707 10:03:13< discordbot1> { "tag_name", { -- tag contents } } 20180707 10:04:10< hk238> oh so the argument to wml.array_access.set needs to be a table in WML format? 20180707 10:04:17< hk238> or.. not? 20180707 10:04:26< discordbot1> yeah 20180707 10:04:45< discordbot1> it needs a table in the same format as you'd get from calling wml.array_access.get 20180707 10:04:50< hk238> mm but then this doesn't do what I'd need it to do 20180707 10:05:53< hk238> I basically need f,g such that f: lua_array β†’ wml_variable, g: wml_variable β†’ lua_array 20180707 10:06:15< discordbot1> well 20180707 10:06:39< discordbot1> you can't put multiple values into a wml variable, so it's a wml container/wml array 20180707 10:06:56< discordbot1> though maybe I'm being pedantic 20180707 10:07:17< hk238> okay then 20180707 10:07:27< discordbot1> sorry 20180707 10:07:39< hk238> so does this mean this Api doesn't contain what I'm looking for? in your opinion? 20180707 10:07:39< discordbot1> personally I got annoyed with any time I had to keep translating back and forth between WML and lua like this, so absolutely whenever possible I just define a WML tag to do what I want and otherwise work entirely in WML. 20180707 10:08:19< discordbot1> it can't convert an arbitrary lua table to WML, no 20180707 10:08:26< hk238> right okay 20180707 10:08:33< hk238> hm what to do then 20180707 10:09:06< hk238> one option would be to have lua converter that converts lua table into an arbitrary string 20180707 10:09:15< hk238> and then converts it back, so WML variables can store it as a plain string 20180707 10:09:35< hk238> and since it's a universal feature and not specific to wesnoth someone probably has done that already, which mean google might solve this problem 20180707 10:09:36< hk238> :D 20180707 10:10:11< hk238> first result seems to be close 20180707 10:11:00< hk238> yeah it seems to be using unsafe looking code but I guess it doesn't matter 20180707 10:11:26< hk238> there's even lua JSON modules might as well go with those 20180707 10:12:55< hk238> https://gist.github.com/Nunocky/cfe55241d11c085a383a1cb6a382e83a 20180707 10:13:01< hk238> there's some thing like this I wonder if that works? 20180707 10:13:25< hk238> I need short break brb mabe coffee also 20180707 10:17:21< discordbot1> an example of what I meant about using [set_variable] above: https://pastebin.com/SV0q5VqA 20180707 10:17:45< discordbot1> also { "value", { a=2, b="bye" } } being an example of a WML table. 20180707 10:17:52< hk238> right thanks for the example 20180707 10:18:33< hk238> apparently there's a whole ton of tool sfor this purpose 20180707 10:18:40< hk238> no need to reinvent the wheel 20180707 10:18:40< hk238> :D 20180707 10:25:06< hk238> https://github.com/richardhundt/lua-marshal 20180707 10:25:08< hk238> this one maybe? 20180707 10:29:09< discordbot1> I have no idea. if you're intending to distribute this as an add-on though, all WML/lua code uploaded to the official add-ons server must be under the GPL, so that might limit your options somewhat. 20180707 10:29:23< hk238> oh right I forgot about that 20180707 10:30:32< hk238> basically I just need a GPL licensed lua file which contains two functions to_string, and_back 20180707 10:30:32< hk238> :D 20180707 10:33:33< discordbot1> sounds like it. the above github link also include a C file, so I doubt it would've worked for your purposes either way though. 20180707 10:56:16< discordbot1> For the record, array_access doesn’t take a regular wml table 20180707 10:56:59< discordbot1> In c++ terms, get returns something like vector 20180707 10:57:03< discordbot1> And set takes the same 20180707 10:58:11< discordbot1> Basically just means you have stuff like table[1] = {} and table[2] = {} 20180707 11:01:22< discordbot1> as opposed to something like looks like { "tag", {}, "tag", {}} or however the hell it looks like with a WML table 20180707 11:03:33< discordbot1> so @Pentarctagon is incorrect 20180707 11:07:10< discordbot1> lua local foo = {} table.insert(foo, { some_key = "some value" }) table.insert(foo, { some_key = "another value" }) wml.array_access.set("tag", foo) 20180707 11:07:29< discordbot1> foo in this case is essentially the Lua array hk238 wants 20180707 11:08:06< discordbot1> In WML terms, this gives you the variables tag[0] and tag[1] 20180707 11:10:03< discordbot1> shouldn't it've not said it expected a WML table then? 20180707 11:10:45< discordbot1> it doesn't? 20180707 11:11:18< discordbot1> " it says WML table or scalar expected, got table" 20180707 11:11:42< discordbot1> let me see... 20180707 11:12:04< discordbot1> yeah, he's using array_access.set wrong 20180707 11:12:25< discordbot1> array_access.set sets the entire array 20180707 11:13:06< discordbot1> I'm looking at paste https://pastebin.com/xikPeLJx 20180707 11:13:19< discordbot1> I'm really not sure what he's trying to do 20180707 11:16:56< discordbot1> hk238: in that paste, this line: lua wml.array_access.set(string.format("timed_spawn[%d].pool", spawn_number - 1), pool_temp) should instead be (I think, you'll need to test to confirm) lua wml.variables_proxy[string.format("timed_spawn[%d]", spawn_number - 1)].pool = pool_temp 20180707 11:18:43< discordbot1> variables_proxy gives proxy access to the children of a WML container variable. 20180707 11:18:58< discordbot1> so if you write to pool here it will be written back to the WML automatically 20180707 11:19:41< discordbot1> though all of this begs the question why you didn't just roll the pool field into the assigned on line 2 20180707 11:29:40< hk238> hm 20180707 11:31:07< hk238> it's an array of arrays and the author of the original dark forecast scenario went through some trouble to store it as a WML variable which was a non-table but it resulted into a poorly structured code 20180707 11:31:51< hk238> so I started from that and wanted to improve the structure by making the function take an actual table, or one with indexes like an array I'm still have some trouble with whether it's supposed to be called a table or an array, anyway 20180707 11:32:07< hk238> the assumed problem is that you can't store the lua array of arrays into WML 20180707 11:32:14< hk238> and the assumed problem behind that one is 20180707 11:33:07< hk238> the execution time of some "new turn function" is different from the execution time of the "prestart" function and the lua variables in the prestart function don't have a lifetime that reaches to the new turn function 20180707 11:33:25< hk238> my first thought would juts be to use a lua array and not change it into anything 20180707 11:33:49< hk238> but if those two assumptions are correct then to get this lua table (it's a pool of units that has some information about how to upgrade the wave) 20180707 11:34:09< hk238> stored into a WML variable so that it's available to a new turn function that creates the wave of enemies 20180707 11:34:18< hk238> I was thinking about going to a fleamarket today 20180707 11:35:10< hk238> and I should leave soonish if I want to do that 20180707 11:35:30< hk238> so basically I was using the wrong command? I should be using this wml.variables_proxy , thing instead? 20180707 11:54:30< discordbot1> Variables_proxy to set an individual field in the array 20180707 11:54:38< discordbot1> Er 20180707 11:54:50< discordbot1> I mean, an individual field in one entry of the wml array 20180707 12:07:01< discordbot1> and no, ther is no function to automatically convert an array of arrays to WML 20180707 12:18:20-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180707 12:18:28-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180707 12:19:02-!- irker213 [~irker@uruz.ai0867.net] has joined #wesnoth-umc-dev 20180707 12:19:02< irker213> Vultraz: Charles Dang Shadows_of_Deception:master 5b045a5c44df / lua/ (gui/spellcasting.lua main.lua): Spellcasting: use on_event to register the spell cooldown handler https://github.com/Vultraz/Shadows_of_Deception/commit/5b045a5c44df50b9bc654d10724ff6fed87d7fe1 20180707 13:27:15< Ravana_> I think choicerer, vasya, and myself all have different functions to print/show tables 20180707 13:27:41< Ravana_> there is core function to stringify wml tables though, so if you only use that structure, you can use that 20180707 13:33:27< hk238> right okay 20180707 13:33:36< hk238> back from the flea market trip btw 20180707 13:34:06< hk238> so basically I should try and use one of these serialization methods to conver the array into a string or binary and then store that as a string into WML 20180707 13:34:39< hk238> Is it the case though that if you modify the contents of a lua variable with a function that occurs like during prestart and then try to use that variable with new turn function, it' snot possible? 20180707 13:40:19< Ravana_> if you call new turn function after prestart, then it works 20180707 13:40:44< hk238> well what am I doing with all this thing then? 20180707 13:40:44< hk238> :D 20180707 13:41:07< hk238> by default you get a prestart before new turns right? 20180707 13:41:21< Ravana_> before new turn event yes 20180707 13:41:30< Ravana_> but as function you may fire new turn at any time 20180707 13:41:39< hk238> right okay 20180707 13:41:51< hk238> I just found a solution though or chose perhaps 20180707 13:41:53< hk238> http://lua-users.org/wiki/SaveTableToFile 20180707 13:42:10< hk238> although the save to file functionality is unnecessary 20180707 13:42:17< Ravana_> why you want to covert table to wml? 20180707 13:42:19< hk238> but if it works like you say then there's no need for any of this 20180707 13:42:29< hk238> and why wouldn't it work 20180707 13:42:49< hk238> it makes wonder what the original author was thinking these WML variables seem inconvenient to use when lua is available 20180707 13:47:34< hk238> and that brings us the... next error 20180707 13:47:35< hk238> :D 20180707 13:50:15< hk238> https://pastebin.com/HeqMqfUH 20180707 13:50:23< hk238> does anything about this part look wrong at a glance or so? 20180707 13:51:01< hk238> like the choose_random_index for an example? I'm getting an error about that, but I'm not sure if the problem is with that or giving it a wrong kind of stuff yet 20180707 13:52:43< hk238> strangely this still seems to work 20180707 13:52:47< hk238> although there's the error 20180707 13:54:01< hk238> ah there's a problem somewhere 20180707 13:56:17< hk238> attempt to compare number with nil 20180707 13:56:18< hk238> :D 20180707 13:56:27< hk238> attempt to index nil value 20180707 13:56:34< hk238> well regardless of that this seems to be working 20180707 13:56:44< hk238> does lua have some issues with really small numbers btw? 20180707 13:57:43< hk238> probably not 20180707 13:57:48< Ravana_> choose_random_index doesn't do what name says 20180707 13:57:58< hk238> oh what does it do then? 20180707 13:58:15< Ravana_> it returns value 20180707 13:58:50< hk238> right that's what it' supposed to do but it's supposed to select an index out of a table by random and then return the value 20180707 13:58:56< hk238> so I should rename it I guess 20180707 13:59:16< hk238> gaussian function seems to work when testing it in console 20180707 13:59:32< hk238> maybe this weighted_random is not working 20180707 13:59:38< hk238> something produces nil 20180707 13:59:46< hk238> gaussian function returns some really small values though 20180707 14:00:01< hk238> or might return 20180707 14:04:08< hk238> how can I view WML variables in game? 20180707 14:05:02< hk238> okay I found the problem a WMl variable is set to nil where it' ssupposed to be a number 20180707 14:05:09< hk238> but that's strange because I didn't touch the part that sets it 20180707 14:05:21< Ravana_> inspect 20180707 14:08:59< hk238> now the error went away 20180707 14:09:02< hk238> but I didnt change anything 20180707 14:09:06< hk238> :D 20180707 14:09:15< hk238> oh nevermind I made a syntax error 20180707 14:15:57< hk238> all these things seem to be working 20180707 14:16:02< hk238> I don't get what produces the error 20180707 14:16:03< hk238> :D 20180707 14:16:49< hk238> it even chooses spawns from the correct pool 20180707 14:16:52< hk238> and they'r spawnign 20180707 14:16:59< hk238> but there's a mysterious error about some nil value 20180707 14:18:43< hk238> ahh I have no idea what's wrong 20180707 14:19:07< hk238> it's even working correctly kind of 20180707 14:27:40< hk238> do you need to fill array in order? 20180707 14:27:52< hk238> like I'm trying to add only some indices into an array 20180707 14:29:03< hk238> sounds like there could be some nils in between 20180707 15:08:34< hk238> in anycase this problem didn't come with the wml/lua thing but from something else 20180707 15:08:38< hk238> maybe the array index thing 20180707 15:19:39-!- irker213 [~irker@uruz.ai0867.net] has quit [Quit: transmission timeout] 20180707 16:26:09< hk238> btw Ravana_ with regards to your comment on the forums, I am using lua files 20180707 16:26:12< hk238> :o 20180707 16:26:22< Ravana_> you aren't 20180707 16:26:29< Ravana_> your image shows you evaluate Lua as string 20180707 16:26:42< hk238> okay so I'm using [lua] tags does that mean what you're saying? 20180707 16:26:50< hk238> someone suggested I start doing that instead of the dofile command I was using earlier 20180707 16:26:55< hk238> so I should go back to dofile? 20180707 16:27:06< Ravana_> yes, dofile is always better for development 20180707 16:27:20< Ravana_> and you require download anyways, so there is no real downside 20180707 16:27:26< hk238> okay thanks I'll switch back to that 20180707 16:27:34< hk238> yep that's what I thought too but then I dont understand these things 20180707 16:34:35< hk238> btw can you have multiple wesnoth.dofiles inside one lua tag? 20180707 16:34:45< hk238> also for some reason this isn't finding the file now 20180707 16:36:01< hk238> I don't get it why doesn't it find the file, the command is exactly the same 20180707 16:36:01< hk238> :D 20180707 16:36:37< Ravana_> you can 20180707 16:36:44< hk238> nvm it was a typo of course 20180707 16:36:47< hk238> okay I'll try that 20180707 16:38:28< hk238> ravana can you store values into indices out of order 20180707 16:38:41< hk238> like can you store some_table[5] = "number five" 20180707 16:38:47< hk238> without doing any of the other indices? 20180707 16:40:20< Ravana_> why are you not just trying it? 20180707 16:40:56< Ravana_> https://pastebin.com/QdtQdip1 20180707 16:42:26< hk238> sorry that's what i was doing but I dont know why it's not working so I just that might be a reason :o 20180707 16:45:43< hk238> it's so strange I don't see anything that could be causing this 20180707 16:47:20< hk238> oh you're from Estonia? 20180707 16:50:02< hk238> wml.variables["final_turn"] = final_turn 20180707 16:50:14< hk238> this should set wml variable "final_turn" as whatever final_turn is 20180707 16:50:33< hk238> and it's for an example 52 or something, but the WML variable doesn't get stored so I think it gets cleared 20180707 16:50:37< hk238> and I dont know why it gets cleared 20180707 16:50:47< hk238> it's hopeless 20180707 16:50:48< hk238> :D 20180707 16:57:59< hk238> hm 20180707 16:58:12< hk238> this is weird 20180707 16:58:26< hk238> if I dofile that contains some generic functions, are they available for the next dofile to use? 20180707 16:58:44< hk238> it saying this function isn't assigned now which is weird because it definitely is assigned it's just in a different file 20180707 16:59:02< Ravana_> if you save them in field visible for the other file 20180707 16:59:29< hk238> what does that mean? I have no idea how lua scoping works but is it that if you have code in different files it some changes the scope? 20180707 16:59:47< hk238> I was kind of thinking it's irrelevant which file they're in as long as they're executed in the correct oreder 20180707 16:59:57< Ravana_> if it is local, it usually won't be visible 20180707 17:00:01< hk238> also I found on error 20180707 17:00:10< hk238> okay so that's the problem with this 20180707 17:00:24< hk238> so i should put them in the same file as a fix? or how can I make this file visible to the other file? 20180707 17:01:05< hk238> I thought that couldn't be the reason because gaussian function was available in console 20180707 17:01:10< hk238> but I guess it is the reason after all 20180707 17:01:11< Ravana_> there is some exporting way available, haven't used, see helper how it works 20180707 17:01:30< hk238> okay thanks I think it's complicated I'll just put them in the same file and get to that later 20180707 17:01:49< hk238> although I like that kind of structure normally it's just that having separate files is not really a priority with this :D 20180707 17:02:40< Ravana_> if you want it from another file, don't make it local 20180707 17:04:30< hk238> okay 20180707 17:04:36< hk238> I merged the files and it's working again 20180707 17:04:51< hk238> that was kind of an inefficient hour++ spent on this issue 20180707 17:04:54< hk238> :D 20180707 17:16:34< hk238> Ravana_ am I still connected to the Mp server can you see me asking if I'm connected? 20180707 17:16:56< hk238> I guess I must be disconnected 20180707 17:17:55< hk238> actually I wasn't disconnected but it's kind of frustrating to wait when yo udon't know 20180707 18:19:44< discordbot1> tbh I'm still not entirely clear myself as to the difference between require and dofile 20180707 18:21:33< Ravana_> dofile executes file, but require executes file that returns something 20180707 18:22:44< discordbot1> I see πŸ€” 20180707 18:23:12< discordbot1> guess that makes sense 20180707 18:23:14< discordbot1> thanks 20180707 18:24:24< discordbot1> anyway, I've read the log and I still can't figure out what problem hk238 is trying to solve, exactly... 20180707 18:27:38< hk238> the problem is solved now, Vultraz 20180707 18:27:59< discordbot1> but did you solve it effectively πŸ˜› 20180707 18:28:56< hk238> kind of, the lua variable seems to be available to the new turn function so there's no need to convert it to WML after all 20180707 18:29:18< hk238> the other problem was that I moved generic functions such as non-scenario specific array transformation functions, map functions etc. into another file 20180707 18:29:29< hk238> and I didn't know that they're not available to the other file 20180707 18:29:46< hk238> so that was solved simply by merging the files, but I guess it would be better to use some sort of export structure 20180707 18:30:29< hk238> next up I should make a 3p version of this and write some units into the waves.. then there's also creating some easter egg wave functions 20180707 18:31:48< hk238> I wanted to create an easter egg wave with the following properties: On turn 13 if wesnoth.random() > 0.99, place a goblin on the map, name it "Kool Gummy Bear" , add poison to the spear and an event that fires only once, when the goblin attacks someone it opens up dialogue and says "Novichok!" 20180707 18:31:59< hk238> kind of morbid humour 20180707 18:32:56< hk238> maybe some cavalry wave with horsemen could be one too 20180707 18:33:54< hk238> for waves which require no special modifications to the units the code framework is already present so I can just create a table and write the units into it, then add parameters for the probabilities 20180707 18:34:42< hk238> although all the probabilities are based on gaussian function which is still kind of limited maybe poisson distribution could also be used 20180707 18:35:58< hk238> hmm that's hardly an improvement over gaussian though I guess 20180707 18:47:01< Ravana_> you only need to export them if you initially made them local 20180707 18:47:52< hk238> yeah you mentioned that already, how do I make them non-local by the way? global? 20180707 18:48:07< Ravana_> by not writing local 20180707 18:48:09< hk238> I think the export structure is good though 20180707 18:48:14< hk238> oh 20180707 18:49:09< hk238> btw any suggestions for a combination of untis for a wave? Like saurian skirmisher + thief etc 20180707 18:49:43< discordbot1> not gryphons 20180707 18:49:45< discordbot1> specifically 20180707 18:49:47< discordbot1> πŸ˜› 20180707 18:50:09< discordbot1> one of the most irritating things about the current Dark Forecast is the gryphon wave 20180707 18:51:14< hk238> oh 20180707 18:51:33< hk238> yeah mobile units are hard 20180707 18:51:58< hk238> they also have high potential hex efficiency and volatile dmg output it's hard for a survival 20180707 18:53:19< discordbot1> the rest of the spawns are somewhat annoying, since it's hard to plan for waves that spawn semi-random units in semi-random locations, but gryphons have high mobility, high potential damage output, and decent dodge pretty much everywhere. the wave spawns 4 of them, and if three decide to fly across half the map and swarm a guy, he's probably dead. 20180707 18:53:59< hk238> actually the number is not set to 4 but it's based on gold value calculation which is dependent on the turn number the wave lands on 20180707 18:54:16< discordbot1> especially since the AI doesn't much care about their gold cost and particularly keeping them alive 20180707 18:54:46< hk238> yeah gryphons are hard to deal with I agree with that 20180707 18:54:55< discordbot1> I've never seen 2 gryphons or 5 gryphons, and 3 is decidedly rarer than 4. 20180707 18:55:06< discordbot1> so in practice it's essentially 4 20180707 18:55:11< hk238> it's only because you lose too early! hahaa. 20180707 18:55:16< discordbot1> >.< 20180707 18:56:07< hk238> but you might be right that there could be a value that it attracts around due to how the spawn function works 20180707 18:56:33< hk238> there's a minimum gold cost due to a base gold parameter, and there's a certian process in which the function decides how to upgade the wave if there's left over gold 20180707 18:56:58< hk238> so it's possible it kind of is likely to end up getting more thieves or something or upgrading them into rogues instead of making 6 gryphons 20180707 18:57:34< hk238> in anycase the logic doesn't say anywhere that there should be 4 gryphons, but still you could be right, it might be an emergent feature of the parameters and stuff 20180707 18:58:11< discordbot1> there's a later wave with woses that does a similar thing 20180707 18:58:27< hk238> also the wave order is entirely random, except for the final spawns 20180707 18:58:34< discordbot1> though woses are at least easier to deal with 20180707 18:58:36< hk238> so you could have the wose wave on turn 3 or turn 43 20180707 18:58:45< discordbot1> mm 20180707 18:59:00< discordbot1> strange then 20180707 18:59:17< hk238> there are certain pseudowaves though that occur due to the upgrade process 20180707 18:59:24< hk238> for an example I think woodsman can get upgaded to a sergeant 20180707 18:59:29< hk238> so you might think they're two different waves 20180707 18:59:40< hk238> and the likelyhood of that happening would be higher the more turns has passed 20180707 19:00:07< hk238> so you might end up thinking there's a "latter wave with sergeants" while infact it's the same wave with those pesky peasants or woodsmen, whichever it was 20180707 19:00:58< discordbot1> I dunno. What I can say, is that they waves don't really "feel" completely random, at least. 20180707 19:01:30< discordbot1> I've never once gotten gryphons or woses on the first wave, for example 20180707 19:01:39< hk238> yeah you're right they're not entirely random 20180707 19:01:52< hk238> and the gold cost of gryphons and woses might play into that you're not really likely to get them early 20180707 19:01:59< discordbot1> true 20180707 19:02:16< hk238> but the mechanic for deciding which wave is selected for the spawn is entirely random, except fro the final waves 20180707 19:02:35< hk238> what the actual spawning units are is not entirely random, due to all kinds emergent phenomena 20180707 19:03:18< hk238> it just takes the number of possible spawns, gives each one a number, puts them in random order 20180707 19:03:21< hk238> and that's the order in which they spawn 20180707 19:03:36< hk238> but then they get more gold based on just chance and the number of the turn 20180707 19:03:48< hk238> the amount of gold then changes what actually spawns but that is partially random too 20180707 19:04:50< hk238> in this version I'm making it's assigning a set of pools a probability based on gaussian function, then it's comparing the probabilities of the sets and choosing randomly using those as odds 20180707 19:05:14< hk238> so you can have the same wave spawns twice and what can spawn is dependent on the number of the turn in a very complicated manner 20180707 19:05:25< hk238> but for now there's just two sets and it's really simple 20180707 19:05:48< hk238> but once there's like 5 sets of possible spawns it gets complicated and it just takes writing in what units can spawn 20180707 19:08:35< hk238> I need to go to sleep and continue with this tomorrow.. gn 20180707 19:08:43< discordbot1> cya 20180707 19:09:02-!- hk238 [~kvirc@unaffiliated/hk238] has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/] 20180707 21:47:21-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180707 21:47:28-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180707 23:00:44< discordbot1> hk, you here? 20180707 23:01:12< discordbot1> guess what, i scrolled all the way up to the beginning of your questions 20180707 23:01:27< discordbot1> and you ask how to print the contents of a table 20180707 23:01:37< discordbot1> so here's a little plug 20180707 23:01:52< discordbot1> Well, Vaysa's written a very nice table printer 20180707 23:02:21< discordbot1> https://github.com/Choicerer/Wesnoth_Randomizer/blob/master/lua/vasya_table_displayer.lua 20180707 23:02:49< discordbot1> get it from here, then you just call it by doing print_as_json(table) and open the debug window (debug -> inspect) 20180707 23:02:55< discordbot1> and click the lua console button 20180707 23:03:08< discordbot1> apparently there's also a command to access the lua console directly, but it doesn't work for me 20180707 23:03:24< discordbot1> and you get the contents of the table printed to that console 20180707 23:03:24< Ravana_> you need to have debug mode on to use lua console 20180707 23:03:33< discordbot1> wat 20180707 23:04:00< Ravana_> inspect you can use without as well, but console needs it 20180707 23:04:10< discordbot1> nope, I don't think so. 20180707 23:04:49< Ravana_> anyways, lua console default hotkey is horrible, better change it 20180707 23:05:08< discordbot1> I forget to launch wesnoth in debug with wesnoth -d too often 20180707 23:05:20< discordbot1> and then i find myself typing inspect and getting an error, because it's not on 20180707 23:05:42< discordbot1> yes, the hotkey just doesn't work for me 20180707 23:05:54< Ravana_> need to use it over [inspect] if you want it without debug 20180707 23:05:58< discordbot1> perhaps if i tried changing it, it would. but the console can be accessed from the inspect window, too. 20180707 23:06:12< Ravana_> I have it in orocias ageless unsynced menu that way 20180707 23:06:19< discordbot1> wait, what? 20180707 23:06:26< discordbot1> what do i need to use over inspect? 20180707 23:06:44< discordbot1> i guess, i should message hk directly though 20180707 23:06:57< discordbot1> or that post is gonna get lost eventually 20180707 23:07:37< discordbot1> oh, i can't cause he's on irc 20180707 23:07:46< discordbot1> well bummer. 20180707 23:09:28< Ravana_> https://github.com/ProditorMagnus/OrociaRandomMod/blob/master/lua/events.lua#L9 adding listener for menu event 20180707 23:10:06< Ravana_> and that shows me Lua _G and [inspect] https://github.com/ProditorMagnus/OrociaRandomMod/blob/master/lua/debug_functions.lua#L61 20180707 23:22:12< discordbot1> Well, I can see you're calling inspect from lua. 20180707 23:22:29< discordbot1> I've never done that. I'm talking about calling it from the command box. 20180707 23:23:30-!- Jordan [~Jordan@160.154.136.81] has joined #wesnoth-umc-dev 20180707 23:23:39-!- Jordan is now known as Guest64427 20180707 23:27:27< Ravana_> yes, if you have debug available, that way is faster 20180707 23:27:50-!- Guest64427 is now known as Jordy 20180707 23:28:35< Ravana_> and what I actually meant before was that lua console can also be called from Lua, but that only works if debug is on 20180707 23:29:02< Ravana_> so not useful to call it 20180707 23:32:49< discordbot1> I see. 20180707 23:33:45-!- Jordy is now known as Jordys 20180707 23:38:02-!- Jordys [~Jordan@160.154.136.81] has left #wesnoth-umc-dev ["Leaving"] 20180707 23:44:40-!- Jordys [~Jordan@160.154.136.81] has joined #wesnoth-umc-dev --- Log closed Sun Jul 08 00:00:30 2018