Jump to content
Korean Random
Kotyarko_O

infoPanel средствами XVM.

Recommended Posts

@Tornado_Odan_Rot , необходимо заранее прописывать необходимые бусты в макросе, с учетом которых ты хочешь видеть на экране Т.Т.Х. техники в прицеле.

 

Ранее клиент отдавал данные по оборудованию как союзников, так и противников до патча 0.9.20 (отдавал по крайней мере в открытом виде), в макросе это я ранее учитывал (наличие установленного досылателя, вентиляции). Сейчас же можно получить только данные о самом игроке и особого смысла автоматической подстановки их в формулу нет, т.к. игрок и сам непосредственно на экране видит точное время своей перезарядки. Как то так если коротко говоря.

Edited by night_dragon_on

Share this post


Link to post

Short link
Share on other sites

@night_dragon_on ну , допустим, я навожу на вражеский Т-10, мне говорит что перезарядка 9,73. Я знаю, при каком фарше она будет именно такой, ведь у меня КД с досылателем, вентилятором и братством составляет 10,15. Что-то тут домешивается.

ап. Домешал доппаёк - сошлось: 9,73. Можно подумать, что он отдаёт самый забущенный вариант фарша для машины. Я понял, спасибо)

Edited by Tornado_Odan_Rot

Share this post


Link to post

Short link
Share on other sites
21 минуту назад, Tornado_Odan_Rot сказал:

Можно подумать, что он отдаёт самый забущенный вариант фарша для машины.

 

@Kotyarko_O в таком виде макрос в скрипте использует у себя, именно полный фарш.

def gun_reload_equip(eq1 = 1, eq2 = 1, eq3 = 1, eq4 = 1):

Share this post


Link to post

Short link
Share on other sites


So i am trying to replicate izeberg info panel configs, but run into small "cosmetic" issue that bugs me.
Is there a way to show - instead of 0 for tanks without turret? (most of TDs for example)
turretarmor.jpg.a397bf75eba3f244deef82e067cca0a4.jpg
Right now i use this:

<br/><textformat tabstops='[65,105,145]'>Turret:<tab>{{armor_turret_front=0?{{l10n:-}}|{{armor_turret_front}}}}<tab>{{armor_turret_side=0?{{l10n:-}}|{{armor_turret_side}}}}<tab>{{armor_turret_back=0?{{l10n:-}}|{{armor_turret_back}}}}</textformat>

also i tried those:

{{armor_turret_front?{{armor_turret_front}}|}}
{{armor_turret_front=0?|{{armor_turret_front}}}}
{{armor_turret_front>0?{{armor_turret_front|}}}}

...and few others, but nothing works. :dry:
Either i get - for all tanks or it just ignores everything and shows {{armor_turret_front}} anyway. :huh:

Edited by Ress

Share this post


Link to post

Short link
Share on other sites
2 hours ago, Ress said:


So i am trying to replicate izeberg info panel configs, but run into small "cosmetic" issue that bugs me.
Is there a way to show - instead of 0 for tanks without turret? (most of TDs for example)
turretarmor.jpg.a397bf75eba3f244deef82e067cca0a4.jpg
Right now i use this:


<br/><textformat tabstops='[65,105,145]'>Turret:<tab>{{armor_turret_front=0?{{l10n:-}}|{{armor_turret_front}}}}<tab>{{armor_turret_side=0?{{l10n:-}}|{{armor_turret_side}}}}<tab>{{armor_turret_back=0?{{l10n:-}}|{{armor_turret_back}}}}</textformat>

also i tried those:


{{armor_turret_front?{{armor_turret_front}}|}}
{{armor_turret_front=0?|{{armor_turret_front}}}}
{{armor_turret_front>0?{{armor_turret_front|}}}}

...and few others, but nothing works. :dry:
Either i get - for all tanks or it just ignores everything and shows {{armor_turret_front}} anyway. :huh:

