shuttlecrossing
0/0 Germ
Posts: 16
Favorite Card: Deadbridge Chant
Favorite Set: Rise of the Eldrazi
|
Post by shuttlecrossing on Jun 15, 2023 7:09:52 GMT
I'm looking to script a field that places different images based on how much text is in another field (in this case, "Theme"). The total length can be between 0 and 4 characters; if there are 0 characters then the field is invisible, so I just repeated image 1 for both 0 and 1 character length.
I've read the documentation but I'm not sure what to use to establish this. content_length seems to be the incorrect term, as does number_of_items. I'll put my code below. Help would be greatly appreciated!!
field: top: 0 left: 0 height: 402 width: 298 z index: 3 visible: { if card.Theme != "" then true else false } render style: image choice images: default: { if card.Theme.number_of_items == 0 then symbol-mask.png else if card.Theme.number_of_items == 1 then symbol-mask.png else if card.Theme.number_of_items == 2 then symbol-mask-2.png else if card.Theme.number_of_items == 3 then symbol-mask-3.png else if card.Theme.number_of_items == 4 then symbol-mask-4.png }
The intended result would be something like theme: A (results in image 1) theme: AB (results in image 2) theme: ABC (results in image 3) theme: B (results in image 1) theme: BC (results in image 2) etc.
|
|
GenevensiS
2/2 Zombie

Profile pic by Dark Fluffy
Posts: 106
Favorite Card: Baleful Strix
Favorite Set: Urza's Saga
Color Alignment: Blue, Black
|
Post by GenevensiS on Jun 15, 2023 8:53:58 GMT
length(card.Theme) is the construct you're looking for.
Rename the "symbol-mask.png" file to "symbol-mask-1.png" then you can write:
visible: { 1 <= length(card.Theme) && length(card.Theme) <= 4 }
default: { "symbol-mask-" + length(card.Theme) + ".png" }
|
|
shuttlecrossing
0/0 Germ
Posts: 16
Favorite Card: Deadbridge Chant
Favorite Set: Rise of the Eldrazi
|
Post by shuttlecrossing on Jun 15, 2023 9:22:46 GMT
This worked, thank you very much!
|
|