|
Post by qasur on Jun 5, 2018 21:16:47 GMT
To preface, I created my own custom templates for a new Mega man game I have been creating.
Everything about the template was working great as I did the layout of each card with their unique card-fields. Then one day, I was unable to edit the text in my text boxes. At the same time I noticed the console displaying quite a few errors (attached image). Each error seems to state "can't convert function composition to string" or "can't convert built-in function to string".
I tried addressing it by using to_string() on each function listed, but nothing changed.
I have also attached the gamefile for reference.
Thanks!
|
|
|
Post by cajun on Jun 6, 2018 4:38:51 GMT
Did you make any changes to your mse build before the change happened, such as a new template, or updating to mse 2.0.1?
Looking at the game file the main thing that's standing out is the filter_rule and replace_rule etc scripts; this isn't the typical function you use here but it looks like it might have worked at some point. Would switch those out first and see if anything clears up
tag_remove_rule -> remove_tags replace_rule -> replace tag_contents_rule -> tag contents filter_rule -> filter_text
|
|
|
Post by qasur on Jun 6, 2018 5:47:22 GMT
I have been using version 2.0.0 for many years (and was not aware of a 2.0.1 update).
Also, the game files I used as my template has been one I've been using as a template for other things for many years (12+). If something changed in the coding over that time, I just have not been fully aware.
Thanks for taking a look.
As far as a quick update since posting earlier, I'm 99.99% sure it is related to those functions (not just because the console is saying so) but because I commented out the scripts and it fixed the issue. However, can I just one-for-one replace those with the ones you mentioned without any further changes?
|
|
|
Post by cajun on Jun 6, 2018 6:16:31 GMT
can I just one-for-one replace those with the ones you mentioned without any further changes? should be able to, yes.
|
|
|
Post by qasur on Jun 6, 2018 9:21:22 GMT
I have made a lot of improvements in the text_filter function (as well as a few others places) by updating to non-rule code. After re-implementing and removing the commented-out script, it seems to be working...
Except for the "only numbers" filter. Just two fields use this function. Here is the function I wrote:
only_numbers := { filter_text@(match: "[0-9]") }
Console still reading the same, but just this function: "Can't convert from built-in function 'filter_text' closure to string while updating card value"
Thanks again!
P.S. Here is attached field code:
card field: type: text name: health points show statistics: false script: only_num(value) description: Health Points, max 31. card field: type: text name: weapon energy show statistics: false script: only_num(value) description: Weapon Energy, max 31.
|
|
|
Post by cajun on Jun 6, 2018 12:59:46 GMT
Change it to this
only_numbers := filter_text@(match: "[0-9]+") if you are only setting up a function with @s you remove the {}brackets. + lets it match more than one digit which might not be strictly necessary for filter_text but is an easy backup
|
|
|
Post by qasur on Jun 6, 2018 18:41:29 GMT
Thanks again! That fixed the number function.
But...
I must have been incorrect about my text_filter function earlier... it's still not working even after updating. This text filter version here I actually borrowed from another game altogether because it had everything I needed except for my "step 4" and "step 5" which I re-added. It still causes all the same errors in the fields now.
I can be very honest that this code language is different and I don't 100% know how to use it (and I've been trying to follow the documentation still posted on the old sourceforge page). text_filter := { # step 0 : remove all tags to prevent memory issue remove_tag@(tag: "<sym-auto>")+ remove_tag@(tag: "<i-auto>")+ remove_tag@(tag: "<b-auto>")+ # step 1 : expand keywords expand_keywords@( condition: { correct_case or (mode != "pseudo" and not used_placeholders) }, default_expand: { chosen(choice:if correct_case then mode else "lower case", set.automatic_reminder_text) }, combine: { keyword := "<b>{keyword}</b>" reminder := process_english_hints(reminder) if mode == "pseudo" then "<i-auto>{keyword}</i-auto>" else keyword + if expand then "<atom-reminder-{mode}> ({reminder})</atom-reminder-{mode}>" })+ # step 2b : move action keywords' reminder text to the end of the line replace@(match: "(<atom-reminder-action>(?: (?!<kw-).)*</atom-reminder-action></kw[^>]*>)(((?!<atom-reminder| ?<kw-)[^\n(])+)", replace: "\\2\\1")+ # step 2c : remove duplicate reminder text replace@(match: "(<atom-reminder-[^>]*>[^)]+[)]</atom-reminder-[^>]*>)([^\n]+)\\1", replace: "\\2\\1")+ # step 3a : expand shortcut ~ and CARDNAME replace@(match: "~|CARDNAME", in_context: "(^|[[:space:]]|\\()<match>", replace: "<atom-cardname>&</atom-cardname>")+ # step 3b : fill in atom fields tag_contents@(tag: "<atom-cardname>", contents: { card.name })+ # step 4 : longdash for keywords replace@(match: "--", replace: "—")+ # step 5 : uniqueness dot replace@(match: "`|::", replace: "•")+ # step 6 : Bold keywords without reminder text replace@(match: "<kw[^>]*>[^<]+</kw-a>", replace: "<b-auto>&</b-auto>")+ # step 7 : Bold keywords with reminder text replace@(match: "<kw[^>]*>[^<]+</kw-A>", replace: "<b-auto>&</b-auto>") } EDIT: Nevermind, after re-reading this entire block of text... I realized it's just as you said for the filter_numbers function, i.e. I don't need { } if I'm only using @'s... so I simply removed the brackets and voila! 
Thanks again! I'm sure I'll be back around if anything else decides not to work.
Just because you might read this, are there any potential issues to beware of if I upgrade from 2.0.0 to 2.0.1? There have been some negative effects before.
|
|
|
Post by qasur on Jun 6, 2018 19:41:45 GMT
Cajun: Is there a simple way to put line-spacing between paragraphs and/or line breaks?
I've attached a sample card from the set, Chill Penguin. After each of his bold abilities, I'd like to have the text auto-space some.
|
|
|
Post by cajun on Jun 6, 2018 20:42:14 GMT
qasur the main difference i've seen is the lack of dropdown on the Add Cards button but haven't run into any changes going to 2.0.1 otherwise. The controls for linebreak height are done in the style menu, alongside the properties, fonts etc. They look like this for magic padding left: 6 padding right: 4 line height hard: 1.2 line height line: 1.5 line height soft: 0.9 line height hard max: 1.3 line height line max: 1.6
hard is for return/enter line breaks, soft is for shift-enter/text wraparound linebreaks, and line is for the spacing between combined text fields, like magics text+flavor box.
|
|
|
Post by qasur on Jun 7, 2018 8:08:52 GMT
Thanks a million again!
|
|