Hi... try to change this:

armor_turret_front=0?

to:

armor_turret_front=-?

 

Maybe im wrong.. but u can try...

Edited by Szulson

Share this post


Link to post

Short link
Share on other sites
14 minutes ago, Szulson said:

Hi... try to change this:


armor_turret_front=0?

to:

armor_turret_front=-?


Still shows 0 on non turreted tanks.

Well, if it can't be done, its not big deal.

Share this post


Link to post

Short link
Share on other sites

@Ress , there must be a recursive macroes:

<br/><textformat tabstops='[65,105,145]'>Turret:<tab>{{{{armor_turret_front}}=0?{{l10n:-}}|{{armor_turret_front}}}}<tab>{{{{armor_turret_side}}=0?{{l10n:-}}|{{armor_turret_side}}}}<tab>{{{{armor_turret_back}}=0?{{l10n:-}}|{{armor_turret_back}}}}</textformat>

 

Edited by Kotyarko_O
  • Upvote 2

Share this post


Link to post

Short link
Share on other sites

@Kotyarko_O Thanks it works.
Not familiar with this method (you learn everyday). I used to do it old fashion way and most of time it works just fine.
infp.thumb.jpg.4d7963678e3fab98f3c8eb98c0b7924d.jpg

Share this post


Link to post

Short link
Share on other sites

after i added the code for the weight check (green/red) on my mid-right panel, my bottom right panel don't update and shows only my stats..why?

 

shot_004.thumb.jpg.898d562cf42e7bf93c4a95bc64942a2e.jpg

 

infopanel


{
  "infoPanel": {
    // false - Disable info panel.
    // false - Отключить информационную панель.
    "enabled": true,
    // true - Show only for enemies.
    // true - Отображать только для противников.
    "enemiesOnly": false,
    //true - Show only for alive players.
    //true - Отображать только для живых игроков.
    "aliveOnly": true,
    // Hide panel delay (in seconds)
    // Задержка скрытия панели (в секундах)
    "delay": 5,
    // Key for self vehicle information display.
    // Клавиша для отображения информации о своей технике.
    "altKey": 56,
    // Values for {{py:compareDelim(X, Y)}} and {{py:compareColor(X, Y)}} macros
    // Значения для макросов {{py:compareDelim(X, Y)}} и {{py:compareColor(X, Y)}}
    "compareValues": {
      "moreThan": {
        "delim": "&gt;", // '<'
        "color": "#FF0000"
      },
      "equal": {
        "delim": "=",
        "color": "#FFFFFF"
      },
      "lessThan": {
        "delim": "&lt;", // '>'
        "color": "#00FF00"
      }
    },
    // Block of text formats. Allow multiple formats (https://koreanrandom.com/forum/topic/36811-/).
    // Блок текстовых форматов. Допускается создание нескольких форматов (https://koreanrandom.com/forum/topic/36811-/).
    "formats": [
      //"<font face='Arial' size='12' color='#9FF781' alpha='90'>{{vehicle_name}}</font> <font face='Arial' size='10'>({{vehicle_weight}}t)</font>
      "<font face='Arial' size='14' color='#D4FFAA' alpha='90'>{{vehicle_name}}</font> {{py:isTarget=trg?<font size='12' color='{{py:compareColor({{vehicle_weight}}, {{pl_vehicle_weight}})}}'>{{vehicle_weight}}t</font>|{{pl_vehicle_weight}}}}
       <br/><font face='Arial' size='14' color='#00FFFF'>T: {{armor_turret_front}}/{{armor_turret_side}}/{{armor_turret_back}}
       <br/>W: {{armor_hull_front}}/{{armor_hull_side}}/{{armor_hull_back}}</font>",
      "{{vehicle_name}}       
       <br/>{{gun_reload_equip}}s
       <br/><img src='img://gui/maps/icons/vehicle/{{icon_system_name}}.png'>
       <br/><textformat tabstops='[95]'>Gewicht: {{vehicle_weight}}t<tab>Sicht: {{vision_radius}}m</textformat>
       <br/><textformat tabstops='[65,105,145]'>Wanne:<tab>{{armor_hull_front}}<tab>{{armor_hull_side}}<tab>{{armor_hull_back}}</textformat>
       <br/><textformat tabstops='[65,105,145]'>Turm:<tab>{{armor_turret_front}}<tab>{{armor_turret_side}}<tab>{{armor_turret_back}}</textformat>
       <br/><textformat tabstops='[65,105,145]'>Munition:<tab>{{shell_type_1}}<tab>{{shell_type_2}}<tab>{{shell_type_3}}</textformat>
       <br/><textformat tabstops='[65,105,145]'>Pen:<tab>{{shell_power_1}}<tab>{{shell_power_2}}<tab>{{shell_power_3}}</textformat>
       <br/><textformat tabstops='[65,105,145]'>Schaden:<tab>{{shell_damage_1}}<tab>{{shell_damage_2}}<tab>{{shell_damage_3}}</textformat>"
    ]
  }
}

 

