-
Notifications
You must be signed in to change notification settings - Fork 0
Yoshida Language
The Yoshida Language is an self developed logic language to help design dynamic and complex card designs.
To use define any variable just create a new value in your card design. Not in the body but in design json itself. If you create the variable with the name "var_test" then you can use the value with the syntax "$var_test".
Always existing variables:
- var_true_path = Contains the path of folder where the setup script is running.
🔹 "<<a&b&c"
This function helps to build dynamic stirngs. You can connect any number of strings or variables. If you use variables they will automatically converted to strings which can be helpful to display numbers, booleans or arrays inside a text.
🔹 ">>math equations"
The math builder helps to calculate dynamic value. Everything can be used as long as there is a space between everything. This includes numbers, brackets and variables.
Every object can have an logic parameter to define some automations. Here is a list and explanation of all currently available functions.
Repeat the generation of an image with different values
🔹FOR#$var_name#int_from#int_to[#int_steps]🔹
The '#' is to seperate the different attributes and needs to be placed! Only int_steps is optional and if not set manually is automatically equals to 1.
The $var_name can be anything like $cache_var even if the variable does not yet exist. This variable can then be used to format values based on the iteration of the loop. In the yu-gi-oh_tcg.json file this feature is used for the star levels. Here is a simplified cut from this usecase:
{
"type": "image",
"desc": "Level Stars",
"x": ">>380 - ( $var_star_index + 1 ) * 27",
"logic": "FOR#$var_star_index#0#$var_monster_lvl"
}
This for-loop in the logic parameter will go from 0 to the value of $var_monster_lvl and write the current value to $var_star_index. In the x parameter this variable is used to generate the set off.
- $var_star_index = 4 | 380 - ( 4 + 1 ) * 27 = 245
- $var_star_index = 5 | 380 - ( 5 + 1 ) * 27 = 218
Set the Visibility of an object
🔹 VISBILITY#TRUE/IF#value1==value2
There are 2 ways to set the visibility of an object. The first is just to say visble true or false with 'VISIBILTY#TRUE' or 'VISIBILITY#FALSE'.
The more complex way is to connect it with an IF:
- VISIBILITY#IF#var_test == 5
This feature is not perfected at the moment and you need to implement the variable without '$' as well as keeping the spaces before and after the equal signs.
In the future this feature should be replaced by an IF logic handler and just keep the true and false for VISIBILITY.
Copy settings from previous defined object
🔹 COPY#MODE#id
This feature simply copies values from an existing object. There are 2 modes at the moment:
- EMPTY
- copies only values that are empty in the current object and does not overwrite exisiting values
- ALL
- overwrites all exisitng values
If you select an unsupported mode the copy function will be ignored.
The copy feature implements the "id" parameter inside an object. To be able to copy from any object, the target object needs to have an id so it can be uniquely defined. If there are multiple objects with the same id the first will be selected. An example on how this feature can be used is displayed below. Here I used it to create a Dropshadow behind the text and then only needed to change a few parameters. This helped me keep the card design code a bit cleaner.
{
"type": "text",
"id": "text_cocktail_shadow",
"desc": "Cocktail Name Shadow",
"x": ">>w_%50",
"y": ">>h_%60 + 7",
"align": "center",
"anchor": "mm",
"text": "$var_cocktail_name",
"color": "#000000",
"font_size": 120,
"font": "Stone Serif Semibold"
},
{
"type": "text",
"desc": "Cocktail Name",
"y": ">>h_%60",
"color": "#FFFFFF",
"font_size": 125,
"logic": "COPY#EMPTY#text_cocktail_shadow"
}
Anything missing or inacurate? Please write an issue or contact me.