oddnanref
3/3 Beast
Am I squirrel yet?
Posts: 198
Formerly Known As: Destiny, or full of yourself
Favorite Card: The one that is red and white all over
Favorite Set: The one with the new cool things
Color Alignment: White, Blue, Red
|
Post by oddnanref on May 12, 2018 2:27:25 GMT
I wanted to know if there is a compiled list of functions and ways to get values somewhere here or in the old forums.
I want to write a keyword that requires a differentiation between plural and singular but also requires the use of the english_number_a(param) function within an if statement.
For example,
Exile {english_number_a(param1)} {if remove_tags(param1) == "a" then "land" else "lands"}. If you do put a Wastes land token onto the battlefield{if remove_tags(param1) == "a" then "" else " for each card exiled"}.
Is there a way to write this in a simpler way? In the old forums I found that you could technically write this as:
Exile {english_number_a(param1)} land(s). If you do put a Wastes land token onto the battlefield{if remove_tags(param1) == "a" then "" else " for each card exiled"}.
but it does not seem to be working now.
The list is mainly to know what other things are possible to write using the language. It might also help later if I start scripting my own templates.
|
|
|
Post by cajun on May 12, 2018 3:28:20 GMT
Knowing what you're trying to do would be helpful. (s) is looking for "1" and presumably you're using "a" so its leaving the plural. If your mechanic is something like "foo 1" then the last reminder is pretty close.
Exile {english_number_a(param1)} land(s). If you do put a Wastes land token onto the battlefield{if param1.value == "1" then "" else " for each card exiled"}. if it's like "foo a land" then the simpler way would be restructuring the reminder
Exile {param1} land{if param1.value == "a" then "" else "s"}. Create a Wastes land token for each land exiled this way.
The stuff that is "built in" to the language is either general language stuff or specific filters that are in the magic code. Here's some easier ones
has_cc() //true if casting cost isn't blank has_pt() //true if power and/or toughness isn't blank is_spell() //true if the card type contains Instant or Sorcery is_targeted() //true if the rules text contains the full word "target"
and some of the fiddlier ones
contains(field, match:"text") //true if field contains "text" replace(field, match:"text", replace:"new") //the field except every "text" is replaced by "new" filter_text(field, match:"text") //pulls out every instance of "text", if there are multiple they will string together like "texttexttext" separate_words(field, spacer: " and/or ") //mostly used for creature types, like if you want it to count Humans and/or Soldiers, such as Amplify.
fields are generally one of your parameters (which will look like param1 or param1.value) or a part of your card (which will look like card.card_color, card.super_type, card.rule_text, etc.)
|
|
oddnanref
3/3 Beast
Am I squirrel yet?
Posts: 198
Formerly Known As: Destiny, or full of yourself
Favorite Card: The one that is red and white all over
Favorite Set: The one with the new cool things
Color Alignment: White, Blue, Red
|
Post by oddnanref on May 12, 2018 4:01:34 GMT
Thanks
|
|
oddnanref
3/3 Beast
Am I squirrel yet?
Posts: 198
Formerly Known As: Destiny, or full of yourself
Favorite Card: The one that is red and white all over
Favorite Set: The one with the new cool things
Color Alignment: White, Blue, Red
|
Post by oddnanref on Jun 3, 2018 22:56:26 GMT
I have another keyword which I wanted to program. It is related to the color of the card. {Code} If {p1 := to_lower(remove_tags(card.card_color)) p2 := replace(p1, match:"hybrid,", replace:"") p3 := replace(p2, match:"horizontal", replace:"") p4 := replace(p3, match:"multicolor,", replace:"") c1 := filter_text(p4, match:",") n1 := length(c1)
if contains(card.card_color, match:"white") then "[W]" else ""}{
p5 := replace(p4, match:"white,", replace:"") c1 := filter_text(p5, match:",") n1 := length(c1) if n1 == 1 and contains(p4, match:"white") then " or " else if n1 > 1 and contains(p4, match:"white") then ", " else ""}{
if contains(card.card_color, match:"blue") then "" else ""}{
p6 := replace(p5, match:"blue,", replace:"") c1 := filter_text(p6, match:",") n1 := length(c1) if n1 == 1 and contains(p4, match:"blue") then " or " else if n1 > 1 and contains(p4, match:"blue") then ", " else ""}{
if contains(card.card_color, match:"black") then "" else ""}{
p7 := replace(p6, match:"black,", replace:"") c1 := filter_text(p6, match:",") n1 := length(c1) if n1 == 1 and contains(p4, match:"black") then " or " else if n1 > 1 and contains(p4, match:"black") then ", " else ""}{
if contains(card.card_color, match:"red") then "[R]" else ""}{
p8 := replace(p7, match:"red,", replace:"") c1 := filter_text(p8, match:",") n1 := length(c1) if n1 == 1 and contains(p4, match:"red") then " or " else if n1 > 1 and contains(p4, match:"red") then ", " else ""}{
if contains(card.card_color, match:"green") then "[G]" else ""} was spent to cast, {if is_spell() then "then:" else "when this permanent enters the battlefield it:"}
I would appreciate help in reducing the amount of code this requires. Also, another question is there a way to have variable v := 12 then reduce the number in the variable like v := v - 1.
|
|
SirnightNano
1/1 Squirrel
Posts: 92
Favorite Card: Thopter Spy Network
Color Alignment: White, Blue, Red
|
Post by SirnightNano on Jun 5, 2018 15:38:38 GMT
oddnanref From the look of that mechanic, it would rather be a pseudo keyword rather than a normal one, so you wouldn't need to program it like that. What is the mechanic meant to do precisely?
|
|
oddnanref
3/3 Beast
Am I squirrel yet?
Posts: 198
Formerly Known As: Destiny, or full of yourself
Favorite Card: The one that is red and white all over
Favorite Set: The one with the new cool things
Color Alignment: White, Blue, Red
|
Post by oddnanref on Jun 5, 2018 17:09:39 GMT
Yeah, I was just starting to go crazy programing. I do that when I start understanding a code. I mean, yeah. It has become a pseudo. Though I wanted it to be a keyword ability or action because it takes less space. Ability words just do not help. Having Firespout with three colors is already a lot of text to cram. Adding a fourth is too much. I did not like those restraints. I am looking for another way around.
Though I can repurpose the code. Let's say it comes with a +1/+1 counter for mana spent in its color. Costs would be ::2R:: and such. The cards would be a colorless hybrid that gets +1/+1 counters if you use the ::R:: option instead of paying the ::2::. Or I could invert it, if you spend mana that is not from its color then it gets the counters.
|
|