battlelabletemplate:


//Panel near Crosshair
    "infoPanel0": {
      "enabled": true,
      "updateEvent": "PY(ON_INFO_PANEL)",
      "x": 400,
      "y": 550,
      "width": 200,
      "height": 200,
      "align": "center",
      "valign": "center",
      "screenHAlign": "center",
      "screenVAlign": "center",
      "shadow": { "enabled": true, "distance": 1, "angle": 90, "color": "0x000000", "alpha": 80, "blur": 5, "strength": 2 },
      //"textFormat": { "align": "left", "leading": -10 },
      "textFormat": { "font": "$FieldFont", "size": 14, "color": "0xFCFCFC", "align": "left", "leading": -10 },
      "format": "{{py:infoPanelFormat(0)}}"
    },
    //Panel near Minimap
    "infoPanel1": {
      "enabled": true,
      "updateEvent": "PY(ON_INFO_PANEL)",
      "x": 500,
      "y": 420,
      "width": 250,
      "height": 250,
      "align": "center",
      "valign": "center",
      "screenHAlign": "center",
      "screenVAlign": "center",
      "shadow": { "enabled": true, "distance": 1, "angle": 90, "color": "0x000000", "alpha": 80, "blur": 5, "strength": 2 },
      "textFormat": { "font": "$FieldFont", "size": 14, "color": "0xFCFCFC", "align": "left", "leading": -12 },
      "format": "{{py:infoPanelFormat(1)}}"
    }

Share this post


Link to post

Short link
Share on other sites

@skitey , try to swap this formats: panel near crosshair to "infoPanel1" and panel near minimap to "infoPanel0".

Funny, but can help, i hope =) Otherwise i`ll rework some methods, soon.

  • Upvote 1

Share this post


Link to post

Short link
Share on other sites
43 минуты назад, Kotyarko_O сказал:

@skitey , try to swap this formats: panel near crosshair to "infoPanel1" and panel near minimap to "infoPanel0".

Funny, but can help, i hope =) Otherwise i`ll rework some methods, soon.

 

no, sorry, that did not work.

the only thing that got updated are the shell_power and shell_damage values.

the other numbers and picture are from my own tank :(

  • Upvote 1
  • Downvote 1

Share this post


Link to post

Short link
Share on other sites

А можно сделать что бы над каждым противником весел таймер сколько он перезарежается постоянно. что бы разный был. ведь у всех же перезарядка времени разная?

 

Edited by gora

Share this post


Link to post

Short link
Share on other sites

I've made some minor changes for using two panels, as follows. One panel shows the data of the targeted enemy tank, the second panel shows my tank data continuously. The second panel will be visible after you aim an enemy tank, or by pressing the altkey.  

Have a nice day :) 
Я сделал несколько небольших изменений для использования двух панелей, как показано ниже. Одна панель отображает данные о вражеском танке, вторая - постоянно показывает данные о моем танке. Вторая панель будет видна после того, как вы нацелите вражеский танк или нажмете Altkey.

