--- Log opened Tue Jul 03 00:00:57 2018 20180703 00:04:40-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 00:04:47-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 01:52:45-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 01:52:51-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 02:41:38-!- mattsc [~mattsc@wesnoth/developer/mattsc] has quit [Quit: So long and thanks for all the fish.] 20180703 03:24:19< discordbot1> Is that code supposed to work? More specifically, do I give the values correctly from one macro through the in-between to the other. https://bpaste.net/show/a89aef74d332 20180703 03:26:10< discordbot1> At the end you're substituting COLOSSEUM_SIDE with two parameters when its definition expects 3. 20180703 03:26:22< discordbot1> I assume that was meant to be COMPUTER_SIDE instead. 20180703 03:27:37< discordbot1> indeed. 20180703 03:28:07< discordbot1> Other than that it's pretty standard fare and should work. 20180703 03:28:47< discordbot1> So nothing like brackets being lost in the middle macro? 20180703 03:29:34< discordbot1> Do you mean curly braces {}, square brackets [], or round parentheses ()? 20180703 03:29:43< discordbot1> the round ones 20180703 03:30:13< discordbot1> I have no idea how they interact across macro substitutions tbh. 20180703 03:31:24< discordbot1> I believe they are part of the macro substitution syntax itself, so they should be "lost" on the first substitution. 20180703 03:31:41< discordbot1> I tried making round ones around the curly in the COMPUTER_SIDE macro, where it calles the other one. 20180703 03:31:59< discordbot1> I have the last 2 days beein trying to figure out what is wrong in the add-on, basically it works, but if I do some changes I get issues which should not be there ... I post the error message 20180703 03:33:11< discordbot1> As a rule of thumb in my code, if they're supposed to take a potentially-multi-line string (e.g. code), I generally make recursive macros use parentheses for every parameter. 20180703 03:33:39< discordbot1> e.g. {COLOSSEUM_SIDE ({SIDE}) ({OTHER_WML}) (blah blah blah)} 20180703 03:33:56< discordbot1> I believe I encountered some interesting issues in the early days including a segmentation fault otherwise. 20180703 03:34:17< discordbot1> (Which was probably fixed at a later point.) 20180703 03:35:17< discordbot1> An alternative way to define my approach is that I assume that if the engine can read something wrong, it will read it wrong. 20180703 03:39:39< discordbot1> Thats's the output, the curly brackets I added as suggested https://bpaste.net/show/88fa29ab5002 20180703 03:40:34< discordbot1> the part with the long whitespace... that is because the code uses tabs, with wmlindent run it's shown nicer 20180703 03:41:30< discordbot1> Parentheses, not curly brackets (braces). 20180703 03:41:35< discordbot1> what surprises me is the talk about optional arguments .... and why SIDE is missing 20180703 03:41:47< discordbot1> I make a point of calling them brackets, braces, and parentheses to avoid confusion. 20180703 03:42:26< discordbot1> So what does the code look like right now? 20180703 03:43:07< discordbot1> The optional arguments error is because the preprocessor is seeing a naked foo=bar line at some point along the substitution chain and that's the syntax for optional macro arguments now. 20180703 03:44:21< discordbot1> https://bpaste.net/show/12eefaf3098b 20180703 03:44:57< discordbot1> That sounds resonable 20180703 03:45:57< discordbot1> That code works for me. 20180703 03:45:58< discordbot1> I could imagine that there may be some other place among this ...3k code, where something is leaking, but not causing problems... 20180703 03:46:18< discordbot1> (Insofar it doesn't cause any errors, I put it somewhere were it wouldn't have any effect.) 20180703 03:47:51< discordbot1> One Issue I have is that if I make a specific string translatable, the translatation mark remains ingame.... and there are no nbsp next to it... I couldn't explain that... 20180703 03:48:47< discordbot1> By the translation mark you mean the underscore? 20180703 03:48:51< discordbot1> yes 20180703 03:49:01< discordbot1> Is it being wrapped in quotes somehow? 20180703 03:49:26< discordbot1> e.g. #define FOO BAR baz="{BAR}" #enddef {FOO ( _ "bat")} 20180703 03:49:50< discordbot1> (I have no idea if that would produce valid WML but if it would it would look like baz=" _ ""bat""".) 20180703 03:52:31< discordbot1> it's quite straight forward... it's this one https://github.com/sevu/Col/blob/main/scenario/Colosseum_3p.cfg#L348 20180703 03:53:27< discordbot1> Okay, no idea then. 20180703 04:23:00< discordbot1> https://cdn.discordapp.com/attachments/442775044590927873/463560265619734539/ARG.png 20180703 04:24:12< discordbot1> The other thing about these new optional arguments..... As a classical macro with one required argument more instead of the optional one it works. 20180703 04:25:26< discordbot1> I don't even know how to use optional arguments yet. 20180703 04:25:35< discordbot1> oh, wait I have a typo here 20180703 04:25:58< discordbot1> I tried the other day and it didn't work and I gave up since for the most part I have no need for them (especially since half of my codebase uses custom WML actions). 20180703 04:29:10< discordbot1> As you wrote already all your code it's too late... 20180703 04:29:55< discordbot1> It could be useful to seperate things like when doing real programming 20180703 04:32:30< discordbot1> Like, the variable check is some internal scenario logics, the macro for the shop doesn't need to know about it...normally I would not make everything an argument..... 20180703 04:32:57< discordbot1> (the word argument is missleadeing here though.....) 20180703 05:48:37< discordbot1> here's an easy example of optional arguments 20180703 05:48:39< discordbot1> #define GUI_FILLER #arg WIDTH 0 #endarg #arg HEIGHT 0 #endarg [column] grow_factor = 0 [spacer] width = {WIDTH} height = {HEIGHT} [/spacer] [/column] #enddef 20180703 05:48:59< discordbot1> use: {GUI_FILLER WIDTH=100} 20180703 05:54:00< discordbot1> @shadowm the only difference is that #arg is defined within the scope of #define/#enddef, #endarg should usually be on the same line as the arg value, and you need to specify arg name in the macro invocation instead of relying on order 20180703 05:54:19< discordbot1> I am aware. 20180703 05:59:19-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 05:59:26-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 12:11:17< discordbot1> If there are normal arguments as well, does it matter at which position the optional one is? 20180703 12:31:46< Soliton> https://wiki.wesnoth.org/PreprocessorRef#Macro_inclusions 20180703 12:35:34< discordbot1> Though you can't (or at least couldn't when I tried) use multi-line WML when providing a value to a default argument. 20180703 12:38:33< Soliton> did you put it in parentheses? 20180703 12:38:57< discordbot1> yes 20180703 12:40:46< Soliton> that sounds like a bug then. there is a multiline example in the PR description: https://github.com/wesnoth/wesnoth/pull/876 20180703 12:43:00< discordbot1> ahhhh.... the parenthesises are also including the optional arguments name, not starting from the equals sign 20180703 12:43:44< discordbot1> ooh 20180703 12:44:21< discordbot1> yeah, that works then. 20180703 12:45:14< discordbot1> though somewhat surprisingly, the following displays nothing at all: #define TEST #arg MESG [message] message="default" [/message] #endarg {MESG} #enddef {TEST MESG=([message] message="new" [/message])} 20180703 12:45:26< discordbot1> no message, no errors 20180703 12:48:04< Soliton> you could check what it expands to with wesnoth -p. 20180703 12:54:00< discordbot1> looks like it does log something, at least: warning preprocessor: Unrecognized optional argument passed to macro 'TEST': 'message' 20180703 12:55:09< Soliton> i guess it completely ignores that argument then. 20180703 12:55:45< discordbot1> just not what I was expecting, given that problems with macro arguments usually end up displayed pretty prominently when opening Wesnoth. 20180703 12:58:47< discordbot1> also I guess it assumes that just a blank was passed to MESG, since the default [message] also is not displayed, and it generated no output for the TEST macro at all. 20180703 13:47:38-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 13:47:45-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 13:49:01-!- hk238 [~kvirc@unaffiliated/hk238] has joined #wesnoth-umc-dev 20180703 14:18:56-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 14:19:03-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 14:43:06-!- sevu [~Shiki@p54854CA8.dip0.t-ipconnect.de] has joined #wesnoth-umc-dev 20180703 15:14:14-!- sevu [~Shiki@p54854CA8.dip0.t-ipconnect.de] has quit [Quit: Verlassend] 20180703 15:58:05< hk238> oh refactoring this wave spawning system seems arduous 20180703 16:00:57< hk238> can you save lua tables in Wml variables? 20180703 16:28:27< discordbot1> refactoring a wave spawning system? Did do sth. like that for Colosseum the last days 20180703 16:29:04< discordbot1> the talk about optional macro arguments a few hours ago might be interressting for you 20180703 16:30:38< discordbot1> https://www.wesnoth.org/irclogs/2018/07/%23wesnoth-umc-dev.2018-07-03.log, around 12:31 20180703 16:31:04< Ravana_> not completely 20180703 16:31:16< Ravana_> I implemented orocia spawn logic in Lua last year 20180703 16:34:29< discordbot1> Shops, wave based games, ... each add-on has it's own variant... we could be great to have a set of macros which can be used across add-ons, like mainline does 20180703 16:35:19< discordbot1> *it would be great ... 20180703 16:37:10< Ravana_> people would not agree on how something should work there 20180703 16:42:37< discordbot1> I don't know... might be a problem... the potential audience for such an set of macros would be players who want a shop, for whatever reason, rather than already existing add-ons (later maybe) 20180703 16:43:16< discordbot1> I guess currently such people whould not use it at all or do copy paste programming, ending up with some variations 20180703 16:44:53< discordbot1> this new syntac for optional macro arguments would allow one to make such macros very configurable, making an optional argument out of every thing where you think it makes sense 20180703 16:45:56< discordbot1> (not sure if lua can take advantage of it though...) 20180703 16:50:11< discordbot1> I'm working on an attack event where I want the unit being attacked to say something. But, the primary unit is the attacker, so when I use "speaker=unit", the attack speaks instead of the defender. Is there a predefined ID for the second unit in this case? [event] name=attacker hits [filter] type=Wolf, Great Wolf [/filter] [filter_second] side=1 [/filter_second] [message] 20180703 16:50:12< discordbot1> speaker=unit message= _ "Wild wolves are attacking us!" [/message] [message] id=Gandfal message= _ "Kill them and keep moving! We must reach the keep!" [/message] [/event] 20180703 16:50:19< Ravana_> I would suggest not using macros in the first place and just implement it with tags 20180703 16:55:19< discordbot1> second_unit works. See https://wiki.wesnoth.org/EventWML#Predefined_Events_With_Filters, there are also more availaible in attack related events, see under attack 20180703 16:55:35< discordbot1> Thanks, will give this a read 😄 20180703 16:55:46< discordbot1> Good Luck 20180703 16:59:02< discordbot1> I didn't really look into writing that, what I saw so far was a 2000 line code without macros besides {VARIABLE}, and fixed limitations. I guess with custom tags written in lua one can archieve great things. The key would be to have some documentation to new users. 20180703 17:01:30< discordbot1> I think the guy who wrote is was a mainline developer 20180703 17:06:04-!- hk238 [~kvirc@unaffiliated/hk238] has quit [Quit: KVIrc 5.0.0 Aria http://www.kvirc.net/] 20180703 17:59:57-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 18:00:03-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 18:25:25-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 18:25:31-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev 20180703 18:34:05< discordbot1> what macro? 20180703 22:26:57-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has quit [Remote host closed the connection] 20180703 22:27:03-!- janebot [~Gambot@unaffiliated/gambit/bot/gambot] has joined #wesnoth-umc-dev --- Log closed Wed Jul 04 00:00:58 2018