WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   OpenRDX: Feature Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=104)
-   -   Scripted vars (https://www.wowinterface.com/forums/showthread.php?t=39845)

Narinka 04-27-11 03:17 PM

Scripted vars
 
Just migrated from 7.4.9 (don't laugh) and from what can see features now use more strict conditions when using vars. If var was not "declared" you can't use it. Quite logical, but I'm sad panda now T T.

Before I had self made "feature" for tracking raid buffs, it used one scripted var, where I declared many at once and then used them. Worked fine ;)

Code:

local function CheckBuffs(buffs)
  n = #buffs;
  varsc = true;
  for i = 1,n do
    if  UnitBuff("player", buffs[i]) then varsc = false end;
  end;
  return varsc;
end

varsc_bok = CheckBuffs({"Знак дикой природы", "Благословение королей"});
varsc_bom = CheckBuffs({"Благословение могущества", "Сила поганища", "Высвобожденная ярость", "Аура меткого выстрела"});
varsc_wf = CheckBuffs({"Цепкие ледяные когти", "Тотем неистовства ветра", "Групповая охота"});
varsc_stam = CheckBuffs({"Слово силы: Стойкость", "Кровавый союз", "Командирский крик"});
varsc_armor = CheckBuffs({"Аура благочестия", "Totem"});
varsc_flask = CheckBuffs({"Настой стальной кожи", "Настой силы титанов"});
varsc_food = CheckBuffs({"Сытость"});

Sorry for locale, I hope you catch an idea, there are names of buffs.

Now the only way to do the same is to declare 7 scripted vars one by one? :(

sigg 04-28-11 03:21 AM

Hi Narinka

Yes add 7 scripts in your design.
I may suggest that you can use the powerfull RDX API instead of your code

Replace

Code:

for i = 1,n do
    if  UnitBuff("player", buffs[i]) then varsc = false end;
end;

By

Code:

if unit:HasBuff("buff1") or unit:HasBuff("buff2") then  ... end
In the same concept with cooldown

Code:

unit:HasUsedCooldownBySpellid(spellid)
unit:HasAvailCooldownBySpellid(spellid)

Use the event "UNIT_COOLDOWN" as the trigger

One day I will publish the API of RDX.

BTW, do you have any update of the ruRU langage pack ?

Cheers

Narinka 04-28-11 10:34 AM

Not yet, sorry. Will take a look at spells DB, but interface part was always out of my sight. To be honest in my case it looks like:
Code:

local RDX_translation = {
};

VFL.Internationalize("ruRU", RDX_translation);

:p

ps: to be honest it will be better to cut it out in your release also, in many cases translations do not fit in buttons or features, in some cases it is hard to understand what they mean at all. locale.ruRu was done long before me, I tried at some point, but gave up, sorry :) Too much work for my time in WoW and I prefer english interface anyways.

If you or any Ru users really need it I can help of cause, but without any promises.

Narinka 06-13-11 06:05 PM

Sigg, dunno why, but your suggested code works not well enough with Latch repaint and I don't like to set up periodic repaint in every window I use.

Just try to do something like simple frame with scripted var + texture + show/hide feature or whatever..

Scripted var with buff event checked:
vBuff = true;
if unit:HasBuff("YourBuffGoesHere") then vBuff = false end

Window with latch repaint.

Now drop your buff, buff it back etc.. it just updates in some weird way.

If you change scripted var to something like:
vBuff = true;
if UnitBuff("player", "YourBuffGoesHere") then vBuff = false end;
Then everything works fine.


All times are GMT -6. The time now is 04:06 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI