Jump to content
Korean Random

Сборник py_macro


Recommended Posts

вот и я о том же. Одна затыка с задержкой осталась + не знаю, баг это или нет, но макрос {{ready}} ни разу не показал, что противник вышел из боя, где бы я его не прописал, у союзников показывает. Было бы не плохо чтобы его адаптировали для экстраполей.

  • Upvote 1
Link to comment
Short link
Share on other sites

Изменения в аддоне "Название карты":

  • добавлен макрос:
    {{py:map.kind}} - возвращает 'summer', если карта летняя, 'winter' - зимняя, 'desert' - пустынная.

     

  • переименованы макросы:

    • {{py:maps.nameFileMap}} -> {{py:map.nameFile}}

    • {{py:maps.localeNameMap}} -> {{py:map.localeName}}

Edited by ktulho
  • Upvote 1
Link to comment
Short link
Share on other sites

My apologies if this should be in the sight thread. Not sure if here or there is the best place to post.

A humble proposal... {{py:map.sightColor}}

Instead of long macros for every instance of "color": in battleLabelSight.xc, we could add to sight.xc:

 

 

 


{
  "sight": {
    // false - disable the mod
    "enabled": true,
    "colors": {
    // Set colours of sight elements depending on season of map
      "winter": "0xFF96FF", // Pink example
      "desert": "0x64FF30", // Vibrant Green
      "summer": "0xD4FFAA"  // Light Green
    },

 

 

 

 

A working example script of your code:

 

 


import BigWorld
from items.vehicles import CAMOUFLAGE_KIND_INDICES
from xvm_main.python import config
from xfw import *
from xvm_main.python.logger import *

autoReloadConfig = False
defaultClr = "0xD4FFAA"


def readConfig():
    global autoReloadConfig, defaultClr, winterClr, desertClr, summerClr
    autoReloadConfig = config.get('autoReloadConfig')
    winterClr = config.get('sight/colors/winter')
    desertClr = config.get('sight/colors/desert')
    summerClr = config.get('sight/colors/summer')

readConfig()


@xvm.export('map.sightColour', deterministic=True)
def maps_mapKind():
    if autoReloadConfig:
        readConfig ()
    mapKind = CAMOUFLAGE_KIND_INDICES.get(BigWorld.player().guiSessionProvider.arenaVisitor.type.getVehicleCamouflageKind(), None)
    if mapKind is "winter" and winterClr is not None:
        return winterClr
    if mapKind is "desert" and desertClr is not None:
        return desertClr
    if mapKind is "summer" and summerClr is not None:
        return summerClr
    else:
        return defaultClr

 

 

 

 

Then we can change colours in just one area. (Edited to reflect Ktulho's solution below)

battleLabelSight.xc color example:

"textFormat": { "align": "left", "color": "{{.sight.colors.{{py:map.kind}}}}" },

 

It is only an idea. If not interesting enough, the example may still be useful to others.
Amazing work to you and the others (authors and testers!). It's very appreciated. Cheers!

Edited by SmashPuppet
A better solution from Ktulho
Link to comment
Short link
Share on other sites

@SmashPuppet 

8 часов назад, SmashPuppet сказал:

A working example script of your code:

Можно немного компактнее:

import BigWorld
from items.vehicles import CAMOUFLAGE_KIND_INDICES
from xvm_main.python import config
from xfw import *
from xvm_main.python.logger import *

defaultClr = "0xD4FFAA"

@xvm.export('map.sightColour', deterministic=True)
def maps_mapKind():
    mapKind = CAMOUFLAGE_KIND_INDICES.get(BigWorld.player().guiSessionProvider.arenaVisitor.type.getVehicleCamouflageKind(), None)
    colors = config.get('sight/colors')
    return colors.get(mapKind, defaultClr)

 

  • Upvote 1
Link to comment
Short link
Share on other sites

8 minutes ago, ktulho said:

@smashpuppet 

Can be a little more compact:

 

 

 

You are the man. :no1: much better.
I am not so great with python or knowing the game internals. Just enough to be dangerous though. Learning from you all. Thanks!

Edited by SmashPuppet
Link to comment
Short link
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

@ktulho , день добрый! Подскажи, пожалуйста, можно ли сделать событие, срабатывающее при изменении режима (рандом, ранговый, ...), для использования в "updateEvent"?

Link to comment
Short link
Share on other sites

25 минут назад, CrazyST сказал:

Подскажи, пожалуйста, можно ли сделать событие, срабатывающее при изменении режима (рандом, ранговый, ...), для использования в "updateEvent"?

Можно наверно. По идее, при смене режима обновляется ангар, поискать что-то типа "updateHangare".

Link to comment
Short link
Share on other sites

6 минут назад, ktulho сказал:

Обновил скрипты в шапке для патча 1.1.0.

Добрый вечер, если использую те, что вот от сюда:

 

В 06.08.2018 в 22:40, ktulho сказал:

скачивать обновленные из шапки нужно?

Link to comment
Short link
Share on other sites

@ktulho привет, смотрю ты во многие скрипты добавил

from xfw_actionscript.python import *

у меня есть пара своих, мне тоже нужно добавить?

ЗЫ. а в твоем boosters.py не нужно добавлять?

Link to comment
Short link
Share on other sites

1 минуту назад, steaxch сказал:

у меня есть пара своих, мне тоже нужно добавить?

Нужно добавлять, если в скрипте создаешь свои события (as_event('ON_XXX'))

  • Upvote 2
Link to comment
Short link
Share on other sites

25 минут назад, ktulho сказал:

Нужно добавлять, если в скрипте создаешь свои события (as_event('ON_XXX'))

Получается эти будут работать,ничего добавлять не нужно,Саш?

Link to comment
Short link
Share on other sites

В 29.08.2018 в 16:11, ktulho сказал:

 

 Не знаю может уже было такое предложение, вопрос вот какой, можно ли в макрос "Таймер для шестого чувства" добавить ручной запуск. К примеру знаеш что был долго в засвете и лампа не срабатывала, потом спрятался и пережидаешь пока пропадёшь из засвета, жмёшь клавишу и таймер показывает время (теоретически) после которого ты уже не светишься.

Link to comment
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...