mse version: 0.3.8 short name: PlaneSculptors full name: PS Export 1.5 position hint: 110 version: 2023-02-04 installer group: magic/Export/planesculptors create directory: true depends on: package: magic.mse-game version: 2020-04-01 game: magic file type: *.txt|*.txt|*.*|*.* # By caeonosphere # Written by modifying thequinn's IsochronDrafter exporter () # Namecheck by cajun option field: type: choice name: export images choice: no choice: .jpg choice: .full.jpg description: Export images script: symbol_font := "magic-mana-small" symbol_font_size := 12 escape_linebreaks := replace@(match: "\n", replace: "///br///") remove_linebreaks := replace@(match: "\n", replace: "") remove_brackets := replace@(match: "]", replace: "", in_context: "\\[(\\+|-)?[0-9]+: ")+ replace@(match: "\\[", replace: "", in_context: "(\\+|-)?[0-9]+: ") exporter_name_filter := filter_text@(match:"!exporte?r?name [^\n]+") exporter_name_grabber := replace@(match:"!exporte?r?name ", replace:"") card_name := { remove_tags(replace(replace(if exporter_name_grabber(exporter_name_filter(card.notes)) != "" then exporter_name_grabber(exporter_name_filter(card.notes)) else card.name, match:" $", replace:""), match:"’", replace:"'")) } compare_card_name := { if exporter_name_grabber(exporter_name_filter(input.notes)) != "" then exporter_name_grabber(exporter_name_filter(input.notes)) else input.name } determine_shape := { if (contains(card.shape, match:"normal") or contains(card.shape, match:"planeswalker") or card.loyalty_2 != "") and card.name_2 != "" then "double" else if contains(card.shape, match:"double") then "split" else if contains(card.shape, match:"mini plane card") then "split" else if contains(card.shape, match:"plane card") then "plane" else if contains(card.shape, match:"battle") then "split" else if contains(card.shape, match:"leveler") then "normal" else if contains(card.shape, match:"saga") then "normal" else if contains(card.shape, match:"class") then "normal" else if contains(card.shape, match:"adventure") then "vsplit" else if contains(card.shape, match:"aftermath") then "vsplit" else if contains(card.shape, match:"planeswalker") then "normal" else if contains(card.shape, match:"shifted") then "normal" else replace(card.shape, match:" faced", replace:"") } resized_image := { sh := determine_shape() write_image_file( card, file:card_name()+options.export_images, width: if sh == "double" then 752 else if sh == "split" then 523 else if sh == "plane" then 800 else 375, height: if sh == "split" then 375 else if sh == "plane" then 559 else 523 ) } paragraph_count := replace@(match:"\n", replace:"�")+ filter_text@(match:"�") write_leveler := { #Check for Mainframe special text first (if card.special_text or else "" != "" then remove_brackets(card.special_text) else card.rule_text +"\nLEVEL "+card.level_1+" | " +(if card.pt_2 !="" then card.pt_2+" | ") +card.rule_text_2 +"\n"+(if card.level_2 !="" then "LEVEL "+card.level_2+" | ") +(if card.pt_3 !="" then card.pt_3+" | ") +card.rule_text_3) } write_plane := { card.rule_text + (if card.rule_text_2 != "" then "\n" + card.rule_text_2) } write_walker := { #Check for Mainframe special text first (if card.special_text or else "" != "" then remove_brackets(card.special_text) else # The First Ability card.loyalty_cost_1 +(if card.loyalty_cost_1 !="" then ": ") +split_text(match:"\n", card.rule_text).0 # The Second Ability +(if contains(paragraph_count(card.rule_text), match:"�") then "\n") +card.loyalty_cost_2 +(if card.loyalty_cost_2 !="" then ": ") +(if contains(paragraph_count(card.rule_text), match:"�") then split_text(match:"\n", card.rule_text).1) # The Third Ability +(if contains(paragraph_count(card.rule_text), match:"��") then "\n") +card.loyalty_cost_3 +(if card.loyalty_cost_3 !="" then ": ") +(if contains(paragraph_count(card.rule_text), match:"��") then split_text(match:"\n", card.rule_text).2) # The Fourth Ability +(if contains(paragraph_count(card.rule_text), match:"���") then "\n") +(if card.loyalty_2 == "" then card.loyalty_cost_4) +(if card.loyalty_cost_4 !="" and card.loyalty_2 == "" then ": ") +(if contains(paragraph_count(card.rule_text), match:"���") then split_text(match:"\n", card.rule_text).3)) +"\n" +"Starting loyalty: "+card.loyalty } write_walker_2 := { #Check for Mainframe special text first (if card.special_text_2 or else "" != "" then remove_brackets(card.special_text_2) else # The First Ability card.loyalty_cost_4 +(if card.loyalty_cost_4 !="" then ": ") +split_text(match:"\n", card.rule_text_2).0 # The Second Ability +(if contains(paragraph_count(card.rule_text), match:"�") then "\n") +card.loyalty_cost_5 +(if card.loyalty_cost_5 !="" then ": ") +(if contains(paragraph_count(card.rule_text_2), match:"�") then split_text(match:"\n", card.rule_text_2).1) # The Third Ability +(if contains(paragraph_count(card.rule_text), match:"��") then "\n") +card.loyalty_cost_6 +(if card.loyalty_cost_6 !="" then ": ") +(if contains(paragraph_count(card.rule_text_2), match:"��") then split_text(match:"\n", card.rule_text_2).2) # The Fourth Ability +(if contains(paragraph_count(card.rule_text), match:"���") then "\n") +card.loyalty_cost_7 +(if card.loyalty_cost_7 !="" then ": ") +(if contains(paragraph_count(card.rule_text_2), match:"���") then split_text(match:"\n", card.rule_text_2).3)) +(if card.loyalty_2 != "" then "\n"+"Starting loyalty: "+card.loyalty_2) } write_sparker := { #Check for Mainframe special text first (if card.special_text_2 or else "" != "" then remove_brackets(card.special_text_2) else # The First Ability card.loyalty_cost_5 +(if card.loyalty_cost_5 !="" then ": ") +split_text(match:"\n", card.rule_text_2).0 # The Second Ability +(if contains(paragraph_count(card.rule_text_2), match:"�") then "\n") +card.loyalty_cost_6 +(if card.loyalty_cost_6 !="" then ": ") +(if contains(paragraph_count(card.rule_text_2), match:"�") then split_text(match:"\n", card.rule_text_2).1) # The Third Ability +(if contains(paragraph_count(card.rule_text_2), match:"��") then "\n") +card.loyalty_cost_7 +(if card.loyalty_cost_7 !="" then ": ") +(if contains(paragraph_count(card.rule_text_2), match:"��") then split_text(match:"\n", card.rule_text_2).2) # The Fourth Ability +(if contains(paragraph_count(card.rule_text_2), match:"���") then "\n") +card.loyalty_cost_8 +(if card.loyalty_cost_8 !="" then ": ") +(if contains(paragraph_count(card.rule_text_2), match:"���") then split_text(match:"\n", card.rule_text_2).3)) +(if card.loyalty_2 != "" then "\n"+"Starting loyalty: "+card.loyalty_2) } write_rules := { if card.loyalty != "" then escape_linebreaks(to_html(write_walker())) else if contains(card.shape, match:"leveler") then escape_linebreaks(to_html(write_leveler())) else if contains(card.shape, match:"saga") then escape_linebreaks(to_html(card.special_text)) else if contains(card.shape, match:"plane card") then escape_linebreaks(to_html(write_plane())) else if card.special_text != "" then escape_linebreaks(to_html(card.special_text)) else escape_linebreaks(to_html(card.rule_text)) } write_rules_2 := { if contains(card.shape, match:"planeswalker") and card.power != "" then escape_linebreaks(to_html(write_sparker())) else if card.loyalty != "" or card.loyalty_2 != "" then escape_linebreaks(to_html(write_walker_2())) else if card.special_text_2 != "" then escape_linebreaks(to_html(card.special_text_2)) else escape_linebreaks(to_html(card.rule_text_2)) } write_card := { "\n"+determine_shape() +"\n"+card.card_number +"\n"+remove_linebreaks(cmc(card.casting_cost)) +"\n"+(if card.rarity == "masterpiece" then "special" else card.rarity) +"\n"+remove_linebreaks(card_name()) +"\n"+card.card_color +"\n"+symbols_to_html(card.casting_cost) +"\n"+remove_linebreaks(to_text(card.type)) +"\n"+remove_linebreaks(to_text(card.power)) +"\n"+remove_linebreaks(to_text(card.toughness)) +"\n"+write_rules() +"\n"+escape_linebreaks(to_html(card.flavor_text)) +"\n"+to_html(remove_linebreaks(card.illustrator)) +"\n"+remove_linebreaks(remove_tags(card.name_2)) +"\n"+card.card_color_2 +"\n"+symbols_to_html(card.casting_cost_2) +"\n"+remove_linebreaks(to_text(card.type_2)) +"\n"+remove_linebreaks(to_text(card.power_2)) +"\n"+remove_linebreaks(to_text(card.toughness_2)) +"\n"+write_rules_2() +"\n"+escape_linebreaks(to_html(card.flavor_text_2)) +"\n"+to_html(remove_linebreaks(card.illustrator_2)) +"\n===========" } ##run the name check check_unique := { count := 0 for x from 0 to length(input)-1 do if compare_card_name(input[x]) == name then count := count + 1 count } write_images := if options.export_images == "no" then "" else for each card in cards do resized_image() for each card in cards do if check_unique(cards, name:card_name()) > 1 then trace("Warning: Repeated name: " + card.name) write_cards := for each card in cards do write_card() wordshtml := to_string( set.title+"\n" +"1.0\n" +write_cards) write_text_file(file:"set.txt", wordshtml) wordshtml