Update to 2.5.3 (#78)
* Update to 2.5.3 - add `exists_in_package` script function, which take a string argument of the form "/package-name.package-extension/file-name.file-extension" and return true if the file can be loaded by MSE. - add 175% export zoom option * update watermark handling * collapse card_watermark_1 etc into custom_watermark_link(#) * added verify_watermark_image, a script that runs in custom watermark fields * if the field is a potentially valid link, it will run exists_in_package, width_of, and length_of and caches their info in the field * if the image is too big, it displays it normally instead of erroring --------- Co-authored-by: cajun <12363371+CajunAvenger@users.noreply.github.com>
This commit is contained in:
@@ -41,7 +41,9 @@ comma_count := filter_text@(match:",")
|
||||
semicolon_count := filter_text@(match:";")
|
||||
|
||||
split_comma := split_text@(match: " *, *")
|
||||
split_semicolon := split_text@(match: " *; *")
|
||||
line_count := split_text@(match:"\n+",include_empty:false) + length
|
||||
px_split := split_text@(match:"p?x",include_empty:false)
|
||||
|
||||
word_count := break_text@(match:"[^[:space:]]+") + length
|
||||
|
||||
@@ -92,6 +94,13 @@ clamp := {
|
||||
round_up := {to_int(0.99999999999998+input)} #### 0.99999999999999 == 1, leave the 8
|
||||
round_near := {to_int(0.5+input)}
|
||||
to_number_lax := { to_number(input) or else to_number(trim(input)) or else 0 }
|
||||
|
||||
#### type_name("string") returns string ("string") so fix that
|
||||
#### type_name(nil) is fine
|
||||
remove_paren := replace@(match:" \\(.*", replace:"")
|
||||
type_of := {
|
||||
remove_paren(type_name(input))
|
||||
}
|
||||
#### reads from a comma separated list like an array
|
||||
pull_comma_array := {
|
||||
array := split_text(input, match:divider)
|
||||
@@ -2322,21 +2331,44 @@ correction_coeff := {
|
||||
else 0) + (if lbh >= 4 then 0.5*lbh-1)
|
||||
}
|
||||
############################################################## Watermarks
|
||||
custom_watermark_1 := { if set.custom_watermark_1 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_1 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_2 := { if set.custom_watermark_2 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_2 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_3 := { if set.custom_watermark_3 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_3 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_4 := { if set.custom_watermark_4 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_4 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_5 := { if set.custom_watermark_5 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_5 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_6 := { if set.custom_watermark_6 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_6 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_7 := { if set.custom_watermark_7 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_7 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_8 := { if set.custom_watermark_8 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_8 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_9 := { if set.custom_watermark_9 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_9 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_10 := { if set.custom_watermark_10 != "" then "/magic-mainframe-extras.mse-include/" + set.custom_watermark_10 else "/magic-modules.mse-include/watermarks/other/planeswalker.png" }
|
||||
custom_watermark_a := {"/magic-modules.mse-include/watermarks/other/planeswalker.png"}
|
||||
custom_watermark_b := {"/magic-modules.mse-include/watermarks/other/planeswalker.png"}
|
||||
invert_watermark_1 := { false }
|
||||
invert_watermark_2 := { false }
|
||||
invert_watermark_3 := { false }
|
||||
verify_watermark_image := {
|
||||
array := split_comma(input)
|
||||
if not has_png(array.0)
|
||||
then array.0
|
||||
else (
|
||||
wm_link := array.0
|
||||
wm_exists := exists_in_package("/magic-mainframe-extras.mse-include/"+wm_link)
|
||||
if not wm_exists then (
|
||||
wm_link + ",Not found,Ensure the file name is correct in /data/magic-mainframe-extras and reload"
|
||||
) else (
|
||||
wm_width := width_of("/magic-mainframe-extras.mse-include/"+wm_link)
|
||||
wm_height := height_of("/magic-mainframe-extras.mse-include/"+wm_link)
|
||||
if (wm_width > 1024 or wm_height > 1024)
|
||||
then wm_link + ",File found,Limit watermarks to 1024x1024px or smaller for color blending"
|
||||
else wm_link + ",File found,{wm_width}x{wm_height}px"
|
||||
)
|
||||
)
|
||||
}
|
||||
custom_watermark_link := {
|
||||
field := set["custom_watermark_"+input]
|
||||
array := split_comma(field)
|
||||
#### not blank, has png, is either verified or old link that's probably fine
|
||||
if array.0 != "" and has_png(array.0) and array.1 or else "" != "Not found"
|
||||
then "/magic-mainframe-extras.mse-include/"+field
|
||||
else "/magic-modules.mse-include/watermarks/other/planeswalker.png"
|
||||
}
|
||||
custom_card_watermark := {
|
||||
tag := if face == 1 then "" else "_" + face
|
||||
field := styling["card_watermark"+tag] or else ""
|
||||
array := split_comma(field)
|
||||
#### not blank, has png, is either verified or old link that's probably fine
|
||||
if array.0 != "" and has_png(array.0) and array.1 or else "" != "Not found"
|
||||
then "/magic-mainframe-extras.mse-include/"+field
|
||||
else "/magic-modules.mse-include/watermarks/other/planeswalker.png"
|
||||
}
|
||||
card_new_color := {
|
||||
if card.card_color == "white" then "w"
|
||||
else if card.card_color == "blue" then "u"
|
||||
@@ -2562,17 +2594,17 @@ watermark_scripts :=
|
||||
"universes beyond ponies nightmare moon": { watermark_blend(wm_directory + "ponies/nightmare moon.png") }
|
||||
"universes beyond ponies luna": { watermark_blend(wm_directory + "ponies/luna.png") }
|
||||
|
||||
"custom watermark one": { watermark_blend(custom_watermark_1(), custom:true) }
|
||||
"custom watermark two": { watermark_blend(custom_watermark_2(), custom:true) }
|
||||
"custom watermark three": { watermark_blend(custom_watermark_3(), custom:true) }
|
||||
"custom watermark four": { watermark_blend(custom_watermark_4(), custom:true) }
|
||||
"custom watermark five": { watermark_blend(custom_watermark_5(), custom:true) }
|
||||
"custom watermark six": { watermark_blend(custom_watermark_6(), custom:true) }
|
||||
"custom watermark seven": { watermark_blend(custom_watermark_7(), custom:true) }
|
||||
"custom watermark eight": { watermark_blend(custom_watermark_8(), custom:true) }
|
||||
"custom watermark nine": { watermark_blend(custom_watermark_9(), custom:true) }
|
||||
"custom watermark ten": { watermark_blend(custom_watermark_10(), custom:true) }
|
||||
"custom watermark card": { watermark_blend(custom_watermark_a(), custom:true) }
|
||||
"custom watermark one": { watermark_blend(custom_watermark_link(1), custom:true) }
|
||||
"custom watermark two": { watermark_blend(custom_watermark_link(2), custom:true) }
|
||||
"custom watermark three": { watermark_blend(custom_watermark_link(3), custom:true) }
|
||||
"custom watermark four": { watermark_blend(custom_watermark_link(4), custom:true) }
|
||||
"custom watermark five": { watermark_blend(custom_watermark_link(5), custom:true) }
|
||||
"custom watermark six": { watermark_blend(custom_watermark_link(6), custom:true) }
|
||||
"custom watermark seven": { watermark_blend(custom_watermark_link(7), custom:true) }
|
||||
"custom watermark eight": { watermark_blend(custom_watermark_link(8), custom:true) }
|
||||
"custom watermark nine": { watermark_blend(custom_watermark_link(9), custom:true) }
|
||||
"custom watermark ten": { watermark_blend(custom_watermark_link(10), custom:true) }
|
||||
"custom watermark card": { watermark_blend(custom_card_watermark(face:face), custom:true) }
|
||||
|
||||
"set symbol": { if (styling.watermark_render or else set.blend_with_colors) == "glow" then glow_watermark_blend(symbol_variation(symbol: set.symbol, variation: "watermark")) else shadow_watermark_blend(symbol_variation(symbol: set.symbol, variation: "watermark")) }
|
||||
]
|
||||
|
||||
@@ -318,42 +318,52 @@ set field:
|
||||
type: text
|
||||
name: custom watermark 1
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 1. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 2
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 2. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 3
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 3. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 4
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 4. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 5
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 5. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 6
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 6. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 7
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 7. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 8
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 8. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 9
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 9. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: text
|
||||
name: custom watermark 10
|
||||
description: Set this image in magic-watermarks.mse-include as Custom Watermark 10. If smaller than 500x500, add ";length;height;" to the end, ex ".png;400;400;"
|
||||
script: verify_watermark_image(value)
|
||||
set field:
|
||||
type: choice
|
||||
name: blend with colors
|
||||
|
||||
@@ -209,16 +209,16 @@ choice images:
|
||||
universes beyond ponies nightmare moon: /magic.mse-game/watermarks/ponies_waning_moon.png
|
||||
universes beyond ponies luna: /magic.mse-game/watermarks/ponies_waxing_moon.png
|
||||
|
||||
custom watermark one: script: watermark_blend(face:1, custom_watermark_1())
|
||||
custom watermark two: script: watermark_blend(face:1, custom_watermark_2())
|
||||
custom watermark three: script: watermark_blend(face:1, custom_watermark_3())
|
||||
custom watermark four: script: watermark_blend(face:1, custom_watermark_4())
|
||||
custom watermark five: script: watermark_blend(face:1, custom_watermark_5())
|
||||
custom watermark six: script: watermark_blend(face:1, custom_watermark_6())
|
||||
custom watermark seven: script: watermark_blend(face:1, custom_watermark_7())
|
||||
custom watermark eight: script: watermark_blend(face:1, custom_watermark_8())
|
||||
custom watermark nine: script: watermark_blend(face:1, custom_watermark_9())
|
||||
custom watermark ten: script: watermark_blend(face:1, custom_watermark_10())
|
||||
custom watermark card: script: watermark_blend(face:1, custom_watermark_a())
|
||||
custom watermark one: script: watermark_blend(face:1, custom_watermark_link(1))
|
||||
custom watermark two: script: watermark_blend(face:1, custom_watermark_link(2))
|
||||
custom watermark three: script: watermark_blend(face:1, custom_watermark_link(3))
|
||||
custom watermark four: script: watermark_blend(face:1, custom_watermark_link(4))
|
||||
custom watermark five: script: watermark_blend(face:1, custom_watermark_link(5))
|
||||
custom watermark six: script: watermark_blend(face:1, custom_watermark_link(6))
|
||||
custom watermark seven: script: watermark_blend(face:1, custom_watermark_link(7))
|
||||
custom watermark eight: script: watermark_blend(face:1, custom_watermark_link(8))
|
||||
custom watermark nine: script: watermark_blend(face:1, custom_watermark_link(9))
|
||||
custom watermark ten: script: watermark_blend(face:1, custom_watermark_link(10))
|
||||
custom watermark card: script: watermark_blend(face:1, custom_card_watermark(face:1))
|
||||
|
||||
set symbol: script: shadow_watermark_blend(symbol_variation(symbol: set.symbol, variation: "watermark"))
|
||||
Reference in New Issue
Block a user