Хорошего дня :)

 

two_panel.thumb.png.0244b1b7caadf64ab144d96c73491978.png

 

 

The default multiple panels scenario can be created by following Kotyarko_O description created in the first post. To keep the second panel continuously showing your tank data, you need to use the attached infoPanel.py and info_panel_data.py or insert a new class and edit two other functions in infoPanel.py file.

Сценарий с несколькими панелями по умолчанию можно создать, следуя описанию Kotyarko_O, созданному в первом посте. Чтобы вторая панель постоянно показывала данные вашего танка, вам нужно использовать прикрепленные файлы infoPanel.py и info_panel_data.py или вставить новый класс и отредактировать две другие функции в файле infoPanel.py.

 

Insert the following lines in infoPanel.py file:

Вставьте следующие строки в файл infoPanel.py:

class MyPanel(object):

    def __init__(self):
        self.textFormats = infoPanelConfig['formats'] if infoPanelConfig['enabled'] else None
        self.textsFormatted = None
        self.timer = None

    def reset(self):
        self.__init__()
        info_panel_data.reset()

    def getFuncResponse(self, funcName):
        if not hasattr(info_panel_data, funcName):
            return None
        func = getattr(info_panel_data, funcName, None)
        if (func is not None) and callable(func):
            result = func()
            return str(result) if result is not None else ''
        else:
            return None

    def setTextsFormatted(self):
        self.textsFormatted = []
        for textFormat in self.textFormats:
            for macro in MACROS:
                if macro in textFormat:
                    funcName = macro.replace('{', '').replace('}', '')
                    funcResponse = self.getFuncResponse(funcName)
                    textFormat = textFormat.replace(macro, funcResponse)
            self.textsFormatted.append(textFormat)

    def update(self, vehicle):
        if hotKeyPressed:
            return
        playerVehicle = player().getVehicleAttached()
        if playerVehicle is not None:
            if hasattr(vehicle, 'typeDescriptor'):
                info_panel_data.init(vehicle, playerVehicle)
            elif hasattr(playerVehicle, 'typeDescriptor'):
                info_panel_data.init(None, playerVehicle)
            self.setTextsFormatted()
            as_event('Show_My_Panel')

MyPanel = MyPanel()

modify the targetFocus and handleKey functions in infoPanel.py file:

измените функции targetFocus и handleKey в файле infoPanel.py:

@registerEvent(PlayerAvatar, 'targetFocus')
def targetFocus(self, entity):
    if not infoPanelConfig['enabled'] or not hasattr(entity, 'publicInfo') or (infoPanelConfig['enemiesOnly'] and (0 < getattr(entity.publicInfo, 'team', 0) == player().team)) or (infoPanelConfig['aliveOnly'] and not entity.isAlive()):
        return
    infoPanel.update(entity)
    MyPanel.update(entity)

@registerEvent(PlayerAvatar, 'handleKey')
def handleKey(self, isDown, key, mods):
    global hotKeyPressed
    if not infoPanelConfig['enabled'] or (key != infoPanelConfig['altKey']) or MessengerEntry.g_instance.gui.isFocused():
        return
    if isDown:
        infoPanel.update(player().getVehicleAttached())
        MyPanel.update(player().getVehicleAttached())
        infoPanel.hide()
        hotKeyPressed = True
    elif not isDown:
        hotKeyPressed = False
        if target() is not None and not (infoPanelConfig['enemiesOnly'] and (0 < getattr(entity.publicInfo, 'team', 0) == player().team)):
            infoPanel.update(target())
        else:
            infoPanel.hide()
    as_event('ON_INFO_PANEL')

 

 

 

