--- Log opened Wed Sep 16 00:00:36 2015 20150916 00:16:29-!- wedge009 [~Thunderbi@60-241-236-92.static.tpgi.com.au] has quit [Quit: wedge009] 20150916 00:18:09-!- prkc [~prkc@catv-89-134-159-103.catv.broadband.hu] has quit [Remote host closed the connection] 20150916 00:19:48-!- janebot__ [~Gambot@grickit.us] has joined #wesnoth-dev 20150916 00:20:52-!- Jetrel [~Jetrel@c-73-228-139-39.hsd1.mn.comcast.net] has joined #wesnoth-dev 20150916 00:21:25-!- aeonchil1 [enchilado@defocus/yummy/enchilado] has joined #wesnoth-dev 20150916 00:21:37-!- Jetrel__ [~Jetrel@c-73-228-139-39.hsd1.mn.comcast.net] has quit [Read error: Connection reset by peer] 20150916 00:21:38-!- janebot_ [~Gambot@grickit.us] has quit [Remote host closed the connection] 20150916 00:21:38-!- heirecka [~heirecka@exherbo/developer/heirecka] has quit [Ping timeout: 268 seconds] 20150916 00:21:38-!- aeonchild [enchilado@defocus/yummy/enchilado] has quit [Ping timeout: 268 seconds] 20150916 00:23:47-!- heirecka [~heirecka@j61898.servers.jiffybox.net] has joined #wesnoth-dev 20150916 00:23:47-!- heirecka [~heirecka@j61898.servers.jiffybox.net] has quit [Changing host] 20150916 00:23:47-!- heirecka [~heirecka@exherbo/developer/heirecka] has joined #wesnoth-dev 20150916 00:24:19-!- wedge009 [~Thunderbi@60-241-236-92.static.tpgi.com.au] has joined #wesnoth-dev 20150916 00:24:36-!- aeonchil1 is now known as aeonchild 20150916 00:28:46-!- aeonchild [enchilado@defocus/yummy/enchilado] has quit [Ping timeout: 240 seconds] 20150916 00:30:08-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20150916 00:30:16-!- danni_ [~quassel@adsl-au-4-115.ozonline.com.au] has joined #wesnoth-dev 20150916 00:31:30-!- Soliton [~Soliton@wesnoth/developer/soliton] has quit [Disconnected by services] 20150916 00:31:38-!- Soliton [~Soliton@wesnoth/developer/soliton] has joined #wesnoth-dev 20150916 00:36:04-!- Netsplit *.net <-> *.split quits: danni, avtobiff 20150916 00:37:56-!- aeonchild [enchilado@defocus/yummy/enchilado] has joined #wesnoth-dev 20150916 00:42:28-!- halfspiral [~halfspira@162.211.218.252] has joined #wesnoth-dev 20150916 00:42:28-!- avtobiff [~avtobiff@213.112.50.80] has joined #wesnoth-dev 20150916 00:50:11-!- iceiceice [~chris@ext-74.ias.edu] has joined #wesnoth-dev 20150916 00:50:11-!- iceiceice [~chris@ext-74.ias.edu] has quit [Changing host] 20150916 00:50:11-!- iceiceice [~chris@wesnoth/developer/iceiceice] has joined #wesnoth-dev 20150916 00:51:45-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 01:09:15< celticminstrel> I see two C++ ActionWML tags that use nested tags with ActionWML... but where's the handling for menuitems and events... 20150916 01:10:15< celticminstrel> Ah, they call [command] more directly. 20150916 01:12:18-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20150916 01:12:38-!- stikonas [~gentoo@wesnoth/translator/stikonas] has quit [Quit: Konversation terminated!] 20150916 01:19:23-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 01:20:31< celticminstrel> It looks like it would be a lot of work to get the C++ code to check values returned by a WML action function, because luaW_pcall is hard-wired to discard any returned values. 20150916 01:21:07< celticminstrel> So if I want to implement [break] and [continue] in the preferred way, I'd have to port [message] and [object] to Lua. 20150916 01:22:06-!- irker099 [~irker@uruz.ai0867.net] has joined #wesnoth-dev 20150916 01:22:06< irker099> wesnoth: Ignacio R. Morelle wesnoth:master 00b3c7b214f8 / src/game_state.cpp: Code style and spelling fixes http://git.io/vZbEd 20150916 01:23:55-!- Jozrael [~Jozrael@192.91.144.19] has quit [] 20150916 01:28:09-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20150916 01:30:18-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20150916 01:47:45< celticminstrel> OR duplicate all the code in run_wml_action and luaW_pcall. 20150916 01:55:37< irker099> wesnoth: Ignacio R. Morelle wesnoth:master 424d1e45ff3f / src/serialization/ (ucs4_convert_impl.hpp unicode.hpp unicode_cast.hpp unicode_types.hpp): Doxygen fixes http://git.io/vZbVQ 20150916 01:56:31-!- jinblack [~jinblack@128.111.48.6] has quit [Remote host closed the connection] 20150916 02:01:03< celticminstrel> In the Lua GUI2 API, it's not possible to handle double-clicks, right? 20150916 02:16:35-!- aeonchild [enchilado@defocus/yummy/enchilado] has quit [Disconnected by services] 20150916 02:17:39< irker099> wesnoth: Ignacio R. Morelle wesnoth:master 7dd19632732a / src/ (play_controller.cpp play_controller.hpp): Doxygen or code formatting fixes http://git.io/vZbKF 20150916 02:20:55-!- aeonchil1 [enchilado@defocus/yummy/enchilado] has joined #wesnoth-dev 20150916 02:21:00-!- Appleman1234 [~Appleman1@KD106161092102.au-net.ne.jp] has quit [Ping timeout: 272 seconds] 20150916 02:23:20< irker099> wesnoth: Ignacio R. Morelle wesnoth:master b2900a310a24 / src/server/game.cpp: Comment spelling or formatting fixes http://git.io/vZb69 20150916 02:23:23< irker099> wesnoth: Ignacio R. Morelle wesnoth:master 928b6e800890 / src/ (replay.cpp scripting/game_lua_kernel.cpp scripting/lua_gui2.cpp): Comment spelling fixes http://git.io/vZb6H 20150916 02:26:10-!- jinblack [~jinblack@wsip-174-75-64-82.sb.sd.cox.net] has joined #wesnoth-dev 20150916 02:26:19-!- aeonchil1 [enchilado@defocus/yummy/enchilado] has quit [Ping timeout: 252 seconds] 20150916 02:28:10-!- Netsplit *.net <-> *.split quits: halfspiral, avtobiff 20150916 02:28:22-!- Netsplit over, joins: halfspiral 20150916 02:31:10-!- jinblack [~jinblack@wsip-174-75-64-82.sb.sd.cox.net] has quit [Ping timeout: 246 seconds] 20150916 02:32:19-!- mjs-de [~mjs-de@x4db5b1bb.dyn.telefonica.de] has joined #wesnoth-dev 20150916 02:33:49-!- enchilado [enchilado@gateway/shell/blinkenshell.org/x-odyhgzxbtxnvslye] has joined #wesnoth-dev 20150916 02:34:15-!- avtobiff [~avtobiff@c-503270d5.015-6-73746f28.cust.bredbandsbolaget.se] has joined #wesnoth-dev 20150916 02:34:40-!- enchilado [enchilado@gateway/shell/blinkenshell.org/x-odyhgzxbtxnvslye] has quit [Changing host] 20150916 02:34:40-!- enchilado [enchilado@defocus/yummy/enchilado] has joined #wesnoth-dev 20150916 02:34:43-!- enchilado is now known as aeonchild 20150916 02:44:01-!- jinblack [~jinblack@jinblack.it] has joined #wesnoth-dev 20150916 02:51:24-!- jinblack [~jinblack@jinblack.it] has quit [Ping timeout: 264 seconds] 20150916 02:52:21-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 02:53:43-!- noy [~Noy@wesnoth/developer/noy] has quit [Client Quit] 20150916 03:01:42< celticminstrel> The code for [message] is actually spread out over a lot of different places... and if this tag is ported to Lua, two whole GUI2 dialogs will be removed. 20150916 03:03:00< celticminstrel> Assuming the whole thing is ported. It's probably possible to only partially port it, but then the question is... which part to shove into the Lua API so that it doesn't need to be ported? 20150916 03:03:49< celticminstrel> gui2::show_wml_message? Or ::message_user_choice? 20150916 03:04:06< shadowm> The UI can't be moved out of the engine, obviously, but the unit selection logic might be a possible candidate if we must do this? (Why must we do this anyway?) 20150916 03:04:25< celticminstrel> Unit selection? 20150916 03:04:36< shadowm> Yes, unit selection. 20150916 03:04:38-!- jinblack [~jinblack@jinblack.it] has joined #wesnoth-dev 20150916 03:04:42< celticminstrel> This is related to one way of implementing [break] and [continue]. 20150916 03:04:45< shadowm> As in, selecting a unit. 20150916 03:05:44< celticminstrel> The implementation would modify certain WML tag handler functions to return a value, but on the C++ side it's set up to be almost impossible to do this. 20150916 03:06:14< shadowm> The code needs to select a unit to decide where to scroll to, what unit to display on the sidebar, what portrait and caption to show... 20150916 03:06:21< celticminstrel> [message] and [object] are the only C++ tags that are affected (because they contain subtages that contain further ActionWML). 20150916 03:06:37< shadowm> I've been wanting a way to alter the unit selection algorithm from Lua without having to pre-parse the whole thing. 20150916 03:07:07< celticminstrel> I can't think of any other ways to implement [break] and [continue] other than the one I already did or something using error()/pcal(), which with the current setup will mess up your error messages. 20150916 03:07:12< celticminstrel> ^pcall 20150916 03:07:36< celticminstrel> Frankly I think the pcall() method is the objectively best method, if the stack trace issue can be solved. 20150916 03:07:53 * shadowm doesn't know that much sadly. 20150916 03:08:48< celticminstrel> I think solving the stack trace issue would mean altering how the C++ code deals with Lua errors. 20150916 03:09:09< celticminstrel> Actually, this issue theoretically could already exist in user code. 20150916 03:09:33-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has quit [Ping timeout: 255 seconds] 20150916 03:11:33-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has joined #wesnoth-dev 20150916 03:14:13< celticminstrel> If only the UI is left in the engine, then the message_user_choice struct is part of what needs to be ported... 20150916 03:14:53-!- Turuk [~Turuk@wesnoth/forum-moderator/turuk] has quit [Ping timeout: 256 seconds] 20150916 03:15:11-!- jinblack [~jinblack@jinblack.it] has quit [Ping timeout: 264 seconds] 20150916 03:18:10-!- Appleman1234 [~Appleman1@KD111239020099.au-net.ne.jp] has joined #wesnoth-dev 20150916 03:19:21-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 03:20:43-!- Turuk [~Turuk@cpe-174-97-3-219.cinci.res.rr.com] has joined #wesnoth-dev 20150916 03:21:07-!- Turuk is now known as Guest37443 20150916 03:21:09-!- noy [~Noy@wesnoth/developer/noy] has quit [Client Quit] 20150916 03:22:10-!- [Relic] [~Relic]@2602:306:33a3:6d30:a0a3:d87f:f1d1:7633] has quit [Quit: I press the magic X and all the weirdos go away!] 20150916 03:27:05-!- Guest37443 is now known as Tyuruk 20150916 03:27:51-!- Tyuruk [~Turuk@cpe-174-97-3-219.cinci.res.rr.com] has quit [Changing host] 20150916 03:27:51-!- Tyuruk [~Turuk@wesnoth/forum-moderator/turuk] has joined #wesnoth-dev 20150916 03:28:32-!- Tyuruk is now known as Turuk 20150916 03:29:11-!- Turuk [~Turuk@wesnoth/forum-moderator/turuk] has quit [Quit: Leaving] 20150916 03:30:21-!- jinblack [~jinblack@wsip-174-75-64-82.sb.sd.cox.net] has joined #wesnoth-dev 20150916 03:31:00< celticminstrel> This page vaguely implies that the syntax can only be used in the campaign difficulty_descriptions attribute, but I'm pretty sure it applies to menus in general... however, to me, the semicolon doesn't make sense as a general menu syntax since for the difficulty_descriptions it's actually separating different menu options. 20150916 03:31:04< celticminstrel> Can anyone explain this to me? 20150916 03:31:10< celticminstrel> (The page in question: http://wiki.wesnoth.org/DescriptionWML ) 20150916 03:48:39-!- jinblack [~jinblack@wsip-174-75-64-82.sb.sd.cox.net] has quit [Ping timeout: 244 seconds] 20150916 03:51:07-!- kinow [~kinow@apache/committer/kinow] has quit [Quit: Leaving] 20150916 04:04:34-!- genbattle [~genbattle@182.16.153.90] has quit [Read error: Connection reset by peer] 20150916 04:05:16-!- genbattle [~genbattle@182.16.153.90] has joined #wesnoth-dev 20150916 04:17:14< Nivag> Roger I might be interviewing 1 or 2 potential software developers soon. We may need to get an office from somewhere! 20150916 04:18:03< Nivag> wrorte my first PostgreSQL functions & operators yesterday! 20150916 04:18:28< Nivag> sorry, wrong channel! 20150916 04:18:45-!- jinblack [~jinblack@ip184-187-174-106.sb.sd.cox.net] has joined #wesnoth-dev 20150916 04:46:18-!- Shackra [~Jorge@186.177.2.148] has quit [Ping timeout: 255 seconds] 20150916 05:05:18-!- Kwandulin [~Miranda@p5B0098A5.dip0.t-ipconnect.de] has joined #wesnoth-dev 20150916 05:12:40-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has joined #wesnoth-dev 20150916 05:22:10-!- jinblack [~jinblack@ip184-187-174-106.sb.sd.cox.net] has quit [Ping timeout: 240 seconds] 20150916 05:24:32< celticminstrel> Well, here's a possible (untested) implementation of [message] in Lua. It probably uses a few things that don't exist (at least, not yet), or attempts to find some information in an incorrect way, but it should suffice for someone reading to see how it works. 20150916 05:24:49< celticminstrel> It's really long, actually. 20150916 05:25:06< celticminstrel> The C++ version split some bits into separate functions; that could be done here as well, potentially. 20150916 05:27:19< ancestral> aeth: ^ 20150916 05:27:36< celticminstrel> Heh, yeah, aeth is probably a good person to show this to. 20150916 05:28:12< celticminstrel> Feel free to clean it up for me as well, if you see something that's already possible but obviously done wrong. 20150916 05:29:34< celticminstrel> If anyone's interested, relevant C++ functions are in game_events/action_wml.cpp starting at lines 567, 336, 120, 308, and 288. 20150916 05:30:07< celticminstrel> At least on my branch that's a few commits behind, but I doubt that file has been touched much recently. 20150916 05:31:46< celticminstrel> ...and it took me this long to realize that I forgot the link. o.O https://gist.github.com/CelticMinstrel/008f4f26805537c40ac8 20150916 05:34:29-!- jinblack [~jinblack@jinblack.it] has joined #wesnoth-dev 20150916 05:34:34< aeth> That style of Lua's completely alien to me. I come from functional and OOP backgrounds where complexity should be split into much smaller units than that. 20150916 05:35:09< celticminstrel> It's a fairly straightforward conversion from the C++. 20150916 05:35:17< aeth> celticminstrel: Unless you're taking advantage of the scope of the function to do something really complicated like I do in my mod, you probably want to make the local functions in the top level for performance reasons and pass in the cfg. 20150916 05:35:29< celticminstrel> Perhaps, yeah. 20150916 05:35:31< aeth> i.e. local function message_user_choice(cfg) 20150916 05:35:40< celticminstrel> It's currently accessing local variables from the enclosing function. 20150916 05:35:51< celticminstrel> But those could be passed in as parameters instead. 20150916 05:35:53< aeth> celticminstrel: Also I think you have to make it a local function even if you keep it internal, that doesn't do what you think it does iirc 20150916 05:36:03< aeth> right now I think it creates a global message_user_choice() 20150916 05:36:07< aeth> Lua's a painfully annoying language like that 20150916 05:36:34 * celticminstrel checks. 20150916 05:36:57< celticminstrel> Okay, yes, it looks like it checks some outside local variables but doesn't alter them, so it could be a toplevel function. 20150916 05:37:48< aeth> celticminstrel: Even if it altered them, it doesn't matter, Lua supports multiple return values (rare in a language) so it's easy to move functions to the top level 20150916 05:38:00< celticminstrel> Fair enough. 20150916 05:38:03< aeth> you can just do foo, bar = some_function() at the moment of altering and it makes the code more obvious 20150916 05:38:15< aeth> I am not an expert in Lua but I think that would help with clarity 20150916 05:38:24< celticminstrel> I did know that (you'll notice that wesnoth.show_message_dialog is assumed to return three values). 20150916 05:38:37< aeth> ah, okay 20150916 05:38:55< aeth> celticminstrel: okay, then you made a mistake, that's not MP safe, I think. 20150916 05:38:58< celticminstrel> The only reason I used a function at all is because it needs to be synchronized as a choice. 20150916 05:39:06< aeth> oh 20150916 05:39:51< aeth> celticminstrel: look at how I encapsulated that call, I did all the hard work already. 20150916 05:39:54< aeth> celticminstrel: https://github.com/Aethaeryn/wesnoth-umc/blob/862acea62207b40ee13077788b0983bc2a39100f/Aethaeryns_Mod/lua/gui2.lua#L80 20150916 05:41:15< aeth> It turns out that only a tiny little part actually needs to be syncrhonized, and that can go into a tiny function that returns a function. 20150916 05:41:38< aeth> You can probably make message_user_choice() much smaller 20150916 05:42:26< celticminstrel> Ah... yes, good point, all the stuff before the actual wesnoth.show_message_dialog call probably can happen outside it... 20150916 05:42:33< celticminstrel> I don't know how to pass arguments to it. 20150916 05:42:44< celticminstrel> When calling through wesnoth.synchronize_choice. 20150916 05:42:45< aeth> The only reason that dialog_choice() has to exist at all in my code is because there needs to be a side effect around the input, but you can encapsulate that into a closure to get an almost-functional style. 20150916 05:42:56< celticminstrel> Oh, wait. 20150916 05:42:57< aeth> celticminstrel: Make it a closure 20150916 05:43:05< celticminstrel> I see, you have a function that returns the function to be called. 20150916 05:43:11< aeth> celticminstrel: Pass arguments to a function that returns a function, and that closure is what goes into synchronize_choice 20150916 05:43:26< aeth> That's the only thing that gets the functions to be small. Everything else I tried was just a giant monolith. 20150916 05:43:31< aeth> Maybe there's another way, but I couldn't find it. 20150916 05:43:46< aeth> I probably should rewrite the part on the wiki once I finish cleaning up the gui part. I am going to add a few more closures. 20150916 05:44:13< aeth> No point to use Lua over C++ unless you're taking advantage of first class functions just about everywhere. 20150916 05:45:38< aeth> celticminstrel: I would also recommend not doing any table.insert() stuff in the main functions unless you can't avoid it. What I tend to do is I build tables in local helper functions and then just return them. That way the main body code's much shorter. 20150916 05:46:07< celticminstrel> Noted. 20150916 05:46:24< celticminstrel> I'm more interested in advice for correctness rather than style, but it's still useful to know. 20150916 05:47:05< aeth> Well, ime the GUI code is very hard to understand without encapsulation. 20150916 05:47:47< celticminstrel> Here I'm using a hypothetical new API function, though. But fair enough. 20150916 05:50:01< aeth> well imo what I'd do is I'd just break that into local helper functions, e.g. the local speaker part in lines 27-55 can just become local speaker = make_speaker() or something, and then replace the return with return false, and check for false 20150916 05:50:51< aeth> I'm not sure about correctness 20150916 05:51:35< celticminstrel> Already found one thing wrong - string.contains and string.replace do not exist. 20150916 05:51:52< celticminstrel> Not quite sure how to delete the substring from the string though. 20150916 05:52:00< aeth> gsub 20150916 05:52:02< aeth> iirc 20150916 05:52:14< aeth> http://pgl.yoyo.org/luai/i/5.4+String+Manipulation 20150916 05:53:35< aeth> Be careful, if it's a translatable string you can't use string operations on it because it shows up as userdata to Lua. You'd have to use tostring() on it first (if it's local). 20150916 05:53:52< celticminstrel> It shouldn't be translatable, since it's an image path. 20150916 05:53:59< celticminstrel> But I guess I should do that anyway just to be safe. 20150916 05:54:08< aeth> well, no, don't do it if you think it shouldn't be 20150916 05:54:15< aeth> Just put a comment so you know the answer if it's not. 20150916 05:54:21< aeth> i.e. -- if this doesn't work, use tostring() first 20150916 05:54:39< aeth> It is probably wasteful if it's a string already. 20150916 05:55:21< aeth> There's really no way to be sure with Lua ime without testing it a few times. Unlike e.g. Python it's very tied to local application APIs so I'm not even sure a lint program would be that useful. 20150916 05:56:51< aeth> I'm often surprised if something userdata or not, mutable or not. 20150916 05:59:44< celticminstrel> Version 2: https://gist.github.com/CelticMinstrel/008f4f26805537c40ac8 20150916 06:00:10< celticminstrel> Fixed int() -> tonumber() as well. 20150916 06:00:19< aeth> much better imo 20150916 06:00:47< celticminstrel> Still pretty long, mind you. Even if you just count the main function. 20150916 06:02:04< aeth> well I mean that's simple refactoring if you want more functions. Just find blocks that only affect one or a few variables like e.g. what you did with message_get_speaker() 20150916 06:02:22< celticminstrel> Yeah, I already know two bits in the first function that could be extracted. 20150916 06:02:30< celticminstrel> And I imagine there's a couple of bits in the main function too. 20150916 06:02:41< aeth> other than that the only way to shorten it is Lua's fake ternary (i.e. or) which I see you're already using 20150916 06:03:02< celticminstrel> Might be possible to use it in more places though, not sure. 20150916 06:03:10< celticminstrel> Though actually that's not really a fake ternary. 20150916 06:03:22< celticminstrel> If I recall, the fake ternary combines and and or somehow. 20150916 06:03:31< celticminstrel> I'm just using or. 20150916 06:03:34< aeth> I didn't know "fake ternary" was a real thing. 20150916 06:03:50< celticminstrel> I think I remember reading about it in the Lua manual. 20150916 06:03:50< aeth> What I mean by fake ternary is that it's not quite like ternary 20150916 06:05:13< celticminstrel> I guess. 20150916 06:05:25< celticminstrel> It's an if-null. 20150916 06:05:40< celticminstrel> Well, Lua, so nil. 20150916 06:06:50< aeth> I need to make an esoteric programming language where 0 and nil and false are equivalent. 20150916 06:07:50< aeth> It would actually be a bit useful because in a few places in my Lua I treat nil as 0 to save memory so I don't have to instantiate a lot of variables to 0 that will probably never increment. 20150916 06:07:57< aeth> But it would mostly be to troll people. 20150916 06:08:06< shadowm> It's called C, where there is no nil but 0 is used to that effect. 20150916 06:08:43< Aginor> there's NULL as a macro though 20150916 06:08:44< aeth> Ok, fine, new idea, I'll create a language where it's not safe to have an index go outside of the bounds of an array. Even more trollish. 20150916 06:09:12< shadowm> Aginor: Which is 0. 20150916 06:09:24< shadowm> More specifically (void*)0 IIRC. 20150916 06:09:27< celticminstrel> shadowm: Technically, it's (void*)0. 20150916 06:09:33< shadowm> Still a 0. 20150916 06:09:52< celticminstrel> But 0 does implicitly convert to any pointer type, even in C++. 20150916 06:10:36< shadowm> Here's a crazy idea, and hear me out on this. 20150916 06:10:49< shadowm> A language where you can ignore a constant's constantness. 20150916 06:10:55< shadowm> Oh wait, that's C++. 20150916 06:11:09< celticminstrel> Technically that's undefined behaviour or something. 20150916 06:12:27< shadowm> Well, you can safely take a non-const, const it, and cast take its constness away. The dangerous part is casting away the constness of a thing that exists in a RO page. 20150916 06:13:17< shadowm> You can do that but the moment you write to it, the CPU might decide to punish you accordingly. 20150916 06:17:13< celticminstrel> BTW does anyone know whether you push return values in the order returned or in reverse order? 20150916 06:17:36< celticminstrel> I suppose I can just try it and see what happens, or hunt down the relevant part of the manual. 20150916 06:18:07< aeth> I usually just try something to see what happens. It's faster than documentation. (Maybe this is why I don't like C++ and it's billion year compile times.) 20150916 06:18:12< aeth> *its 20150916 06:18:43< celticminstrel> Yeah, this is C++ I'm talking about. 20150916 06:18:47< celticminstrel> Well, C technically. 20150916 06:27:23-!- irker099 [~irker@uruz.ai0867.net] has quit [Quit: transmission timeout] 20150916 06:34:01-!- Kwandulin [~Miranda@p5B0098A5.dip0.t-ipconnect.de] has quit [Read error: Connection reset by peer] 20150916 06:37:36< celticminstrel> Another version, mostly small changes: https://gist.github.com/CelticMinstrel/008f4f26805537c40ac8 20150916 06:37:57< celticminstrel> There are various wesnoth.* things referenced in there still that probably don't exist. 20150916 06:38:53< vultraz> hm 20150916 06:39:26< celticminstrel> eg wesnoth.teams doesn't appear to exist. 20150916 06:40:01< celticminstrel> (Assuming the LuaWML page can be trusted to be complete.) 20150916 06:40:03< vultraz> such a big function 20150916 06:40:10< celticminstrel> Yup. 20150916 06:40:20< celticminstrel> Mind you, the C++ version is also a fairly big function. 20150916 06:44:19-!- jinblack [~jinblack@jinblack.it] has quit [Ping timeout: 244 seconds] 20150916 06:44:59< shadowm> celticminstrel: Uh... wesnoth.sides? 20150916 06:45:12< shadowm> http://wiki.wesnoth.org/LuaWML:Sides#wesnoth.sides 20150916 06:45:25< celticminstrel> Oh, there we go. 20150916 06:46:19< celticminstrel> Missed that when scanning the list. 20150916 06:58:04-!- Appleman1234 [~Appleman1@KD111239020099.au-net.ne.jp] has quit [Ping timeout: 268 seconds] 20150916 07:01:51-!- zookeeper [~lmsnie@wesnoth/developer/zookeeper] has joined #wesnoth-dev 20150916 07:03:09-!- genbattle [~genbattle@182.16.153.90] has quit [Ping timeout: 252 seconds] 20150916 07:03:12-!- jinblack [~jinblack@ip184-187-174-106.sb.sd.cox.net] has joined #wesnoth-dev 20150916 07:06:11-!- genbattle [~genbattle@182.16.153.90] has joined #wesnoth-dev 20150916 07:16:50< vultraz> if cfg["scroll"] == "yes" then 20150916 07:17:25< vultraz> celticminstrel: why not if cfg.scroll == true or if cfg.scroll? 20150916 07:17:54< celticminstrel> I dunno how these things work, are booleans in a config converted to Lua booleans? 20150916 07:19:08-!- Netsplit *.net <-> *.split quits: avtobiff 20150916 07:19:38< vultraz> yes 20150916 07:19:53< celticminstrel> Okay then. 20150916 07:25:27-!- Netsplit over, joins: avtobiff 20150916 07:25:28< aeth> celticminstrel: you could probably pass in get_image(cfg, speaker), get_captaion(cfg, speaker), and msg_cfg. Then message_user_choice doesn't need to know about the cfg at all 20150916 07:26:34< celticminstrel> Passing in msg_cfg implies building it in the main function... okay. 20150916 07:26:47< aeth> no wait I have a better idea 20150916 07:27:06< aeth> celticminstrel: just put it in another function 20150916 07:27:24< aeth> local image, local caption, local left_side, local msg_cfg 20150916 07:27:44< aeth> That doesn't directly have to do with the closure afaik 20150916 07:28:39< aeth> Then you can pass in msg_cfg only 20150916 07:28:44< celticminstrel> If you mean: 20150916 07:28:46< celticminstrel> local image, caption, left_side, msg_cfg = some_function() 20150916 07:28:47< celticminstrel> Then I don't really see the point? 20150916 07:29:15< aeth> lines 26-34, 47-52 can afaik go into its own function. Then you pass in msg_cfg 20150916 07:29:18< aeth> instead of cfg 20150916 07:29:41< aeth> That way only stuff directly having to do with the closure are in message_user_choice 20150916 07:29:56< celticminstrel> Why does that matter? 20150916 07:30:36< aeth> https://en.wikipedia.org/wiki/Separation_of_concerns 20150916 07:31:49< aeth> message_user_choice() exists to be a closure, so everything that doesn't have to be there makes what message_user_choice() does more obvious. 20150916 07:31:59< aeth> And it makes the code more reusable. 20150916 07:32:15< aeth> Start with [message], wind up with a GUI library. 20150916 07:32:17< celticminstrel> It's not going to be reusable anyway. It's all local functions. 20150916 07:32:28< aeth> It's currently not reusable. 20150916 07:32:29< celticminstrel> Well, I suppose. 20150916 07:33:16< aeth> If a few weeks from now you're doing something similar all you need to do is remove the local keyword if it's separated enough. 20150916 07:34:58< aeth> Some of this code already looks reusable. 20150916 07:35:14-!- jinblack [~jinblack@ip184-187-174-106.sb.sd.cox.net] has quit [Remote host closed the connection] 20150916 07:39:21< aeth> celticminstrel: It's iirc unit.__cfg.profile not unit.big_profile 20150916 07:39:51< aeth> celticminstrel: for a lot of the unit stuff you have to use a table via .__cfg to get the values from http://wiki.wesnoth.org/UnitWML based on what the wiki says at http://wiki.wesnoth.org/LuaWML:Units 20150916 07:40:00< aeth> I haven't used profiles, but I have gotten unit images that way 20150916 07:40:32-!- jinblack [~jinblack@ip184-187-174-107.sb.sd.cox.net] has joined #wesnoth-dev 20150916 07:41:40< aeth> I'm not sure how this would work if the speaker is the narrator. 20150916 07:42:22< aeth> I guess speaker is nil in the code and it isn't called 20150916 07:48:30< aeth> oh, and if you build msg_cfg outside of message_user_choice you don't have to pass in cfg *or* speaker, so you actually have one fewer parameter than before. 20150916 07:48:39< vultraz> celticminstrel: you can also get the cfg field by calling it when you assign the unit variable 20150916 07:48:51< vultraz> like, wesnoth.get_units(foo)[1].__cfg 20150916 07:49:49< aeth> Yes. By convention (afaik only I do this) I call it unit if I don't call the .__cfg and unit_data if I do call the .__cfg, so I don't get confused and call .__cfg twice. 20150916 07:49:52< celticminstrel> aeth: So, more like this? https://gist.github.com/CelticMinstrel/008f4f26805537c40ac8 20150916 07:49:55< aeth> So I'd use speaker_data 20150916 07:51:47< aeth> celticminstrel: I think so 20150916 07:52:24< aeth> local function build_message_dialog 20150916 07:52:33< aeth> You typo'd, I was wondering why the syntax highlighter was off 20150916 07:54:07< celticminstrel> Hmm... I guess highlight_hex should be select_hex... 20150916 07:54:24-!- Appleman1234 [~Appleman1@111.239.24.83] has joined #wesnoth-dev 20150916 07:57:30< celticminstrel> Does math.max() exist in Lua? 20150916 07:57:57< vultraz> celticminstrel: why is a function returning a function that returns a value? 20150916 07:58:23< celticminstrel> It's for wesnoth.synchronize_choice(). 20150916 07:58:35< vultraz> celticminstrel: and yes it does 20150916 07:58:41< vultraz> http://lua-users.org/wiki/MathLibraryTutorial 20150916 07:59:50< vultraz> wesnoth.highlight_hex(x = -1000, y = -1000) 20150916 07:59:52< vultraz> what?? 20150916 07:59:56< vultraz> why even do this 20150916 08:00:26-!- jinblack [~jinblack@ip184-187-174-107.sb.sd.cox.net] has quit [Ping timeout: 240 seconds] 20150916 08:00:39< celticminstrel> I think the point is to make sure no hex is highlighted. 20150916 08:00:50< vultraz> then just...don't highlight a hex 20150916 08:01:09< celticminstrel> That's there because it's literally what the C++ code did. 20150916 08:01:14< celticminstrel> But maybe it's not needed. 20150916 08:01:41< celticminstrel> Okay, with this version I think ever non-existing thing is gone except for wesnoth.show_message_dialog and wesnoth.is_skipping_replay. https://gist.github.com/CelticMinstrel/008f4f26805537c40ac8 20150916 08:01:50< aeth> celticminstrel: I'd leave a note to test it, to see if it does something if a message pops up while you're highlighting a hex 20150916 08:01:55< aeth> (a hex with a unit on it) 20150916 08:02:11< aeth> There's lots of things that unfortunately need to be tested 20150916 08:02:24< celticminstrel> Yeah, I can probably start testing once I get some sleep. >_> 20150916 08:02:33< vultraz> celticminstrel: you haven't fixed == "yes" 20150916 08:02:35< aeth> That's probably one reason why I haven't really done much on my add-on in a month. Lots of step by step testing of way too many things when you do GUI/menu stuff. 20150916 08:02:38< celticminstrel> Must be almost morning already. 20150916 08:04:21< aeth> that's why you should have used the 24 hour day/night cycle instead of the default one. 20150916 08:04:25< aeth> More time before morning. 20150916 08:04:30< celticminstrel> Pffft. 20150916 08:04:34< vultraz> lmao 20150916 08:06:01< vultraz> celticminstrel: do you mind if I propose some more edits to this? 20150916 08:06:22< celticminstrel> vultraz: No, go ahead. 20150916 08:06:58-!- iceiceice [~chris@wesnoth/developer/iceiceice] has quit [Ping timeout: 260 seconds] 20150916 08:07:02< aeth> vultraz: btw, the reason the function has to return a function is because otherwise it can't take any arguments afaik. wesnoth.synchronize_choice() kind of leaves no other choice afaik. 20150916 08:07:14< celticminstrel> ^ 20150916 08:07:21< aeth> The closure seems less pointless when working with the GUI2 dialog API because then at least there's some state outside of the return function 20150916 08:08:47< vultraz> "The actual computation is performed by the function passed as the first argument" why can't you just pass the function? 20150916 08:09:15< vultraz> the wiki example uses function() to execute the actions within synchronize_choice, but if you're passing another function shouldn't that be enough? 20150916 08:09:16< celticminstrel> wesnoth.synchronize_choice() calls the function without arguments. 20150916 08:09:41< vultraz> wat 20150916 08:09:45< celticminstrel> So the closure is a way to pass arguments to the function. 20150916 08:09:58< vultraz> why would it call a function without arguments 20150916 08:10:01< celticminstrel> wesnoth.synchronize_choice(f) calls f(). 20150916 08:10:08< celticminstrel> I want it to call f(some_argument). 20150916 08:10:25-!- iceiceice [~chris@ext-74.ias.edu] has joined #wesnoth-dev 20150916 08:10:25-!- iceiceice [~chris@ext-74.ias.edu] has quit [Changing host] 20150916 08:10:25-!- iceiceice [~chris@wesnoth/developer/iceiceice] has joined #wesnoth-dev 20150916 08:10:30< celticminstrel> Thus the closure. 20150916 08:10:33< vultraz> that is horrible design 20150916 08:10:43< celticminstrel> I won't argue with that. 20150916 08:11:01< celticminstrel> wesnoth.synchronize_choice() could be rearranged to take a table that's then passed to the function, for exampe. 20150916 08:11:03< celticminstrel> ^example 20150916 08:11:06< celticminstrel> But it doesn't. 20150916 08:11:39< vultraz> SMH 20150916 08:11:48< aeth> vultraz: oh and since it's literally only used for IO there is never a case where it will *not* take an argument. It has to. 20150916 08:11:51< celticminstrel> SMH? 20150916 08:11:58< vultraz> Shaking My Head 20150916 08:18:58-!- Kwandulin [~Miranda@p5B0098A5.dip0.t-ipconnect.de] has joined #wesnoth-dev 20150916 08:20:18< aeth> oh, and the worst part is there are 2 more optional arguments (well only 1 in 1.12) already so if you did patch it, it would look like wesnoth.synchronize_choice(foo_function, nil, nil, foo_args) 20150916 08:21:34< celticminstrel> I was about to say "nah, it can detect based on type", but then I remembered that the extra argument should be allowed to be of any type. 20150916 08:22:46< celticminstrel> Well, if the array argument was moved back one, you could still use type detection, I guess. 20150916 08:23:10< celticminstrel> But then you'd need a nil if you want to use the array... and two nils if you don't need the second function... 20150916 08:23:27< vultraz> celticminstrel: why do you calculate an offset for the speaker y value? 20150916 08:23:52< celticminstrel> Another option would be putting the new argument first (ie, if first argument isn't a function, then it's extra arguments to pass to the function). 20150916 08:24:03< celticminstrel> vultraz: I have no idea why that's like that. It's what the C++ code did. 20150916 08:24:05< aeth> celticminstrel: if you're going to detect based on type, what you'd probably want to do is make foo_args only optionally a table, since if you're just doing a function with one argument (which would probably be common) you can just not have a table there 20150916 08:24:41< shadowm> The hell? 20150916 08:24:43< celticminstrel> Oh right, Lua doesn't distinguish "array" from "table" either... 20150916 08:24:54< celticminstrel> Something wrong, shadowm? 20150916 08:25:10< aeth> celticminstrel: well afaik Lua doesn't *have* arrays, just tables. LuaJIT optimizations might be different. 20150916 08:25:28< shadowm> Why the hell doesn't it scroll to the unit instead? 20150916 08:25:39< celticminstrel> I have no idea, but that's what it already does! 20150916 08:25:42< shadowm> This is the most ridiculous thing I've ever heard. 20150916 08:25:55< celticminstrel> I didn't want to second-guess what was already there. Maybe there was a good reason. 20150916 08:25:55< shadowm> The fact that it's the way it is doesn't mean it's not wrong. 20150916 08:26:04< celticminstrel> Sure. 20150916 08:26:16< aeth> If it's one giant function like in your original Lua, I can see why it would go undetected. 20150916 08:26:28< celticminstrel> It's not, aeth. 20150916 08:26:36< shadowm> Another example of braindead design in Wesnoth: https://gna.org/bugs/?23632 20150916 08:26:36< celticminstrel> But I was going for more or less a directo translation. 20150916 08:27:03< celticminstrel> aeth, actually, the number of functions in the C++ version is pretty similar to the current number of functions in the Lua version. 20150916 08:27:23< aeth> ah, I was about to pull up the source to check 20150916 08:27:47< celticminstrel> Go ahead. :P 20150916 08:27:49< aeth> I don't think there's any reason at all to have large functions in C++ afaik. Don't compiled languages have inlining? 20150916 08:28:11< celticminstrel> C++ has inlining, yes. 20150916 08:28:16< shadowm> I'd rather have a large function than a load of crap scattered everywhere TBH. 20150916 08:28:20< celticminstrel> That generally applies to small functions. 20150916 08:29:15< aeth> shadowm: The problem is with side effects. Small functions manage side effects. You're not going to accidentally (or on purpose) modify a variable 80 lines down and make it impossible to follow the state without using search 20150916 08:29:23-!- joet [~joet@host86-163-221-140.range86-163.btcentralplus.com] has joined #wesnoth-dev 20150916 08:29:27< shadowm> There are large functions that should be (for example a long-winded init sequence) and large functions that shouldn't be (several of the anon namespace members in addon/manager_ui.cpp). 20150916 08:29:57< aeth> Obviously there are exceptions in general to small functions, I just happen to think that in balance functions I've seen are larger than they should be. 20150916 08:30:08< aeth> If everyone was doing an add_one() or something that would clearly be wrong. 20150916 08:30:42< shadowm> // FIXME: Why is this y-1??? 20150916 08:30:44< shadowm> screen->scroll_to_tile(gamemap::location(speaker->first.x,speaker->first.y-1)); 20150916 08:30:55< shadowm> Wesnoth-style coding. 20150916 08:31:10< celticminstrel> Yeah, why is it y-1? 20150916 08:31:13< shadowm> This was a thing that was there in 2007. 20150916 08:31:27< shadowm> Then someone went and removed the comment. 20150916 08:32:02< celticminstrel> Okay, so I shouldn't do the calculating an offset thing. 20150916 08:32:03< shadowm> Oh I see. 20150916 08:32:21< shadowm> This is related to the older [message] implementation with the dialog box at the top of the screen. 20150916 08:32:23< vultraz> celticminstrel: wesnoth.current.event_context.x1, wesnoth.current.event_context.x2 20150916 08:32:25< vultraz> what? 20150916 08:32:26< shadowm> !commit 83a332a8692260f50ab76bb7f0ae754baf6507d7 20150916 08:32:27< shikadibot> shadowm: Revision 83a332a86922 (Dominic Bolin) on Mon Jan 30 17:01:31 2006: 20150916 08:32:29< vultraz> why x1 x2 20150916 08:32:30< shikadibot> shadowm: Moved dialog box to allow speakers to be shown more often. 20150916 08:32:32< vultraz> and not x1 y1 20150916 08:32:33< shikadibot> shadowm: Web interface URL: https://github.com/wesnoth/wesnoth/commit/83a332a86922 20150916 08:32:37< celticminstrel> vultraz: Typo. 20150916 08:32:43< vultraz> ok fixing 20150916 08:32:53< vultraz> celticminstrel: please dont edit your copy more since im doing a lot here 20150916 08:32:58< celticminstrel> 'kay 20150916 08:33:12< celticminstrel> I was just about to edit the thing about the offset. 20150916 08:33:24< shadowm> So this explains why about 90% of the time units in my campaign appear to be talking offscreen for no good reason. 20150916 08:33:30 * shadowm facepalms. 20150916 08:33:59< shadowm> This ridiculous hack became obsolete the moment mordante's [message] dialog became the default. 20150916 08:34:26< celticminstrel> shadowm: Are you talking about the y-1 or the offset? 20150916 08:34:52< shadowm> How is one thing different from the other? 20150916 08:34:57< celticminstrel> Dunno. 20150916 08:34:58< shadowm> const int offset_from_center = std::max(0, spl.y - 1); 20150916 08:35:02< vultraz> same thing 20150916 08:35:04< celticminstrel> Ah, right. 20150916 08:35:04< shadowm> screen.scroll_to_tile(map_location(spl.x, offset_from_center)); 20150916 08:35:47< shadowm> Anyway, since nobody bothered to document the reason it exists, first mordante added a FIXME asking about the offset and then someone else removed said FIXME, and then it was completely forgotten by the time the new [message] dialog landed. 20150916 08:36:15< shadowm> This is the kind of meta crap what needs to be avoided. 20150916 08:36:17< shadowm> *that 20150916 08:36:36< vultraz> celticminstrel: https://www.dropbox.com/s/rt0xe25b6ebyeef/wml_message.lua?dl=0 what I have so far, might do more later 20150916 08:36:41< celticminstrel> Basically, don't make commits removing FIXME comments for no reason? 20150916 08:36:56< celticminstrel> Oh, I thought you'd be forking the gist. 20150916 08:36:59< shadowm> No, don't toss an ugly hack into the source and leave it undocumented for a decade. 20150916 08:37:04< celticminstrel> Ah. 20150916 08:37:15< vultraz> celticminstrel: I can do that 20150916 08:37:17< shadowm> Now, conversely, the current situation is that the speaker may get hidden behind the [message] box. 20150916 08:37:29< shadowm> But in the opposite direction. 20150916 08:37:57< vultraz> celticminstrel: https://gist.github.com/Vultraz/f9d668976ddd8d18b0f8 20150916 08:38:11< shadowm> (For the people who are not following, this is why the y offset is -1: http://www.wesnoth.org/images/sshots/wesnoth-1.4-9.jpg ) 20150916 08:40:02< shadowm> Now either way it shouldn't particularly matter *most* of the time, at least since I fixed the scrolling function in 1.11.x. 20150916 08:40:22< celticminstrel> vultraz: It looks like you changed the logic of get_image() so that a speaker overrides an explicitly specified image? 20150916 08:40:52< shadowm> It may be a problem with really long messages, but those don't happen most of the time. 20150916 08:41:07< celticminstrel> I thought I already split out get_speaker() into a different function. Guess not. 20150916 08:41:14< vultraz> celticminstrel: oh right 20150916 08:41:43< celticminstrel> Oh, you just moved the get_speaker function, okay. 20150916 08:42:10< celticminstrel> Looks like it's basically unchanged though. 20150916 08:42:14< celticminstrel> Except removing the hack. 20150916 08:42:46< vultraz> You were calling select hex twice 20150916 08:42:53< vultraz> also, you forgot to specify the third argument as false 20150916 08:42:57< celticminstrel> Oh yeah, because for some reason the C++ code did. 20150916 08:43:12< vultraz> and you got the context values screwed up 20150916 08:43:14< celticminstrel> And I was wondering about the third argument, actually. 20150916 08:44:48< vultraz> Fixed the image thing 20150916 08:45:41< celticminstrel> I used __cfg because that's what aeth said; just didn't bother to check if it was actually necessary. >_> 20150916 08:45:49< celticminstrel> It presumably works both ways. 20150916 08:46:10< celticminstrel> I think maybe it's almost ready for testing. 20150916 08:47:08< celticminstrel> Also, you removed the image=none special-case. I dunno if that's really necessary, though. 20150916 08:47:30< celticminstrel> Or wait, maybe it just doesn't need special handling... 20150916 08:47:40< celticminstrel> Wait, I'm blind, it's still there. 20150916 08:47:48< celticminstrel> Duh. 20150916 08:48:01< celticminstrel> Maybe I should get some sleep. 20150916 08:48:11< vultraz> I specifically added that case a few months ago, I wouldn't remove it x 20150916 08:48:12< vultraz> xD * 20150916 08:48:38< celticminstrel> Didn't help that I was in revisions mode, either. 20150916 08:48:43< celticminstrel> ie, looking at the diff 20150916 08:52:08-!- celticminstrel is now known as celmin|sleep 20150916 08:53:11-!- irker343 [~irker@uruz.ai0867.net] has joined #wesnoth-dev 20150916 08:53:11< irker343> wesnoth: Ignacio R. Morelle wesnoth:master e8caf1fac476 / changelog src/game_events/action_wml.cpp: Remove unnecessary y scrolling offset from [message] implementation http://git.io/vZNyb 20150916 08:53:58< aeth> I may be wrong on the portrait thing, I was just copying my code for a different thing from .__cfg, the unit image. 20150916 08:54:09< aeth> testing > me 20150916 08:56:08< irker343> wesnoth: Ignacio R. Morelle wesnoth:1.12 f3799b10ec5f / changelog src/game_events/action_wml.cpp: Remove unnecessary y scrolling offset from [message] implementation http://git.io/vZNSP 20150916 09:00:10< irker343> wesnoth: Ignacio R. Morelle wesnoth:1.12 cec77ad90b38 / src/game_events/action_wml.cpp: Remove unneeded temporary copy of a variable http://git.io/vZN9D 20150916 09:00:13< irker343> wesnoth: Ignacio R. Morelle wesnoth:master 0a8abb8328ef / src/game_events/action_wml.cpp: Remove unneeded temporary copy of a variable http://git.io/vZN9y 20150916 09:18:22-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has quit [Ping timeout: 272 seconds] 20150916 09:32:27-!- zombah [~zombah@2a02:28:3:1:214:4fff:fe47:5920] has joined #wesnoth-dev 20150916 09:41:26< vultraz> gah, dis code... 20150916 09:46:28< vultraz> local has_ti = helper.get_child(cfg, "text_input") ~= nil 20150916 09:46:30< vultraz> local has_input = has_ti or helper.get_child("text_input") ~= nil 20150916 09:46:34< vultraz> the hell is going on here 20150916 09:46:50< vultraz> has_input = a bool or something not equals nil 20150916 09:47:36< vultraz> if there's no text input that basically means this comes out to... false 20150916 09:47:47-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20150916 09:47:49< vultraz> and if it does it comes out to true 20150916 09:47:54< vultraz> in an incredibly roundabout way 20150916 09:48:37< vultraz> I'm guessing has_ti is not supposed to be a bool 20150916 09:49:34< vultraz> has_input = #options > 0 or has_ti 20150916 09:49:47< vultraz> this makes no sense 20150916 09:52:23 * vultraz groans 20150916 10:36:16< vultraz> celmin|sleep: https://gist.github.com/Vultraz/f9d668976ddd8d18b0f8 20150916 10:55:34-!- halfspiral [~halfspira@162.211.218.252] has quit [Quit: WeeChat 1.1.1] 20150916 11:05:28< vultraz> celmin|sleep: keep in mind very much not tested 20150916 11:21:53< vultraz> celmin|sleep: where is show_message_dialog? 20150916 11:29:32-!- stikonas [~gentoo@wesnoth/translator/stikonas] has joined #wesnoth-dev 20150916 11:33:54-!- Appleman1234 [~Appleman1@111.239.24.83] has quit [Ping timeout: 272 seconds] 20150916 11:38:18-!- louis94 [~~louis94@109.129.229.117] has joined #wesnoth-dev 20150916 11:43:11-!- fabi [~quassel@wesnoth/developer/fendrin] has quit [Ping timeout: 256 seconds] 20150916 11:43:41-!- fabi [~quassel@wesnoth/developer/fendrin] has joined #wesnoth-dev 20150916 12:00:39-!- irker343 [~irker@uruz.ai0867.net] has quit [Quit: transmission timeout] 20150916 12:05:02-!- gfgtdf [~chatzilla@f054150069.adsl.alicedsl.de] has joined #wesnoth-dev 20150916 12:08:38-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has joined #wesnoth-dev 20150916 12:22:12-!- wedge010 [~Thunderbi@60-241-236-92.static.tpgi.com.au] has joined #wesnoth-dev 20150916 12:22:55-!- gfgtdf [~chatzilla@f054150069.adsl.alicedsl.de] has quit [Quit: ChatZilla 0.9.92 [Firefox 40.0.3/20150826023504]] 20150916 12:24:30-!- wedge009 [~Thunderbi@60-241-236-92.static.tpgi.com.au] has quit [Ping timeout: 240 seconds] 20150916 12:24:30-!- wedge010 is now known as wedge009 20150916 12:30:35-!- Appleman1234 [~Appleman1@KD106161087155.au-net.ne.jp] has joined #wesnoth-dev 20150916 12:32:51-!- Kwandulin [~Miranda@p5B0098A5.dip0.t-ipconnect.de] has quit [Read error: Connection reset by peer] 20150916 12:38:35-!- fendrin [~quassel@wesnoth/developer/fendrin] has joined #wesnoth-dev 20150916 12:39:27-!- fabi [~quassel@wesnoth/developer/fendrin] has quit [Ping timeout: 250 seconds] 20150916 12:39:38-!- louis94 [~~louis94@109.129.229.117] has quit [Quit: Konversation terminated!] 20150916 13:26:43-!- wedge009 [~Thunderbi@60-241-236-92.static.tpgi.com.au] has quit [Quit: wedge009] 20150916 13:27:01-!- wedge009 [~Thunderbi@60-241-236-92.static.tpgi.com.au] has joined #wesnoth-dev 20150916 13:30:15-!- danni_ [~quassel@adsl-au-4-115.ozonline.com.au] has quit [Read error: Connection reset by peer] 20150916 13:33:05-!- danni [~quassel@adsl-au-4-115.ozonline.com.au] has joined #wesnoth-dev 20150916 13:48:45-!- fendrin [~quassel@wesnoth/developer/fendrin] has quit [Ping timeout: 240 seconds] 20150916 13:53:52-!- joet [~joet@host86-163-221-140.range86-163.btcentralplus.com] has quit [Ping timeout: 272 seconds] 20150916 13:58:20-!- gfgtdf [~chatzilla@f054150069.adsl.alicedsl.de] has joined #wesnoth-dev 20150916 13:58:42< gfgtdf> vultraz: do we actually allo [text_input] an duser choice in one [message] ? 20150916 14:02:50-!- Kwandulin [~Miranda@p5B0098A5.dip0.t-ipconnect.de] has joined #wesnoth-dev 20150916 14:17:06-!- irker419 [~irker@uruz.ai0867.net] has joined #wesnoth-dev 20150916 14:17:06< irker419> wesnoth: gfgtdf wesnoth:master 17b3c98a5e12 / src/game_events/action_wml.cpp: fix side_for in [message]s with input http://git.io/vZxC5 20150916 14:24:43< gfgtdf> vultraz: your the lua version mostlikeley has treh smae bug 20150916 14:28:40-!- travis-ci [~travis-ci@ec2-54-144-46-7.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 14:28:41< travis-ci> wesnoth/wesnoth#7379 (master - 17b3c98 : gfgtdf): The build was broken. 20150916 14:28:41< travis-ci> Build details : https://travis-ci.org/wesnoth/wesnoth/builds/80644627 20150916 14:28:41-!- travis-ci [~travis-ci@ec2-54-144-46-7.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 14:28:42-!- raoniff [~raoni@labs-gw.ic.unicamp.br] has quit [Ping timeout: 272 seconds] 20150916 14:30:21< vultraz> gfgtdf: so for_side only works with no text_input? 20150916 14:42:05< vultraz> ok i updated the my gist 20150916 15:00:48-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has joined #wesnoth-dev 20150916 15:07:18-!- raoniff [~raoni@labs-gw.ic.unicamp.br] has joined #wesnoth-dev 20150916 15:10:10< gfgtdf> vultraz: hm not exactly for input for_side is handeled differently 20150916 15:11:10< vultraz> local sides_for = cfg.side_for 20150916 15:11:12< vultraz> if sides_for and not text_input then 20150916 15:11:14< vultraz> so this is wrong? 20150916 15:11:56< gfgtdf> vultraz: yes it is becasue it onl checkd for tett input and not for options 20150916 15:12:17-!- [Relic] [~Relic]@2602:306:33a3:6d30:8ca6:67a0:baa:147e] has joined #wesnoth-dev 20150916 15:12:26< gfgtdf> vultraz: but thats not my point, which is that the handleing in for side here: https://github.com/wesnoth/wesnoth/blob/master/src/game_events/action_wml.cpp#L672 20150916 15:12:33< gfgtdf> vultraz: is mor likeley mising in your code 20150916 15:13:16< vultraz> oh hm 20150916 15:13:34< vultraz> yeah celmin didn't handle that 20150916 15:13:49-!- joet [~joet@host86-163-221-140.range86-163.btcentralplus.com] has joined #wesnoth-dev 20150916 15:17:38< celmin|sleep> vultraz: Yes, the second "text_input" should've been "option". And show_message_dialog was something I was adding. 20150916 15:18:07< vultraz> celmin|sleep: well uh... i've changed stuff. please advise on updated version 20150916 15:19:08-!- mattsc [~mattsc@wesnoth/developer/mattsc] has joined #wesnoth-dev 20150916 15:19:09< celmin|sleep> gfgtdf: The passed cfg.side_for was not used by the msg.query_user function, so I left it out. 20150916 15:19:31< vultraz> celmin|sleep: I guess I need to re-add has_input 20150916 15:20:22< vultraz> and put it some placed I replaced with text_input :( 20150916 15:20:25< vultraz> blagh 20150916 15:20:38< gfgtdf> celmin|sleep: yes but we taks about the side_for parameter of mp_sync::get_user_choice and not the side_for parmaeter od query_user 20150916 15:22:14-!- fabi [~quassel@wesnoth/developer/fendrin] has joined #wesnoth-dev 20150916 15:22:58< celmin|sleep> gfgtdf: Oh, hmm, I guess that would be the new third parameter to wesnoth.synchronize_choice? 20150916 15:23:10 * celmin|sleep is now looking at the get_user_choice code. 20150916 15:23:16< gfgtdf> vultraz: actualy i thoin syncronize_choices current inte5rface is not ood, i think i shoudl make a function get_user_choice ex 20150916 15:23:31< gfgtdf> celmin|sleep: yes, its the thrid parmaeter 20150916 15:23:54< celmin|sleep> gfgtdf: Yes, we were discussing that poor interface earlier. 20150916 15:24:09< celmin|sleep> vultraz: Are you editing now or can I fork it? 20150916 15:26:57< vultraz> celmin|sleep: let me see about readding has_input 20150916 15:26:58< gfgtdf> vultraz: i want to make a new function wesnoth.get_user_choice_ex(string, function, number or list of numbers) that can then be used to implement the normal synce_choice 20150916 15:27:11< celmin|sleep> gfgtdf: Why the _ex suffix? 20150916 15:27:25< celmin|sleep> And what's the string argument for? 20150916 15:27:35< gfgtdf> celmin|sleep: its the first argument for get_user_hoice 20150916 15:27:41< celmin|sleep> What about the second function? 20150916 15:27:46< gfgtdf> celmin|sleep: for teh ex it not the final name 20150916 15:27:52< gfgtdf> celmin|sleep: im happy about a better name 20150916 15:28:09< gfgtdf> celmin|sleep: we dont need a seconds function we cna use use a if contorller == ai in teh passed function 20150916 15:28:24< celmin|sleep> Hmm, fair. 20150916 15:28:51< celmin|sleep> Though that requires the function can access the relevant side. 20150916 15:29:24< celmin|sleep> Your version is still missing something important though. 20150916 15:30:57< celmin|sleep> ...vultraz re-replaced all my shortened text_input variable names. >_> 20150916 15:31:42< celmin|sleep> Also vultraz, you removed the error message shown when there's more than one [text_input]. Though it was commented out because I wasn't sure how best to do it. 20150916 15:32:00< vultraz> celmin|sleep: no need, really, since get_child only takes the first one 20150916 15:32:07< celmin|sleep> I know it does. 20150916 15:32:24< gfgtdf> vultraz: it stil beter to have warning 20150916 15:32:27< celmin|sleep> But I don't think extras should be ignored without a warning message. 20150916 15:32:35< vultraz> ok 20150916 15:32:40< gfgtdf> vultraz: we shoudl let the user know if he make erros if we can 20150916 15:32:49< vultraz> celmin|sleep, gfgtdf: updated gist https://gist.github.com/Vultraz/f9d668976ddd8d18b0f8 20150916 15:33:00< vultraz> since celmin|sleep wants to work i'll let him readd 20150916 15:33:15< vultraz> the earning 20150916 15:33:16< vultraz> warning 20150916 15:33:32< celmin|sleep> Oh, you moved the scrolling code out of get_speaker. 20150916 15:34:15< vultraz> yes 20150916 15:36:32< vultraz> the scrolling was out of scope 20150916 15:36:37< vultraz> of the function 20150916 15:36:44-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20150916 15:36:53< celmin|sleep> Considering I named it get_speaker instead of handle_speaker, I guess it was. 20150916 15:38:18< vultraz> derp, just realized I made an error 20150916 15:39:29< vultraz> celmin|sleep: change options ~= nil to next(options) == nil 20150916 15:39:40< vultraz> you can assign next as local if you want 20150916 15:40:32< vultraz> ... 20150916 15:40:33< vultraz> gahh 20150916 15:40:44-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has joined #wesnoth-dev 20150916 15:40:47< vultraz> next(options) ~= nil 20150916 15:40:52< vultraz> I think 20150916 15:40:56< vultraz> cannot type code >_< 20150916 15:43:16-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Client Quit] 20150916 15:45:17-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has joined #wesnoth-dev 20150916 16:00:27< gfgtdf> about the show_message_dialog function: i personaly dislike lua function that take wml/config parmaeters unless it needed (like lua code that executed wml code) since i consider dealing with lua tables in lua not really funny. I dont know how complicate it would be to make that function have normal arguments though 20150916 16:02:26< celmin|sleep> Probably not complicated. It's just that it's implemented in C++, so it's hard. I should be able to figure it out though. 20150916 16:02:52< gfgtdf> celmin|sleep: you have it alredy implemented ? 20150916 16:02:58< celmin|sleep> Yes. 20150916 16:03:44< celmin|sleep> Is there already a way in the Lua API to detect if a skipping replay is in progress? 20150916 16:04:24< celmin|sleep> gfgtdf, vultraz: Why did you add "not has_input" to the "if sides_for" condition? 20150916 16:04:33< gfgtdf> celmin|sleep: you mena teh skip_replay function in play_controller ? 20150916 16:04:47< gfgtdf> celmin|sleep: i didnt chagne anythign in your lua code 20150916 16:05:03< celmin|sleep> gfgtdf: I'm asking you because it seems vultraz changed it at your recommendation. 20150916 16:05:06< gfgtdf> celmin|sleep: becasue it woudl casue PPS 20150916 16:05:08< gfgtdf> OOS 20150916 16:05:23< celmin|sleep> gfgtdf: As for the replay thing, the C++ function is called is_skipping_replay(). 20150916 16:06:46< gfgtdf> celmin|sleep: i dont think there is a way 20150916 16:09:28< gfgtdf> hmm maybe i shodul make a dfferent function get sync_choice one for singlw sides and one for multiple sides 20150916 16:12:04-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has quit [Ping timeout: 265 seconds] 20150916 16:13:03< celmin|sleep> How should I show the warning about multiple [text_input]? 20150916 16:13:49-!- tim_the_enchante [637f4b7c@gateway/web/freenode/ip.99.127.75.124] has joined #wesnoth-dev 20150916 16:13:51-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has joined #wesnoth-dev 20150916 16:14:10-!- tim_the_enchante [637f4b7c@gateway/web/freenode/ip.99.127.75.124] has left #wesnoth-dev [] 20150916 16:14:55-!- ScegfOd [637f4b7c@gateway/web/freenode/ip.99.127.75.124] has joined #wesnoth-dev 20150916 16:15:27-!- fabi [~quassel@wesnoth/developer/fendrin] has quit [Ping timeout: 265 seconds] 20150916 16:15:32< vultraz> celmin|sleep: I'll code it 20150916 16:15:50< celmin|sleep> https://gist.github.com/CelticMinstrel/d4262f02688e05c39f1b 20150916 16:15:54-!- fabi [~quassel@176.0.36.112] has joined #wesnoth-dev 20150916 16:15:54-!- fabi [~quassel@176.0.36.112] has quit [Changing host] 20150916 16:15:54-!- fabi [~quassel@wesnoth/developer/fendrin] has joined #wesnoth-dev 20150916 16:16:06< gfgtdf> celmin|sleep: maybe use [wml_message] ? 20150916 16:16:13< celmin|sleep> Could do. 20150916 16:17:04< celmin|sleep> But isn't that invisible? 20150916 16:18:22< celmin|sleep> vultraz: I have another edit to do. 20150916 16:18:27< gfgtdf> celmin|sleep: i thought that depends the parmaeters to [wml_message] but i havent used it in a long time 20150916 16:18:30< celmin|sleep> Are you currently editing? 20150916 16:18:58< gfgtdf> i wonder whjetehr we need the random_choice paremeter for get_user_choice in lua 20150916 16:19:19< celmin|sleep> Also vultraz, you used a split() function, does that exist already? 20150916 16:19:55-!- celmin|sleep is now known as celticminstrel 20150916 16:20:06< vultraz> in wml_tags.lua 20150916 16:20:21< vultraz> celticminstrel: also, you need to use the right logger for the wml messsage 20150916 16:21:56< vultraz> celticminstrel: ah, nice optimization there 20150916 16:21:56< celticminstrel> So are you currently editing the gist? 20150916 16:22:00< vultraz> No I am not 20150916 16:22:06< celticminstrel> Which optimization? 20150916 16:22:15< vultraz> 134 20150916 16:22:29< vultraz> 112 is also good 20150916 16:22:58< celticminstrel> That's what I had originally. :P 20150916 16:23:38< celticminstrel> Just added the [show_if] support that was hacked in from the Lua side. 20150916 16:23:59< celticminstrel> So what would be the correct logger for wml_message? 20150916 16:24:23< vultraz> warn I guess, for this 20150916 16:26:47< celticminstrel> Sounds like that'll still be invisible by default. 20150916 16:27:13< celticminstrel> Unless log level is raised to warning when debug mode is enabled in-game. 20150916 16:27:20< celticminstrel> That could be acceptable. 20150916 16:27:50< shadowm> --log-warn=all is the default. 20150916 16:28:05< shadowm> warning even. 20150916 16:29:28-!- iceiceice [~chris@wesnoth/developer/iceiceice] has quit [Ping timeout: 265 seconds] 20150916 16:32:43< celticminstrel> Only other thing I can think of is that maybe some things need to be passed through wesnoth.tovconfig. 20150916 16:32:55-!- iceiceice [~chris@ext-74.ias.edu] has joined #wesnoth-dev 20150916 16:32:55-!- iceiceice [~chris@ext-74.ias.edu] has quit [Changing host] 20150916 16:32:55-!- iceiceice [~chris@wesnoth/developer/iceiceice] has joined #wesnoth-dev 20150916 16:41:50-!- joet [~joet@host86-163-221-140.range86-163.btcentralplus.com] has quit [Ping timeout: 246 seconds] 20150916 16:42:36-!- boucman [~rosen@wesnoth/developer/boucman] has joined #wesnoth-dev 20150916 17:00:45-!- louis94 [~~louis94@109.129.229.117] has joined #wesnoth-dev 20150916 17:04:19-!- iceiceice [~chris@wesnoth/developer/iceiceice] has quit [Ping timeout: 240 seconds] 20150916 17:05:02-!- Jozrael [~Jozrael@192.91.144.6] has joined #wesnoth-dev 20150916 17:05:40-!- joet [~joet@host86-163-221-140.range86-163.btcentralplus.com] has joined #wesnoth-dev 20150916 17:17:33-!- irker419 [~irker@uruz.ai0867.net] has quit [Quit: transmission timeout] 20150916 17:18:55-!- zombah [~zombah@2a02:28:3:1:214:4fff:fe47:5920] has quit [Quit: Leaving] 20150916 17:20:27-!- prkc [~prkc@catv-89-134-159-103.catv.broadband.hu] has joined #wesnoth-dev 20150916 17:29:54-!- louis94 [~~louis94@109.129.229.117] has quit [Quit: Konversation terminated!] 20150916 17:39:14-!- Appleman1234 [~Appleman1@KD106161087155.au-net.ne.jp] has quit [Ping timeout: 246 seconds] 20150916 17:45:45-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20150916 17:47:12-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has quit [Ping timeout: 264 seconds] 20150916 17:48:22-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has joined #wesnoth-dev 20150916 17:54:52-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has quit [Read error: Connection reset by peer] 20150916 17:57:38-!- stikonas [~gentoo@wesnoth/translator/stikonas] has quit [Quit: Konversation terminated!] 20150916 17:59:05-!- joet [~joet@host86-163-221-140.range86-163.btcentralplus.com] has quit [Ping timeout: 244 seconds] 20150916 18:02:25< vultraz> celticminstrel: local show_if = helper.get_child(cfg, "show_if") if show_if and not wesnoth.eval_conditional(show_if) then -> local show_if = helper.get_child(cfg, "show_if") or {} if not wesnoth.eval_conditional(show_if) then 20150916 18:02:38< vultraz> celticminstrel: also, typo at like 119 20150916 18:02:41< vultraz> line 20150916 18:03:35< celticminstrel> BTW gfgtdf, I'm rearranging my show_message_dialog to take three arguments instead of one. 20150916 18:03:58< gfgtdf> celticminstrel: hmm whcih arguments exactly? 20150916 18:04:11< vultraz> celticminstrel: the reason I use {} is because the empty table evaluates as true 20150916 18:06:01< celticminstrel> gfgtdf: Second argument is list of options. Third argument is table describing the text input. Either of those can be nil. 20150916 18:06:12< celticminstrel> First argument is otherwise pretty much the same. 20150916 18:06:21< celticminstrel> Except it's a Lua table, not a WML table. 20150916 18:11:56-!- Kwandulin [~Miranda@p5B0098A5.dip0.t-ipconnect.de] has quit [Read error: Connection reset by peer] 20150916 18:26:07-!- jinblack [~jinblack@128.111.48.6] has joined #wesnoth-dev 20150916 18:37:03-!- Appleman1234 [~Appleman1@KD111239007043.au-net.ne.jp] has joined #wesnoth-dev 20150916 18:40:51-!- ScegfOd [637f4b7c@gateway/web/freenode/ip.99.127.75.124] has quit [Ping timeout: 246 seconds] 20150916 18:43:39< celticminstrel> Actually, it's easier if I allow the first and third arguments to accept WML tables. 20150916 18:46:04-!- louis94 [~~louis94@109.129.229.117] has joined #wesnoth-dev 20150916 18:55:00-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 19:02:54< vultraz> celticminstrel: what will show_message_dialog do? 20150916 19:03:11-!- Elvish_Hunter [~elvish_hu@wesnoth/developer/elvish-hunter] has joined #wesnoth-dev 20150916 19:04:26< celticminstrel> vultraz: It displays the actual dialog. Very similar to what helper.get_user_choice already does, really, except the latter works by calling the [message] tag while show_message_dialog is implemented in C++. (Also it supports text input which get_user_choice doesn't.) 20150916 19:04:46< vultraz> Hm, ok 20150916 19:04:58< vultraz> I'll wait to see your PR 20150916 19:05:29< Elvish_Hunter> Hi 20150916 19:05:33< celticminstrel> Hi 20150916 19:05:37< vultraz> hey Elvish_Hunter 20150916 19:06:47-!- irker038 [~irker@uruz.ai0867.net] has joined #wesnoth-dev 20150916 19:06:47< irker038> wesnoth: Elvish_Hunter wesnoth:master ac3118508318 / data/tools/wmllint-1.4: wmllint-1.4: use 'with' statement when handling files http://git.io/vZhOW 20150916 19:06:47< irker038> wesnoth: Elvish_Hunter wesnoth:master 2877a6a489e4 / data/tools/wmllint-1.4: wmllint-1.4: use enumerate() to iterate over lines http://git.io/vZhOl 20150916 19:06:48< irker038> wesnoth: Elvish_Hunter wesnoth:master f4f11c03fc7d / data/tools/wmllint-1.4: wmllint-1.4: simplify a line modification http://git.io/vZhO8 20150916 19:06:49< irker038> wesnoth: Elvish_Hunter wesnoth:master 3afe74b5de58 / data/tools/wmllint-1.4: wmllint-1.4: renamed a variable http://git.io/vZhO4 20150916 19:06:50< irker038> wesnoth: Elvish_Hunter wesnoth:master 53ee364bab1b / data/tools/wmllint-1.4: wmllint-1.4: renamed two variables http://git.io/vZhOB 20150916 19:07:27< celticminstrel> Yay for with. 20150916 19:08:57-!- alalazo [d537b0e6@gateway/web/freenode/ip.213.55.176.230] has joined #wesnoth-dev 20150916 19:09:04< Elvish_Hunter> There are still some things that I need to fix in wmllint-1.4, like four points where there are strange string concatenations instead of interpolations or formatting... 20150916 19:09:43< Elvish_Hunter> celticminstrel: instead of using pcall(), could xpcall() be a better choice? 20150916 19:10:06< celticminstrel> Only 96 files left to recompile... still gonna take some time... 20150916 19:10:23< Elvish_Hunter> I mean, xpcall allows you to pass an error handler to the function, and said handler will be able to re-raise the error 20150916 19:10:30< celticminstrel> ^-left 20150916 19:10:58< celticminstrel> Elvish_Hunter: The issue is that, as far as I know, there's no option to pass a fake stack trace when raising an error. 20150916 19:12:18 * celticminstrel is looking that up anywa though, just in case. 20150916 19:13:18< Elvish_Hunter> Well, there's debug.traceback, which returns the error stack as a string, which can be passed to error() 20150916 19:13:46< celticminstrel> ^+y. 20150916 19:13:54< irker038> wesnoth: Charles Dang wesnoth:master bce13542b15e / src/game_events/action_wml.cpp: Fixup 17b3c98a5e12 http://git.io/vZhGc 20150916 19:15:20< Elvish_Hunter> Bear in mind that I never had the need to use debug.traceback so far, so I may be wrong. But if it works... 20150916 19:18:19-!- travis-ci [~travis-ci@ec2-54-158-59-84.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 19:18:20< travis-ci> wesnoth/wesnoth#7380 (master - 53ee364 : Elvish_Hunter): The build is still failing. 20150916 19:18:20< travis-ci> Build details : https://travis-ci.org/wesnoth/wesnoth/builds/80699149 20150916 19:18:20-!- travis-ci [~travis-ci@ec2-54-158-59-84.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 19:19:44< celticminstrel> The issue lies with error(), not with pcall() / xpcall(). 20150916 19:19:59< celticminstrel> It might be possible to use xpcall() to solve it. 20150916 19:21:44< celticminstrel> I have no idea how to do that though, and it would likely require some sort of change to the handling of Wesnoth's Lua jailbreak exception. 20150916 19:28:25< celticminstrel> Hmm... it can't find luaL_getn. 20150916 19:28:48-!- alalazo [d537b0e6@gateway/web/freenode/ip.213.55.176.230] has quit [Ping timeout: 246 seconds] 20150916 19:31:33-!- jinblack [~jinblack@128.111.48.6] has quit [Ping timeout: 250 seconds] 20150916 19:32:02< celticminstrel> Ah, it was changed to lua_objlen, apparently. 20150916 19:38:31-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20150916 19:50:09-!- jinblack [~jinblack@128.111.48.6] has joined #wesnoth-dev 20150916 19:53:58-!- louis94 [~~louis94@109.129.229.117] has quit [Ping timeout: 260 seconds] 20150916 19:56:18-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has joined #wesnoth-dev 20150916 20:04:11-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 20:17:01-!- [Relic] [~Relic]@2602:306:33a3:6d30:8ca6:67a0:baa:147e] has quit [Quit: I press the magic X and all the weirdos go away!] 20150916 20:19:33< irker038> wesnoth: Nils Kneuper wesnoth:master e9be2324b584 / / (7 files in 6 dirs): updated Hungarian translation http://git.io/vZho8 20150916 20:19:36< irker038> wesnoth: Nils Kneuper wesnoth:1.12 c26f98e9268d / / (6 files in 5 dirs): updated Hungarian translation http://git.io/vZho4 20150916 20:19:56-!- mattsc [~mattsc@wesnoth/developer/mattsc] has quit [Quit: mattsc] 20150916 20:21:06-!- mattsc [~mattsc@wesnoth/developer/mattsc] has joined #wesnoth-dev 20150916 20:23:15-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20150916 20:37:39< gfgtdf> celticminstrel: you'll make a pr about your [message] impülementation ? 20150916 20:37:56< celticminstrel> Yes. 20150916 20:38:10< celticminstrel> I'll divorce it from the looping tags for now. 20150916 20:38:33< celticminstrel> Because it's a fairly big thing and not directly linked to them. 20150916 20:38:59< celticminstrel> Currently I'm just testing that show_message_dialog works. 20150916 20:39:11< celticminstrel> Then I'll probably try some [message] tests. 20150916 20:55:17-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has joined #wesnoth-dev 20150916 21:04:04< celticminstrel> Hmm, it seems options don't work. 20150916 21:04:44< celticminstrel> But text input does. 20150916 21:05:02< celticminstrel> Also, it complains if the optional arguments are not passed. 20150916 21:05:09< celticminstrel> Two things to fix, then. 20150916 21:13:16< gfgtdf> vultraz: why opinion on pr491 ? 20150916 21:14:13< gfgtdf> s/why/any 20150916 21:16:21< vultraz> gfgtdf: the descrip talks about get_user_choice[s] but the code seems to refer to synchronize_choice[s] 20150916 21:16:24< vultraz> I'm confused 20150916 21:16:43< gfgtdf> vultraz: the desript is wrong then 20150916 21:16:57< celticminstrel> mp_sync::get_user_choice is the C++ function that's used to implement wesnoth.synchronize_choice. 20150916 21:21:02-!- louis94 [~~louis94@109.129.229.117] has joined #wesnoth-dev 20150916 21:22:15< celticminstrel> gfgtdf: So you need the plural form if you're using side_for? 20150916 21:22:27< gfgtdf> celticminstrel: no 20150916 21:22:27-!- Shackra [~Jorge@186.177.2.148] has joined #wesnoth-dev 20150916 21:22:47< gfgtdf> celticminstrel: you can just pass a integer to teh singular form 20150916 21:23:10< gfgtdf> celticminstrel: but if you want to pass an array of sides than youll need the plural form 20150916 21:23:21< gfgtdf> celticminstrel: but for mesage] you dont need it 20150916 21:23:28< celticminstrel> No, I think I do. 20150916 21:23:50< gfgtdf> celticminstrel: why shoudl you need it ? 20150916 21:23:51< celticminstrel> There's a side_for= key in [message]... 20150916 21:24:12< gfgtdf> celticminstrel: yes but it onyl needs the sinbular form of syncrinize_choice 20150916 21:24:23< celticminstrel> Why? 20150916 21:24:31< gfgtdf> celticminstrel: message with optional supprt only a single number in sie_for 20150916 21:24:53-!- hashdev [4fdec179@gateway/web/freenode/ip.79.222.193.121] has joined #wesnoth-dev 20150916 21:25:42< celticminstrel> The code seems to imply otherwise. 20150916 21:25:50< gfgtdf> celticminstrel: no it doesnt 20150916 21:26:19< gfgtdf> celticminstrel: it passed "side_for" ot get_user_choice which takes an integer paremeter 20150916 21:26:26< gfgtdf> the c++ cod ei mean 20150916 21:27:05< celticminstrel> Oh, that's true, but there was also that code that split side_for= and looped through. 20150916 21:27:36< gfgtdf> celticminstrel: yes that the code in if(!has_input) 20150916 21:28:24< celticminstrel> But the !has_input was something you just added, right? 20150916 21:28:44< gfgtdf> celticminstrel: yes becasue it was broken before 20150916 21:29:35-!- travis-ci [~travis-ci@ec2-54-144-46-7.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 21:29:36< travis-ci> gfgtdf/wesnoth-old#538 (sync_choice_split - 696740d : gfgtdf): The build failed. 20150916 21:29:36< travis-ci> Build details : https://travis-ci.org/gfgtdf/wesnoth-old/builds/80720837 20150916 21:29:36-!- travis-ci [~travis-ci@ec2-54-144-46-7.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 21:29:58-!- stikonas [~gentoo@wesnoth/translator/stikonas] has joined #wesnoth-dev 20150916 21:37:08-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20150916 21:51:11< celticminstrel> gfgtdf: Wiki has this to say about side_for: "(Version 1.13.0 and later only) This limitation has been lifted in 1.13.0 and later versions." 20150916 21:51:31< celticminstrel> The limitation being that they can only be shown to the current player if they take user input. 20150916 21:51:40< celticminstrel> So given that, I think I would need the plural form. 20150916 21:53:40< gfgtdf> celticminstrel: no, it is simple: a message with input can never be shown to multiple users, i mean what should happen when one user picks option1 and the other user picks option3 ? 20150916 21:54:08< celticminstrel> Then the game should be informed that this is what happened, right? 20150916 21:54:42< gfgtdf> celticminstrel: the game knows that this happened, but which [command] block shodul be executed 20150916 21:54:44< Ravana_> execute it as unsynced action for each client? 20150916 21:54:53< celticminstrel> Or execute all of them. 20150916 21:54:55-!- Elvish_Hunter [~elvish_hu@wesnoth/developer/elvish-hunter] has left #wesnoth-dev ["Ciao!"] 20150916 21:56:22< gfgtdf> Ravana_: no the main purpose of [message] is beeing simple. I reall this that woudl confuse most users. 20150916 21:56:42< Ravana_> true enough 20150916 21:57:37< gfgtdf> celticminstrel: yes that could be implemented with the plural form, in 1.13.0 we don't supprt that though. But if you think that there are mutiple usecases for it you can do it 20150916 21:58:15< celticminstrel> Not sure. 20150916 21:59:07-!- noy [~Noy@wesnoth/developer/noy] has joined #wesnoth-dev 20150916 22:00:38< celticminstrel> I'll get it working normally first. 20150916 22:02:46< gfgtdf> celticminstrel: hmm i really coudl imagine that there are usecases for it for exampel when you want to make some type of election or something. 20150916 22:03:36< celticminstrel> So what's the difference between singular and plural forms, really? 20150916 22:03:48< celticminstrel> Is it just whether they take an integer or an array for that argument? 20150916 22:04:18< gfgtdf> celticminstrel: yes that teh main diffrence (and also whether they returns a config or a table of configs) 20150916 22:04:28< celticminstrel> Oh right, the return value. 20150916 22:04:34< gfgtdf> celticminstrel: the also have some diffrences on how they handle sides with empty controllers 20150916 22:04:43< celticminstrel> Oh? 20150916 22:05:16< gfgtdf> celticminstrel: the singular form will then try teh next side if thats empty, teh plural form will just return the firt entry iirc 20150916 22:05:52< celticminstrel> ...okay then? 20150916 22:06:03< gfgtdf> ? 20150916 22:06:28-!- mjs-de [~mjs-de@x4db5b1bb.dyn.telefonica.de] has quit [Remote host closed the connection] 20150916 22:07:57< celticminstrel> Okay, would that be about equivalent to saying that the singular form ensures at least one side matches (choosing subsequent sides if necessary) and the plural form skips sides with empty controllers? (Why would the controller be empty anyway? Or do you mean null controllers?) 20150916 22:08:27< celticminstrel> s/at least/exactly/ 20150916 22:09:01< gfgtdf> null empty is teh same here 20150916 22:09:16< gfgtdf> yes 20150916 22:10:06< gfgtdf> celticminstrel: oh another difference: teh singular form wont show teh message during prestert events 20150916 22:10:24< gfgtdf> (on purpose that is) 20150916 22:10:51< celticminstrel> Shouldn't that be in the plural form too? 20150916 22:12:40< gfgtdf> celticminstrel: yes it should 20150916 22:13:15< gfgtdf> celticminstrel: at lst until http://gna.org/bugs/index.php?23297 is fixed 20150916 22:13:19< gfgtdf> until* 20150916 22:13:23< gfgtdf> leaset* 20150916 22:19:50-!- noy [~Noy@wesnoth/developer/noy] has quit [Quit: noy] 20150916 22:29:18-!- boucman [~rosen@wesnoth/developer/boucman] has quit [Remote host closed the connection] 20150916 22:30:13-!- travis-ci [~travis-ci@ec2-54-144-46-7.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 22:30:14< travis-ci> gfgtdf/wesnoth-old#539 (sync_choice_split - 4081b0b : gfgtdf): The build is still failing. 20150916 22:30:14< travis-ci> Build details : https://travis-ci.org/gfgtdf/wesnoth-old/builds/80729220 20150916 22:30:14-!- travis-ci [~travis-ci@ec2-54-144-46-7.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 22:48:28-!- ancestral [~ancestral@97-116-185-165.mpls.qwest.net] has quit [Quit: i go nstuf kthxbai] 20150916 22:54:50-!- joet [~joet@host86-163-221-131.range86-163.btcentralplus.com] has joined #wesnoth-dev 20150916 22:58:10< celticminstrel> Okay, so the looping tags were satisfactory, right? zookeeper? I could push them directly to master. 20150916 22:58:23< celticminstrel> Without the break/continue stuff which can be done separately. 20150916 22:59:16< vultraz> which pr are they again? 20150916 22:59:23< vultraz> I'd like to take a look at the lua again 20150916 22:59:56< celticminstrel> No PR, they're just on my foreach branch. 20150916 23:00:08< celticminstrel> I hadn't gotten to making a PR yet. 20150916 23:00:14< vultraz> Oh, ok 20150916 23:00:15-!- zookeeper [~lmsnie@wesnoth/developer/zookeeper] has quit [Ping timeout: 255 seconds] 20150916 23:00:50< celticminstrel> Something like https://github.com/CelticMinstrel/wesnoth/tree/foreach 20150916 23:03:05-!- [Relic] [~Relic]@2602:306:33a3:6d30:70fc:577b:4641:bae9] has joined #wesnoth-dev 20150916 23:04:10< celticminstrel> Hmm, pressing Escape from a message popup only works if there's no input, so maybe I could return only two values instead of three. 20150916 23:04:17-!- travis-ci [~travis-ci@ec2-54-158-137-139.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 23:04:18< travis-ci> gfgtdf/wesnoth-old#540 (sync_choice_split - 0482fee : gfgtdf): The build has errored. 20150916 23:04:18< travis-ci> Build details : https://travis-ci.org/gfgtdf/wesnoth-old/builds/80732926 20150916 23:04:18-!- travis-ci [~travis-ci@ec2-54-158-137-139.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 23:06:09< celticminstrel> If there's no input at all, then first value is -1 or -2 and second value is nil. 20150916 23:06:11< vultraz> I wonder why you have both break and return as possible values when they both do the same thing 20150916 23:06:52< celticminstrel> I don't recall keeping return as a possible value.3 20150916 23:07:15< gfgtdf> vultraz, shadowm: any optioin on pr491 (change od sync_choice interface) ? 20150916 23:07:19< celticminstrel> If there's options, first value would be the option chosen (1-indexed, because Lua). Second option would be nil. 20150916 23:07:32< celticminstrel> If there's text input, first option would be 0, second option would be text entered. 20150916 23:07:51< celticminstrel> If there's both options and text input, first value would be option chosen, second value would be text entered. 20150916 23:07:58< vultraz> what is the return value of the cancel button? 20150916 23:08:03< celticminstrel> -2 20150916 23:08:22< gfgtdf> celticminstrel: you have a pr for the message function already ? 20150916 23:09:31< celticminstrel> By the way, anyone know anything about this? "Since gui2::show_wml_message needs to do undrawing the chatlines can get garbled and look dirty on screen. Force a redraw to fix it. @todo This hack can be removed once gui2 is finished." 20150916 23:09:42< celticminstrel> It seems to still work if I comment that out. 20150916 23:10:08< celticminstrel> (There are chat messages up thanks to wesnoth.message calls.) 20150916 23:10:12< vultraz> chatlines are not garbled even if the dialog draws over them? 20150916 23:10:30< celticminstrel> gfgtdf: Not yet, getting close. 20150916 23:10:34< celticminstrel> Well. 20150916 23:10:50< celticminstrel> Getting close on the Lua API function, at least. Haven't yet tested the [message]. 20150916 23:11:29< celticminstrel> vultraz: There's a funny thing there, actually. I don't see how the dialog could possibly draw over the chat lines. 20150916 23:11:45< vultraz> celticminstrel: very very very long output 20150916 23:11:57< vultraz> it happens with, say dbms (from the wlp) output 20150916 23:11:59< celticminstrel> No, there's never more than... six or so chat lines. 20150916 23:12:07< celticminstrel> Maybe closer to ten. 20150916 23:12:24< celticminstrel> Oh wait, maybe if you combined that with a ridiculously long message? 20150916 23:12:41< vultraz> yes 20150916 23:13:37< celticminstrel> I'll try that. 20150916 23:14:34-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has joined #wesnoth-dev 20150916 23:15:49-!- louis94 [~~louis94@109.129.229.117] has quit [Quit: Konversation terminated!] 20150916 23:20:16-!- irker038 [~irker@uruz.ai0867.net] has quit [Quit: transmission timeout] 20150916 23:21:08< celticminstrel> Doesn't look garbled. 20150916 23:21:50< vultraz> Then remove the hack 20150916 23:25:10-!- mattsc [~mattsc@wesnoth/developer/mattsc] has quit [Quit: So long and thanks for all the fish.] 20150916 23:28:33-!- hashdev [4fdec179@gateway/web/freenode/ip.79.222.193.121] has quit [Ping timeout: 246 seconds] 20150916 23:29:00-!- travis-ci [~travis-ci@ec2-54-234-164-83.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 23:29:01< travis-ci> gfgtdf/wesnoth-old#540 (sync_choice_split - 0482fee : gfgtdf): The build has errored. 20150916 23:29:01< travis-ci> Build details : https://travis-ci.org/gfgtdf/wesnoth-old/builds/80732926 20150916 23:29:01-!- travis-ci [~travis-ci@ec2-54-234-164-83.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 23:29:15-!- shadowm_desktop [ignacio@wesnoth/developer/shadowm] has quit [Ping timeout: 256 seconds] 20150916 23:38:50-!- travis-ci [~travis-ci@ec2-54-234-164-83.compute-1.amazonaws.com] has joined #wesnoth-dev 20150916 23:38:51< travis-ci> gfgtdf/wesnoth-old#541 (sync_choice_split - a48edb3 : gfgtdf): The build was fixed. 20150916 23:38:51< travis-ci> Build details : https://travis-ci.org/gfgtdf/wesnoth-old/builds/80736137 20150916 23:38:51-!- travis-ci [~travis-ci@ec2-54-234-164-83.compute-1.amazonaws.com] has left #wesnoth-dev [] 20150916 23:44:22-!- joet [~joet@host86-163-221-131.range86-163.btcentralplus.com] has quit [Quit: Leaving] 20150916 23:55:33-!- Stephen [0ecaaf17@gateway/web/freenode/ip.14.202.175.23] has joined #wesnoth-dev 20150916 23:55:58-!- Stephen is now known as Guest90959 --- Log closed Thu Sep 17 00:00:20 2015