Jump to content
Korean Random
SmashPuppet

new macro {{.}} since 6.1.0 question

Recommended Posts

Has anyone used this and if so can you provide any examples? The note in the changelog here: http://www.modxvm.com/en/news/xvm-6-1-0-for-world-of-tanks-0-9-7/ is very vague.

 

Is it limited to only static macro value replacement or can one do something with dynamic macros as well? I would love to be able to predefine replacement values for something like {{my-frags}} but every attempt has failed. EDIT:(just looked at macros.txt again and noticed it's static only) - Therein lies my problem =)

 

Would love to know more about it though.

 

Or how one might be able to predefine replacement values for dynamic macros. If that's even possible.

 

What I mean is this:

 

{{my-frags=1?PREDEFINED_STRING_HERE}}

 

I hope what I'm asking makes sense. If it can be done, then the sky is the limit for changing those values on the fly. Which would be fun and more interesting than the same thing over and over again. Very curious!

 

Cheers!

~Smash

Edited by SmashPuppet

Share this post


Link to post

Short link
Share on other sites

Which would be fun and more interesting than the same thing over and over again. Very curious!

 

 

 

I agree.

 

What I would also like to see is a {{randomize}} macro, where you can put together and assign a set of strings from which the {{randomize}} macro can randomly pick from.  :ok:

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Thanks sech_92. I know about nesting the macros but was hoping to be able to set up an array or define.

 

If that can be done, then we could do other things with the defines before they get passed back to output. Write values once, use many times. Just like colors but with dynamic macros.

It's ok though. I don't think I am asking the question properly. It may not be possible. It never hurts to ask!

 

Though I am still curious about how to use {{.}}

 

Thank you!

Share this post


Link to post

Short link
Share on other sites

let us suppose this text in playerPanel.xc root element

"predef_array": {
  "1": "str1"
  "2": "str2"
  "3": "str3"
  "4": "str4"
}

then a call to it will be

{{.playerPanel.predef_array.{{myfrags}}}}
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

 

let us suppose this text in playerPanel.xc root element

"predef_array": {
  "1": "str1"
  "2": "str2"
  "3": "str3"
  "4": "str4"
}

then a call to it will be

{{.playerPanel.predef_array.{{myfrags}}}}

 

You sir are worth your weight in gold! =) Thank you so very much. I almost had it right. 

 

I was using {{.my-frags}} instead of .{{my-frags}} =O

 

 

Cheers!

Share this post


Link to post

Short link
Share on other sites

I tried it on markersNormalDead.xc but could not make it work. What am I doing wrong?  :hmm:

 

"frags": {
  "1": "FIRST BLOOD",
  "2": "DOUBLE KILL",
  "3": "TRIPLE KILL"
},

 

"damageMessage": "{{.markersDeadNormal.frags.{{my-frags}}}}",

 

also tried 

 

"damageMessage": "{{.frags.{{my-frags}}}}",

 

 

markersDeadNormal.xc in spoiler

Share this post


Link to post

Short link
Share on other sites

 

 

markersDeadNormal.xc in spoiler
 It would be much more useful to upload the config with your experiments for us to see what you write, where and how.

 

"damageMessage": "{{.markersDeadNormal.frags.{{my-frags}}}}",
this is wrong. The path is described in terms of config sections, not filenames. E.g.
"damageMessage": "{{.markers.ally.dead.normal.frags.{{my-frags}}}}"
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Thank you for your attention and your patience, sech_92. We are learning.  :hmm:

 

The reason this subject was brought up is because we are trying to optimize performance of our configs. 

 

For the damage message for OTMs when a tank is destroyed, we have this screenshot:

 

2uj2lhv.jpg

 

which we accomplish by using the the following code in markersDeadNormal.xc:

 

/ /TEXT FOR NORMAL DAMAGE (see description of macros in the readme-en.txt).
"damageMessage": "<img src='cfg://iO/img/otm/dmg-kind/floating/{{dmg-kind=fire?fire|{{dmg-kind=ramming?ramming|{{dmg-kind=drowning?drowning|{{dmg-kind=world_collision?world_collision|{{dmg-kind=death_zone?death_zone|{{vtype-l=LT?LT|{{vtype-l=MT?MT|{{vtype-l=HT?HT|{{vtype-l=TD?TD|{{vtype-l=SPG?SPG|other}}}}}}}}}}}}}}}}}}}}.png' width='80' height='48'>\n<font color='#FE4302'>{{my-frags=1?FIRST BLOOD|{{my-frags=2?DOUBLE KILL|{{my-frags=3?TRIPLE KILL|{{my-frags=4?ULTRA KILL|{{my-frags=5?MULTI KILL|{{my-frags=6?MONSTER KILL|{{my-frags=7?KILLING SPREE|{{my-frags=8?RAMPAGE|{{my-frags=9?UNSTOPPABLE|{{my-frags=10?GOD-LIKE|{{my-frags=11?SEAL CLUBBER|{{my-frags=12?RNGesus LOVES YOU|{{my-frags=13?GOLD SPAMMER|{{my-frags=14?WARPACK USER|{{my-frags=15?SON OF SERB}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}</font>\n<font face='TechnicBold' size='16' color='#FFFF00'>{{vehicle}}</font><font face='mono' size='14' color='#FFFF00'> DESTROYED</font>",

 

However, we want to optimize the code by calling from a string array the 'announcement strings' for progressing number of frags --- FIRST BLOOD for 1 kill, DOUBLE KILL for 2 kills, etc, etc.. If we can optimize the code, we can lessen the lag and improve performance of the code. Also, editing the strings in the future will be much easier on the string array than on the long line of code. 

 

