|
Post by sjappo on Jan 22, 2021 11:40:58 GMT
Short time user and first time poster here. I've some programming experience, mostly making VBA scripts to manipulate Excel worksheets and some php scripting.
I've been wrestling with the scripting languages for a few days but I cannot get it to de what I want. let me explain what I want.
I have al set of 10 card fields which may or may not be filled. The fields are displayed top to bottom en filled topped to bottom. I have a card field, say LastData, that contains the number of the last filled card field.
I want to only display the first few card fields, dependent on LastData, and I want to create a box around the displayed fields.
Now, the last part is pretty easy, I can make the box height dependent on LastDate by using a formula based on LastDate value.
Second I want to skip the fields that are empty, againd depending on LastDate, and some related fields. But anything I try gives me the "Unexpected key" error. I tried things like
{if Lastdata <= x then FieldX: <card fields> else nil}
and
FieldX {if LastData <= x then <card fields> else nil}
I tried putting ( and , and " in different places to no avail. I tried some variants of the script: statement with no success. I perused the forum, the documentation, google. Nothing. I think I'm doing something fundamentally wrong but I cannot find my mistake.
So, help?
|
|
|
Post by cajun on Jan 22, 2021 12:20:09 GMT
I think I'm doing something fundamentally wrong
well i've read through this three times and i still have no idea what any of it means so maybe. can you show some of your actual code?
|
|
|
Post by sjappo on Jan 22, 2021 12:50:21 GMT
Thanks for the quick reply. Here is the relevant code from the game and style files as well as the console error:
Game:
card field: type: text name:SkillsNumber default: "1" card field: type: text name: Skill1 default: "* Skill 1" show statistics: false card field: type: choice name: Skill1Icon choice: choice: Advantage choice: Disadvantage choice: Remark
Style:
Skill1:
275 script: 276 {if card.SkillsNumber <= then (" top: 175 left: 35 width: 215 height: 25 font: name: { styling.FontDescription} size: 16 scale down to: 9 color: { styling.text_color} alignment: top left z index: 3 Skill2Icon: left: 15 top : 180 width: 15 height: 15 z index: 2 render style: image popup style: in place choice images: Advantage: GreenArrowUp.png Disadvantage: RedArrowDown.png Remark: BlackStar.png") 300 else nil} MSE Console
Warnings while reading file: C:\MSE\data\Arjan-Cards-Skills.mse-style/style
On line 275: Unexpected key: 'script' On line 276: Unexpected key: '{if card.SkillsNumber >= 2 then ("' On line 300: Unexpected key: 'else nil}'
Lines 275, 276 and 300 are numbered in the snipped from the style file.
I've started with the Skill1 code. The other 9 are still to be done.
|
|
|
Post by cajun on Jan 22, 2021 14:29:24 GMT
oh i see. you can't script the existence of a field like you're trying to do here, but you can script the visibility of them, so you'd do like
Skill1:
top: whatever
left: whatever
...
visible: {card.SkillsNumber > 0}
Skill2: top: whatever left: whatever ... visible: {card.SkillsNumber > 1} or whichever the condition is that they'd be visible
a similar thing that you need to use sometimes is scripting the width rather than the visibility, so like "width: {if condition then 200 else 0}", if you find some strange edge cases with visibility allowing you to click things that aren't visible.
|
|
|
Post by sjappo on Jan 22, 2021 15:34:50 GMT
Works like a charm Thanks so much.
And to think I came across the visible tag thinking "why would I need that, I could just not put the field in."
|
|