Beyond the above, you need to modify the infopanel section "updateEvent" line for the second panel (this will show your tank data) in battleLabelsTemplates.xc file:

Помимо вышесказанного, вам нужно изменить строку «updateEvent» раздела инфопанели для второй панели (это покажет данные вашего танка) в файле battleLabelsTemplates.xc:

    "infoPanel1": {
      "enabled": true,
      "updateEvent": "PY(Show_My_Panel)",
      "x": 380,
      "y": 520,
      "width": 250,
      "height": 250,
      "align": "center",
      "valign": "center",
      "screenHAlign": "center",
      "screenVAlign": "center",
      "shadow": { "enabled": true, "distance": 1, "angle": 90, "color": "0x000000", "alpha": 80, "blur": 3, "strength": 2 },
      "textFormat": { "font": "$FieldFont", "size": 16, "color": "0xFCFCFC", "align": "left", "leading": -12 },
      "format": "{{py:infoPanelFormat(1)}}"
    }

 

infoPanel.py

info_panel_data.py

Edited by Scanmen
  • Upvote 3

Share this post


Link to post

Short link
Share on other sites

I've made some changes to see, my reload speed how many times is faster or slower than my opponent during the battle. Knowing this data, after enemy shot, you will know how many times you can shoot before you go back in a safe place. If enemy is faster, after your shot you must retreat immediately. Only double, triple or quadruple differences are displayed. 
Have a nice day :) 

Я сделал некоторые изменения, чтобы увидеть, сколько раз я перезагружаюсь, во сколько раз быстрее или медленнее, чем мой противник во время битвы. Зная эти данные, после выстрела противника вы узнаете, сколько раз можете стрелять, прежде чем вернуться в безопасное место. Если враг быстрее, после выстрела вы должны немедленно отступить. Отображаются только двойные, тройные или четырехкратные различия.
Хорошего дня :)

 

slower.thumb.png.93dc969f3e95cfb59ed9a935b6b808e7.pngfaster.thumb.png.0467f86b1b707ca5ffefbf0736786aa5.png

 

 

Insert the following lines in infoPanel.py file:

Вставьте следующие строки в файл infoPanel.py:

@xvm.export('compareReloadDiff', deterministic=False)
def compareReloadDiff(value1, value2):
    if (value1*4) <= value2:
        return infoPanelConfig['compareReload']['fourfaster']['comptext']
    elif (value1*3) <= value2:
        return infoPanelConfig['compareReload']['threefaster']['comptext']
    elif (value1*2) <= value2:
        return infoPanelConfig['compareReload']['twicefaster']['comptext']
    elif value1 >= (value2*4):
        return infoPanelConfig['compareReload']['fourslower']['comptext']
    elif value1 >= (value2*3):
        return infoPanelConfig['compareReload']['threeslower']['comptext']
    elif value1 >= (value2*2):
        return infoPanelConfig['compareReload']['twiceslower']['comptext']

Insert the following lines in infoPanel.xc file:

Вставьте следующие строки в файл infoPanel.xc:

    // Values for {{py:compareReloadDiff(X, Y)}} macros
    // Значения для макросов {{py:compareReloadDiff(X, Y)}}
    "compareReload": {
      "fourfaster": {
        "comptext": "  Four time faster"
      },
      "threefaster": {
        "comptext": "  Three time faster"
      },
      "twicefaster": {
        "comptext": "  Two time faster"
      },
      "fourslower": {
        "comptext": "  Four time slower"
      },
      "threeslower": {
        "comptext": "  Three time slower"
      },
      "twiceslower": {
        "comptext": "  Two time slower"
      }
    },

 

 

An example of how to use it, on infoPanel.xc "formats" section:

Пример того, как его использовать, в разделе «форматы» infoPanel.xc:

