xenus 62 #402185 Posted August 30, 2017 Парни,есть старенький скриптик с таким кодом: import BigWorld @xvm.export('shell_damage.shell_damage', deterministic=False) def shell_damage(): vehicle = BigWorld.player() shotDescr = vehicle.vehicleTypeDescriptor.shot if shotDescr['shell']['kind'] == 'HIGH_EXPLOSIVE': return "%i" % (shotDescr['shell']['damage'][0] // 2) else: return "%i" % (shotDescr['shell']['damage'][0]) Работал нормально,но в этом патче в логе ошибки посыпались: 2017-08-30 02:47:17: [ERROR] Traceback (most recent call last): File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 157, in process_python_macro return (func(), deterministic) File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 150, in <lambda> return (lambda: func(*args), deterministic) File "res_mods/configs/xvm/py_macro\shell_damage.py", line 7, in shell_damage if shotDescr['shell']['kind'] == 'HIGH_EXPLOSIVE': File "scripts/common/items/components/legacy_stuff.py", line 56, in __getitem__ AssertionError: Operation is not allowed arg='shell_damage.shell_damage()' Помогите поправить,моих знаний недостаточно((( Попробуй вот так: import BigWorld @xvm.export('shell_damage.shell_damage', deterministic=False) def shell_damage(): vehicle = BigWorld.player() shotDescr = vehicle.vehicleTypeDescriptor.shot if shotDescr.shell.kind == SHELL_TYPES.HIGH_EXPLOSIVE: return "%i" % (shotDescr.shell.damage[0] // 2) else: return "%i" % (shotDescr.shell.damage[0]) Quote Share this post Link to post Short link Share on other sites
Slava7572 1,685 #402193 Posted August 30, 2017 Попробуй вот так: import BigWorld @xvm.export('shell_damage.shell_damage', deterministic=False) def shell_damage(): vehicle = BigWorld.player() shotDescr = vehicle.vehicleTypeDescriptor.shot if shotDescr.shell.kind == SHELL_TYPES.HIGH_EXPLOSIVE: return "%i" % (shotDescr.shell.damage[0] // 2) else: return "%i" % (shotDescr.shell.damage[0]) Не помогло к сожалению,не работает и в логе вот что: 2017-08-30 23:20:15: [ERROR] Traceback (most recent call last):File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 157, in process_python_macro return (func(), deterministic) File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 150, in return (lambda: func(*args), deterministic) File "res_mods/configs/xvm/py_macro\shell_damage.py", line 7, in shell_damage if shotDescr.shell.kind == SHELL_TYPES.HIGH_EXPLOSIVE: NameError: global name 'SHELL_TYPES' is not defined arg='shell_damage.shell_damage()' Это скриптик для того,что показывало шотные для твоего урона танки(для фугасов дамаг поделен на два,пробой редко проходит).Код в конфиге такой,мало ли: "killEnemy": { "name": "killEnemy", "enabled": true, "x": 0, "y": "{{battletype?-73|{{squad?-73|-60}}}}", "alpha": "{{hp<{{py:shell_damage.shell_damage()}}?80|0}}", "color": "0xFFFF00", "align": "center", "textFormat": { "font": "$FieldFont", "size": 13, "bold": false, "italic": false }, "shadow": { // false - no shadow // false - без тени "enabled": true, "distance": 0, "angle": 90, "color": null, "alpha": 30, "blur": 6, "strength": 2 }, "format": "<img src='xvm://res/icons/killEnemy/{{vtype-key}}.png' width='23' height='23'>" // формат текста. См. описание макросов в macros.txt } 1 Quote Share this post Link to post Short link Share on other sites
xenus 62 #402201 Posted August 30, 2017 Не помогло к сожалению,не работает и в логе вот что: 2017-08-30 23:20:15: [ERROR] Traceback (most recent call last):File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 157, in process_python_macro return (func(), deterministic) File "./res_mods/mods/packages\xvm_main\python\python_macro.py", line 150, in return (lambda: func(*args), deterministic) File "res_mods/configs/xvm/py_macro\shell_damage.py", line 7, in shell_damage if shotDescr.shell.kind == SHELL_TYPES.HIGH_EXPLOSIVE: NameError: global name 'SHELL_TYPES' is not defined arg='shell_damage.shell_damage()' Это скриптик для того,что показывало шотные для твоего урона танки(для фугасов дамаг поделен на два,пробой редко проходит).Код в конфиге такой,мало ли: "killEnemy": { "name": "killEnemy", "enabled": true, "x": 0, "y": "{{battletype?-73|{{squad?-73|-60}}}}", "alpha": "{{hp<{{py:shell_damage.shell_damage()}}?80|0}}", "color": "0xFFFF00", "align": "center", "textFormat": { "font": "$FieldFont", "size": 13, "bold": false, "italic": false }, "shadow": { // false - no shadow // false - без тени "enabled": true, "distance": 0, "angle": 90, "color": null, "alpha": 30, "blur": 6, "strength": 2 }, "format": "<img src='xvm://res/icons/killEnemy/{{vtype-key}}.png' width='23' height='23'>" // формат текста. См. описание макросов в macros.txt } Похоже нехватало импорта, вот так вроде как работает: import BigWorld from constants import SHELL_TYPES @xvm.export('shell_damage.shell_damage', deterministic=False) def shell_damage(): vehicle = BigWorld.player() shotDescr = vehicle.vehicleTypeDescriptor.shot if shotDescr.shell.kind == SHELL_TYPES.HIGH_EXPLOSIVE: return "%i" % (shotDescr.shell.damage[0] // 2) else: return "%i" % (shotDescr.shell.damage[0]) 1 Quote Share this post Link to post Short link Share on other sites
Slava7572 1,685 #402207 Posted August 30, 2017 Похоже нехватало импорта, вот так вроде как работает: import BigWorld from constants import SHELL_TYPES @xvm.export('shell_damage.shell_damage', deterministic=False) def shell_damage(): vehicle = BigWorld.player() shotDescr = vehicle.vehicleTypeDescriptor.shot if shotDescr.shell.kind == SHELL_TYPES.HIGH_EXPLOSIVE: return "%i" % (shotDescr.shell.damage[0] // 2) else: return "%i" % (shotDescr.shell.damage[0]) Спасибо тебе добрый человек,теперь все работает и лог чистый;) Quote Share this post Link to post Short link Share on other sites
ADv 10 #402920 Posted September 3, 2017 I write a python macro to show the friendly arty's aiming position. It will display as white points in the minimap and white circle in the battle view. from xvm import aimingposition @ Xvm.export ( 'xvm.aimpos', deterministic = False) def refreshAimPos (): aimingposition.posManager.refreshList () return '' { "AimPos": { "Enabled": true, "UpdateEvent": "ON_EVERY_FRAME", "Alpha": 0, "Format": "{{py: xvm.aimpos ()}}" } } Если кто умеет, пофиксите вот этот скрипт, пожалуйста. Сыпет в лог 2017-09-03 16:57:34.425: INFO: 2017-09-03 16:57:34: [ERROR] 79 aimpos|Operation is not allowed 2017-09-03 16:57:35.423: INFO: 2017-09-03 16:57:35: [ERROR] 79 aimpos|Operation is not allowed Свежайшее, что есть у меня в аттаче aimingposition21122016.zip Спасибо. Quote Share this post Link to post Short link Share on other sites
xenus 62 #402969 Posted September 3, 2017 (edited) Если кто умеет, пофиксите вот этот скрипт, пожалуйста. Сыпет в лог 2017-09-03 16:57:34.425: INFO: 2017-09-03 16:57:34: [ERROR] 79 aimpos|Operation is not allowed 2017-09-03 16:57:35.423: INFO: 2017-09-03 16:57:35: [ERROR] 79 aimpos|Operation is not allowed Свежайшее, что есть у меня в аттаче aimingposition21122016.zip Спасибо. Вот, поправил дескрипторы. Сам не проверял, возможно что то еще надо будет править. aimingposition.zip Edited September 3, 2017 by xenus 2 Quote Share this post Link to post Short link Share on other sites
ktulho 5,790 #404182 Posted September 14, 2017 @sirmax, а есть способ переопределить метод класса (@classmethod)? Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #404184 Posted September 14, 2017 @overrideClassMethod(cls, method) 1 Quote Share this post Link to post Short link Share on other sites
ktulho 5,790 #404185 Posted September 14, 2017 @overrideClassMethod(cls, method) Спасибо, что-то я не замечал его раньше. Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #404186 Posted September 14, 2017 А он нигде и не использовался. :) Quote Share this post Link to post Short link Share on other sites
ktulho 5,790 #404187 Posted September 14, 2017 А он нигде и не использовался. :) Несколько мест нашел). Quote Share this post Link to post Short link Share on other sites
sirmax 5,499 #404190 Posted September 14, 2017 А, точно. Quote Share this post Link to post Short link Share on other sites
Rancunier 0 #408124 Posted October 21, 2017 В 13.11.2016 в 12:21, ktulho сказал: @Slava7572,@Kapany3uk, "sixthSenseTimer": { "enabled": true, "updateEvent": "PY(ON_SIXTH_SENSE_SHOW)", "x": 0, "y": 260, "width": 60, "height": 50, "screenHAlign": "center", "shadow": { "distance": 1, "angle": 90, "alpha": 80, "blur": 5, "strength": 1.5 }, "textFormat": {"align": "center", "size": 40 }, "format": "{{py:xvm.sixthSenseTimer(10)%01.1f}}<font size='18'>{{py:xvm.sixthSenseTimer(10)?с.}}</font>" }, sixthSense.rar Други,подскажите пожалуйста .. Что я делаю не так?? беру этот файл,кидаю его в папку по назначению,но ничего не происходит,таймера нет.(( помогите. спасибо Quote Share this post Link to post Short link Share on other sites
HEKPOMAHT 2,165 #408127 Posted October 21, 2017 ссылку в battleLabels.xc дописать нужно ${"battleLabelsTemplates.xc":"def.sixthSenseTimer"}, @Rancunier без ссылки не будет работать Quote Share this post Link to post Short link Share on other sites
Rancunier 0 #408163 Posted October 21, 2017 написал,но ничего не поменялось. ( Quote Share this post Link to post Short link Share on other sites
HEKPOMAHT 2,165 #408167 Posted October 21, 2017 @Rancunier а само поле "sixthSenseTimer" хоть написано в battleLabels Templates.xc ? Поле тоже вписать нужно. "sixthSenseTimer": { "enabled": true, "updateEvent": "PY(ON_SIXTH_SENSE_SHOW)", "x": 0, "y": 260, "width": 60, "height": 50, "screenHAlign": "center", "shadow": { "distance": 1, "angle": 90, "alpha": 80, "blur": 5, "strength": 1.5 }, "textFormat": {"align": "center", "size": 40 }, "format": "{{py:xvm.sixthSenseTimer(10)%01.1f}}<font size='18'>{{py:xvm.sixthSenseTimer(10)?с.}}</font>" }, Quote Share this post Link to post Short link Share on other sites
Rancunier 0 #408170 Posted October 21, 2017 голова пухнет.. куда.чего писать..? спасибо.(( battleLabelsTemplates.xc Quote Share this post Link to post Short link Share on other sites
night_dragon_on 5,601 #408175 Posted October 21, 2017 @Rancunier , battleLabelsTemplates.xc Quote Share this post Link to post Short link Share on other sites
Rancunier 0 #408176 Posted October 21, 2017 огромное спасибо. сейчас попробую. Quote Share this post Link to post Short link Share on other sites
ddar 63 #410005 Posted November 2, 2017 (edited) @ktulho Посмотрите, пожалуйста, правильно ли макрос def invis_stand(): return "%.1f" % (_typeDescriptor.type.invisibility[1] * 50) отдает значения маскировки в покое? Например, Leo по ТТХ имеет показатель 15,69, а макрос отдает 13,7 Маскировка в движении и при выстрелах тоже не совпадают с ТТХ. Edited November 2, 2017 by ddar Quote Share this post Link to post Short link Share on other sites