Need some help with Keywords [Resolved]

Login or register to post comments
Sat, 2017-08-12 19:34
Mahx Michael
Mahx Michael's picture

Hi!
I'm currently working on keywords for my Cardfight!! Vanguard template and have encountered a problem:
I have compleated the keywords file, added all the required fields (only have one keyword yet, though), and remembered to set has keywords: true. I have also remembered to add include file: keywords in the game file.
But when I go to the keywords window, all my listed keywords are red, and I can't use them.
Could someone please help me with this?
Many thanks A happy smile

Here is my keywords file in case you need it:

Keywords
#################### Keywords ####################

has keywords: true

###################################### Keyword modes

keyword mode:
	name: core
	description: Core set keywords, with reminder text
keyword mode:
	name: pseudo
	description: Pseudo keywords, no reminder text, italic font
keyword mode:
	name: action
	description: Keyword actions, reminder text at end of line
keyword mode:
	is default: true
	name: custom
	description: Custom keywords
	
###################################### Keyword parameters

keyword parameter type:
	name: symbol
	match: [(auto|act|cont)][[VRG/]CQW0-9SEPDABITUHJKL<>][(lb4|lb5|gb1|gb2|stride|guardian|legion|leg18|leg19|leg20|leg21|leg22|leg23|leg24)]+
	
keyword parameter type:
	name: cost
	match: [CQW0-9]+
	#match: [ ][CQW0-9]*|[-—][^(\n]*
	#separator before is: [ —-]
	#separator after is: [.]
	#optional: false
	#separator script: long_dash()
	
keyword parameter type:
	name: number
	match: [XYZ0-9]+
	refer script:
		name: normal
		description: (1,2,3)
		script: \{{input}\}
	refer script:
		name: as words
		description: (one, two, three)
		script: \{english_number({input})\}
	refer script:
		name: as words, use "a" for 1
		description: (a, two, three)
		script: \{english_number_a({input})\}
	refer script:
		name: as words, use "" for 1
		description: (, two, three)
		script: \{english_number_multiple({input})\}
	refer script:
		name: as ordinal words
		description: (first, second, third)
		script: \{english_number_ordinal({input})\}