// Block of text formats. Allow multiple formats (https://koreanrandom.com/forum/topic/36811-/).
    // Блок текстовых форматов. Допускается создание нескольких форматов (https://koreanrandom.com/forum/topic/36811-/).
     "formats": [
      "<br/><textformat><b><font size='20'>{{vehicle_name}}</font></b></textformat>
       <br/><textformat tabstops='[95]'>Reload-time:<tab>{{py:isTarget=trg?<font size='16' color='{{py:compareColor({{pl_gun_reload_equip}}, {{gun_reload_equip}})}}'>{{gun_reload_equip}}{{py:compareReloadDiff({{pl_gun_reload_equip}}, {{gun_reload_equip}})}}</font>}}</textformat>
       <br/><textformat tabstops='[95,140]'>Ammo-type:<tab>{{shell_type_1}}<tab>{{shell_type_2}}</textformat>
       <br/><textformat tabstops='[95,140]'>Penetration:<tab>{{py:isTarget=trg?<font size='16' color='{{py:compareColor({{shell_power_1}}, {{pl_shell_power_1}})}}'>{{shell_power_1}}</font>}}<tab>{{py:isTarget=trg?<font size='16' color='{{py:compareColor({{shell_power_2}}, {{pl_shell_power_2}})}}'>{{shell_power_2}}</font>}}</textformat>
       <br/><textformat tabstops='[73,95,140]'>Damage:<tab>{{py:cClip({{gun_clip}})}}<tab>{{py:isTarget=trg?<font size='16' color='{{py:compareColor({{shell_damage_1}}, {{pl_shell_damage_1}})}}'>{{shell_damage_1}}</font>}}<tab>{{py:isTarget=trg?<font size='16' color='{{py:compareColor({{shell_damage_2}}, {{pl_shell_damage_2}})}}'>{{shell_damage_2}}</font>}}</textformat>
       <br/><textformat tabstops='[95,140]'>Weight:<tab>{{py:isTarget=trg?<font size='16' color='{{py:compareColor({{vehicle_weight}}, {{pl_vehicle_weight}})}}'>{{vehicle_weight}}</font>}}</textformat>",
       "<br/><textformat tabstops='[95]'>Reload-time:<tab><font size='16'>{{pl_gun_reload_equip}}</font></textformat>
       <br/><textformat tabstops='[95,140]'>Ammo-type:<tab>{{shell_type_1}}<tab>{{shell_type_2}}</textformat>
       <br/><textformat tabstops='[95,140]'>Penetration:<tab><font size='16'>{{pl_shell_power_1}}</font><tab><font size='16'>{{pl_shell_power_2}}</font></textformat>
       <br/><textformat tabstops='[73,95,140]'>Damage:<tab>{{py:cClip({{gun_clip}})}}<tab><font size='16'>{{pl_shell_damage_1}}</font><tab><font size='16'>{{pl_shell_damage_2}}</font></textformat>
       <br/><textformat tabstops='[95,140]'>Weight:<tab><font size='16'>{{pl_vehicle_weight}}</font></textformat>"
    ]

 

info_panel_data.py

infoPanel.py

infoPanel.xc

Edited by Scanmen
  • Upvote 3

Share this post


Link to post

Short link
Share on other sites

@Kotyarko_O привет.

Добавь по возможности недостающие:

{{nation}}  - нация техники
{{level}}   - уровень техники (арабские цифры) до кучи
{{rlevel}}  - уровень техники (римские цифры)
{{premium}} - 'premium' для премиумной техники, пусто - для обычной

 

Share this post


Link to post

Short link
Share on other sites

вот к заявке ещё один:

{{season of map}} - сезон карты 'winter', 'desert', 'summer'

 

----

заменить "enemiesOnly"

"showInfoPanel": "all", - Возможные значения 'ally', 'enemy', 'all' (для всех)

 

----

не уверен, но наверно нужно  добавить обработчики "mouseEvents" (во время отправления события блокировать парам "delay")

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...