Jump to content
Korean Random
Sign in to follow this  
Aslain

Creating defines that will set field positions/sizes

Recommended Posts

I'd like to change a position (and sometimes size, width and, hight too) on many elements like text fields or hp bar, in all markers*.xc files globaly. The change should be dependent on what is set in my custom file. In example when I select setup1 I will get everything positioned like I defined at setup1, and when I select setup2 it will display all elements like I selected in setup2. So basicaly I need to create some kind of easy way to switch that positions and sizes. 

 

Let's use this as example:

"tankHp": {
      "name": "Tank HP",
      "enabled": true,
      "x": 0,
      "y": -16,
      "alpha": 100,
      "textFormat": {
        "font": "$FieldFont",
        "size": 11,
        "color": "0xFCFCFC",
        "align": "center",
        "bold": true,
        "italic": false
      },
      "shadow": {
        "enabled": true,
        "distance": 0,
        "angle": 45,
        "color": "0x000000",
        "alpha": 100,
        "blur": 4,
        "strength": 2
      },
      "format": "{{hp}}"
    },

It has :

 

"x": 0,

"y": -16,

 

let's call it setup1

 

Now I have this, it's for setup2

 

"x": 10,
"y": -20,

 

I need to make a switch for it somewhere in a file, preferably in custom file.

 

I belive it should be changed to something like :

 

"x": if setup2 then 10, else 0 
"y": if setup2 then -20, else -16

 

Coud someone give me some hints on that? I would need to see some working examples for that.

Edited by Aslain

Share this post


Link to post

Short link
Share on other sites

I have some idea, but I'll post it when I'll be back from work.

 

Ok, I'm back.

Here's what I came up with.

 

Create a file setups.xc with the following content

{
  "setups":{
    "setup": "setup1",
    "setup1":{
      "x": 0,
      "y": -16
    },
    "setup2":{
      "x": 10,
      "y": -2
    }
  }
}

Put a reference to this file into @xvm.xc

"setups": ${"setups.xc":"setups"},

Change the values of x and y to

"x": "{{.setups.{{.setups.setup}}.x}}",
"y": "{{.setups.{{.setups.setup}}.y}}",
Edited by konrad509
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...