keyword parameter type:
	name: action
	match: [^(:\n]+
	separator after is: [.]
	reminder script: alternative_cost()

keyword parameter type:
	name: one_word
	match: [A-Za-z0-9]+

keyword parameter type:
	name: name
	match: [^(.:;\n—]+
	refer script:
		name: normal
		description: No changes made.
		script: \{{input}\}
	refer script:
		name: singular
		description: Removes plurality from words.
		script: \{english_singular({input})\}
	refer script:
		name: separate words with "and/or"
		description: Changes spaces to " and/or ". "Elf Warrior" becomes "Elf and/or Warrior".
		script: \{separate_words(spacer: " and/or ", {input})\}
	refer script:
		name: separate words with "or"
		description: Changes spaces to " or ". "Elf Warrior" becomes "Elf or Warrior".
		script: \{separate_words(spacer: " or ", {input})\}

keyword parameter type:
	name: prefix
	description: Prefix for things like "<something>walk" in Magic
	optional: false
	match: [A-Z][A-Z,a-z’ ]*
	#example: Forest

keyword parameter type:
	name: english_number
	match: [ upto]*[(an? |one |two |three |four |five |six |seven |eight |nine |ten )]*

keyword parameter type:
	name: a
	match: [an?]*

keyword parameter type:
	name: clan
	match: [(Royal Paladin|Oracle Think Thank|Angel Feather|Shadow Paladin|Gold Paladin|Genesis|Kagero|Nubatama|Tachikaze|Murakumo|Narukami|Nova Grappler|Dimension Police|Entranger|Link Joker|Spike Brothers|Dark Irregulars|Pale Moon|Gear Chronicle|Granblue|Bermuda Triangle|Aqua Force|Megacolony|Great Nature|Neo Nectar|Cray Elemental|Touken Ranbu)]

###################################### Keywords
keyword:
	keyword: Lord
	match: Lord
	mode: core
	reminder: If you have a unit without a same clan as this unit, this unit cannot attack


I found out that I had forgotten to add scripts for the keywords in my script file, so nothing would happen even if I made the keywords.

At the second last sequence of the script file, I have set a script that makes all text in paranthesis becom italic (imitated from Magic), but how do I make it so that only the content becomes italic, and not the parenthesises themselves?
Here is my script file:

Script
############### Scripts #################

######################################### Defaults and Localization

# TODO: Add language file
#include file: language

# Shape of cards, can be changed in style files
card_shape := { "normal" }

######################################### Numbers and sorting
# Sorting scripts ordered by rarity -> clan -> grade -> name
rarity_sort := {
	if card.rarity == "UR" then "A"
	else if card.rarity == "GR" then "B"
	else if card.rarity == "RRRR" then "C"
	else if card.rarity == "RRR" then "D"
	else if card.rarity == "RR" then "E"
	else if card.rarity == "R" then "F"
	else if card.rarity == "C" then "G"
	else if card.rarity == "SP" then "S"
	else if card.rarity == "SGR" then "T"
	else if card.rarity == "SCR" then "U"
	else "Z"
}

# Sorting clans: First letter is for Nation, second is for Clan
clan_sort := {
	if card.clan == "Royal Paladin" then "AA"
	else if card.clan == "Oracle Think Tank" then "AB"
	else if card.clan == "Angel Feather" then "AC"
	else if card.clan == "Shadow Paladin" then "AD"
	else if card.clan == "Gold Paladin" then "AE"
	else if card.clan == "Genesis" then "AF"
	else if card.clan == "Kagero" then "BA"
	else if card.clan == "Nubatama" then "BB"
	else if card.clan == "Tachikaze" then "BC"
	else if card.clan == "Murakumo" then "BD"
	else if card.clan == "Narukami" then "BE"
	else if card.clan == "Nova Grappler" then "CA"
	else if card.clan == "Dimension Police" then "CB"
	else if card.clan == "Entranger" then "CC"
	else if card.clan == "Link Joker" then "CD"
	else if card.clan == "Spike Brothers" then "DA"
	else if card.clan == "Dark Irregulars" then "DB"
	else if card.clan == "Pale Moon" then "DC"
	else if card.clan == "Gear Chronicle" then "DD"
	else if card.clan == "Granblue" then "EA"
	else if card.clan == "Bermuda Triangle" then "EB"
	else if card.clan == "Aqua Force" then "EC"
	else if card.clan == "Megacolony" then "FA"
	else if card.clan == "Great Nature" then "FB"
	else if card.clan == "Neo Nectar" then "FC"
	else if card.clan == "Cray Elemental" then "XA"
	else if card.clan == "Touken Ranbu" then "XB"
	else "ZZ"
}

# Sortig grades from top and down:
grade_sort := { 9 - card.grade }

# Process the name for sorting rules
sort_name :=
	# Remove "The", "A", and "And" at the beginning
	replace@(match: "^(The|An?) ", replace: "") +
	# Remove commas and apostrophes
	replace@(match: "(,|')", replace: "") +
	# Remove bold and italic tags
	replace@(match: "(<b>|<i>|</b>|</i>)", replace: "") +
	# Make lowercase
	to_lower

is_special := { card.rarity == "SP" or card.rarity == "SGR" or card.rarity == "SCR" }

set_filter := {
	if is_special()
		then { is_special() }
	else
		{ not is_special() }
}

card_position := {
	position (
		of: card
		in: set
		order_by: { rarity_sort() + clan_sort() + grade_sort() + sort_name(card.name) }
		filter: set_filter()
	) + 1
}

card_count := {
	number_of_items(in: set, filter: set_filter())
}

card_number := { (if is_special() then "S" else if card_position() < 100 then "0" else "") + (if card_position() < 10 then "0" else "") + card_position() }

######################################### Textbox and textfield scripts
# Function for automatic italic-font
italic_filter :=
	# step 1 : remove italic tags
	remove_tag@(tag: "<i-flavor>") +
	remove_tag@(tag: "<i>") +
	# step 2 : surround by <i> tags
	{ "<i>" + input + "</i>" }

# Filetr for textbox content
text_filter :=
	# step 1 : remove all automatic tags
	remove_tag@(tag: "<sym-auto>") +
	remove_tag@(tag: "<i-auto>")   +
	remove_tag@(tag: "<b-auto>")   +
	# step 2: reminder text for 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  := "<nospellcheck>{keyword}</nospellcheck>"
			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>(?<img src="http://magicseteditor.sourceforge.net//smile/sad.gif" title="A sad &#039;frowny&#039;" alt="A sad &#039;frowny&#039;" class="smiley-content"/>?!<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 2+n : italicize text in parenthesis
	replace@(
		match: "[(]([^)\n]|[(][^)\n]*[)])*[)]?",
		in_context: "(^|[[:space:]])<match>|<atom-keyword><match></",
		replace: "<i-auto>&</i-auto>")

######################################### Utilities for Keywords
alternative_cost := replace@(match:"^[A-Z]", replace: { to_lower() })

Sun, 2017-08-13 15:11
Sensei Le Roof
Sensei Le Roof's picture

Look at the action parameter type entry. Do you really need it, and if so, do you have an alternative_cost() script somewhere in your game or style file? Do you need alternative_cost()? Magic uses it for non-mana payments like "Sacrifice a creature", "Tap three untapped Wizards you control", "Pay 27 life", etc.

Online dictionaries abound. It's time to start using them.

Sun, 2017-08-13 21:08
Mahx Michael
Mahx Michael's picture

My alternative_cost() is located in my script file. I tried to remove the action parameter, but it didn't make any difference.
And no, I'm not sure wich parameters I will need at all, just decided to add those that made most sense...
Even when I remove all the parameter entries, the error is still there.

Is there any scripts that defines the default keyword functions like reminder text and italic psaudo names? Or how does mse know what to do with a psaudo ability and what to do with the other modes? Does the fact that I didn't include old and expert make any difference? Is what happens to each format predetermined by mse?

Mon, 2017-08-14 13:58
Mahx Michael
Mahx Michael's picture

I found a solution to the first problem, could you please try help me out with the second one? (Listed under the first)

I got some help and found out how to fix it, thank you anyways!

Mon, 2017-08-14 14:35
Sensei Le Roof
Sensei Le Roof's picture

Why would you not want the parentheses italic? (That would look weird and possibly introduce cutoff.)

Online dictionaries abound. It's time to start using them.

Mon, 2017-08-14 17:49
Mahx Michael
Mahx Michael's picture

Simply because thats how the game I'm templating does it (I know it's kinda wierd )
But someone else helped me, so you don't need to worry about it

Tue, 2017-08-15 16:09
Sensei Le Roof
Sensei Le Roof's picture

I know, I was just curious because it was that much off the usual.

Online dictionaries abound. It's time to start using them.