Can we replace the bold code above by doing something like this:

 

We add this string array:

 

"frags": {
  "1": "FIRST BLOOD",
  "2": "DOUBLE KILL",
  "3": "TRIPLE KILL"

  etc,

  etc.
},

 

which is called from this modified "damageMessage"

 

/ /TEXT FOR NORMAL DAMAGE (see description of macros in the readme-en.txt).

"damageMessage": "<img src='cfg://iO/img/otm/dmg-kind/floating/{{dmg-kind=fire?fire|{{dmg-kind=ramming?ramming|{{dmg-kind=drowning?drowning|{{dmg-kind=world_collision?world_collision|{{dmg-kind=death_zone?death_zone|{{vtype-l=LT?LT|{{vtype-l=MT?MT|{{vtype-l=HT?HT|{{vtype-l=TD?TD|{{vtype-l=SPG?SPG|other}}}}}}}}}}}}}}}}}}}}.png' width='80' height='48'>\n<font color='#FE4302'>{{.frags.{{my-frags}}}}</font>\n<font face='TechnicBold' size='16' color='#FFFF00'>{{vehicle}}</font><font face='mono' size='14' color='#FFFF00'> DESTROYED</font>",

 

and have the same effect as the screenshot above?

 

Is it at all possible?

 

Here is the full markersDeadNormal.xc file.

markersDeadNormal.xc [Mediafire]

 

Please refer to lines 10 to 14 for the string array, and line 39 for "damageMessage".

 

 

 

Help me Obiwan Kenobi, you're my only hope.  :sob:

Share this post


Link to post

Short link
Share on other sites

We find learning fun as well. But this one has stumped us.

 

I also included a zip of my "experiment" as well. The whole markers set of .xc's.

 

line 48 of various/markers/dmgMessages.xc is where we are stumbling with the path. Can I guess it is because we have the elements split into separate config files?

 

We really do appreciate the time you've spent with us. Cheers.

 

About 400k as I've included the png's that go with it etc. (dropbox link)

https://www.dropbox.com/s/wzmgbsmd5b0wn45/markerTEST.zip?dl=0

Share this post


Link to post

Short link
Share on other sites

I'm not familiar with using this macro, but in my opinion this line is wrong

{{.markers.enemy.dead.normal.enemy.damageTextPlayer.damageMessage.UT.utMsg.{{my-frags}}}}

 

this is wrong. The path is described in terms of config sections, not filenames. E.g.

 

You don't have markers section in this file, dead section in enemy section etc.

If you wanted to use replacements for frags from utMsg section, then I think you should just write {{.UT.utMsg.{{my-frags}}}}

But as I said, I've never used it and this is just how I would try doing it.

  • Upvote 2

Share this post


Link to post

Short link
Share on other sites

 

 

You don't have markers section in this file,
 Exactly this is the cause for all the mistakes.
When a mod loads configs, it forms one single object from all the files. Multifile config was "invented" to become more user-friendly, while mod still treats config in form, that was represented by a single file with subsections. 

 

{{.UT.utMsg.{{my-frags}}}}
This is the relative path from damageText to new section. The thing is {{.}} macro does not support those. Only the full path has to be used

 

Is it at all possible?
It is. But the thing is you do not "load" that piece of config. Parser loads everything what is refered to (like ${ "def.s2" } or "$ref": { "path":"damageText-a" }) while {{.}} macro is not a reference.
As I think, a good solution for you is to place "frags" to markers.xc  (below "useStandardMarkers") and use path {{.markers.frags.{{my-frags}}}}
  • Upvote 4

Share this post


Link to post

Short link
Share on other sites

I'm not familiar with using this macro, but in my opinion this line is wrong

{{.markers.enemy.dead.normal.enemy.damageTextPlayer.damageMessage.UT.utMsg.{{my-frags}}}}

 

I also knew that was wrong. I was originally using {{.UT.utMsg.{{my-frags}} but was not working still. I've been ripping my hair out trying to understand what I have been doing wrong concerning the path. =)

 

 Exactly this is the cause for all the mistakes.

When a mod loads configs, it forms one single object from all the files. Multifile config was "invented" to become more user-friendly, while mod still treats config in form, that was represented by a single file with subsections. 

 

This is the relative path from damageText to new section. The thing is {{.}} macro does not support those. Only the full path has to be used

 

It is. But the thing is you do not "load" that piece of config. Parser loads everything what is refered to (like ${ "def.s2" } or "$ref": { "path":"damageText-a" }) while {{.}} macro is not a reference.

As I think, a good solution for you is to place "frags" to markers.xc  (below "useStandardMarkers") and use path {{.markers.frags.{{my-frags}}}}

 

 

I will try this right now. What you are saying makes perfect sense and I believe I am understanding how it works. I have never run into path issues like this before in all these years!

 

I made the suggested changes and edited my markersDeadNormal/Extended.xc "damageTextPlayer" to point to markers.xc and BOOM! it works! Thank you for your patience!

 

NCgYjer.png

 

I hope this thread can answer other people's problems if wanting to use {{.}} and run into path issues like this.

Edited by SmashPuppet
  • Upvote 1

Share this post


Link to post

Short link
Share on other sites

Thank you, thank you, thank you, all you good people for making this happen. :gawi: 

 

 (I can now make up for all the lost sleep)  :heh:

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.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...