Thread Tools Display Modes
01-15-18, 01:43 AM   #21
Kakjens
A Cliff Giant
Join Date: Apr 2017
Posts: 75
Ammako, could you reword your example? At least for me, it sounded confusing.
Edit. OK, this should be more clear:
During ADDON_LOADED event cleanExit obtains the saved value (for example, true). In step 2 the value of cleanExit is changed to false. However, game crashes and the new value of cleanExit isn't saved.
Could detection of crash be attempted by using /played?

Last edited by Kakjens : 01-15-18 at 01:58 AM.
  Reply With Quote
01-15-18, 06:45 PM   #22
aallkkaa
A Warpwood Thunder Caller
 
aallkkaa's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2017
Posts: 98
Originally Posted by Ammako View Post
Saved Variables don't get written to until you reload/logout/exit the game, no matter how many changes you make.
Darn, you're right! I had completelly forgotten that!
  Reply With Quote
02-17-18, 09:01 AM   #23
X33STORM
A Murloc Raider
Join Date: Sep 2017
Posts: 9
Something is amiss, some cvars are not being enforced it seems.
Maybe i fucked something up?

If anyone is able to fix it?
Ideally it should enforce only on login and reload.

X33STORM.lua

Code:
local function eventHandler(self,event,...)

-- Floating Combat Text
SetCVar("enableFloatingCombatText", 1)
SetCVar("floatingCombatTextFloatMode", 1)
SetCVar("floatingCombatTextAllSpellMechanics", 0)
SetCVar("floatingCombatTextAuras", 0)
SetCVar("floatingCombatTextCombatDamage", 1)
SetCVar("floatingCombatTextCombatHealing", 1)
SetCVar("floatingCombatTextCombatDamageAllAutos", 1)
SetCVar("floatingCombatTextCombatDamageDirectionalScale", 0.3)
SetCVar("floatingCombatTextCombatDamageDirectionalOffset", 13)
SetCVar("floatingCombatTextCombatHealingAbsorbSelf", 0)
SetCVar("floatingCombatTextCombatHealingAbsorbTarget", 1)
SetCVar("floatingCombatTextCombatLogPeriodicSpells", 1)
SetCVar("floatingCombatTextCombatState", 1)
SetCVar("floatingCombatTextComboPoints", 1)
SetCVar("floatingCombatTextDamageReduction", 0)
SetCVar("floatingCombatTextDodgeParryMiss", 1)
SetCVar("floatingCombatTextFriendlyHealers", 0)
SetCVar("floatingCombatTextHonorGains", 1)
SetCVar("floatingCombatTextLowManaHealth", 0)
SetCVar("floatingCombatTextEnergyGains", 0)
SetCVar("floatingCombatTextPeriodicEnergyGains", 0)
SetCVar("floatingCombatTextPetMeleeDamage", 1)
SetCVar("floatingCombatTextPetSpellDamage", 1)
SetCVar("floatingCombatTextReactives", 0)
SetCVar("floatingCombatTextRepChanges", 0)
SetCVar("floatingCombatTextSpellMechanics", 1)
SetCVar("floatingCombatTextSpellMechanicsOther", 1)

-- Nameplate Settings
SetCVar("ShowClassColorInFriendlyNameplate", 1)
SetCVar("nameplateMaxDistance", 65)
SetCVar("nameplateShowAll", 1)
SetCVar("nameplateShowSelf", 0)
SetCVar("nameplateShowOnlyNames", 0)
SetCVar("nameplateShowDebuffsOnFriendly", 1)
--SetCVar("nameplateShowFriendlyNPCs", 1)
SetCVar("nameplateShowEnemies", 1)
SetCVar("nameplateShowFriends", 1)
SetCVar("NameplateMotion", 1)
SetCVar("nameplateLargeTopInset", -1)
SetCVar("nameplateOtherTopInset", -1)
SetCVar("nameplateLargeBottomInset", -1)
SetCVar("nameplateOtherBottomInset", -1)
SetCVar("nameplateHorizontalScale", 1)
SetCVar("nameplateOverlapV", 0.45)
SetCVar("nameplateOverlapH", 0.8)

-- Misc
SetCVar("autoLootDefault", 1)
SetCVar("TargetNearestUseNew", 0)
SetCVar("showQuestTrackingTooltips", 1)

-- Camera
SetCVar("cameraDistanceMaxZoomFactor", 2.6)
SetCVar("test_cameraDynamicPitch", 1)
SetCVar("test_cameraTargetFocusEnemyEnable", 0)
SetCVar("test_cameraDynamicPitchBaseFovPad", 0.45)
SetCVar("test_cameraDynamicPitchBaseFovPadDownScale", 0.25)
SetCVar("test_cameraDynamicPitchBaseFovPadFlying", 0.65)
SetCVar("test_cameraHeadMovementDeadZone", 0.01)

-- Mouse
SetCVar("rawMouseEnable", 1)
SetCVar("rawMouseAccelerationEnable", 0)
SetCVar("rawMouseRate", 500)
SetCVar("rawMouseResolution", 600)

--SetCVar("", 1)

end

local frame = CreateFrame("Frame","CVarSet")
UIParent:UnregisterEvent("EXPERIMENTAL_CVAR_CONFIRMATION_NEEDED")
frame:RegisterEvent("PLAYER_ENTERING_WORLD")
frame:SetScript("OnEvent",eventHandler)
  Reply With Quote
02-17-18, 09:04 AM   #24
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
In a situation like this, you should be more specific about what's not working.
  Reply With Quote
02-17-18, 09:50 AM   #25
X33STORM
A Murloc Raider
Join Date: Sep 2017
Posts: 9
Originally Posted by Ammako View Post
In a situation like this, you should be more specific about what's not working.
In AIO i can see which cvars was set by what, and i've found cvars set by the override dependencies XCT+, AIO itself and blizzard options.

A recent non-cvar change i had to add, after adding camera cvars to the addon.was this:

UIParent:UnregisterEvent("EXPERIMENTAL_CVAR_CONFIRMATION_NEEDED")

Might be that, dunno.

--------

Does this line mean on character login and reload?
I was thinking i might need to add some PLAYER_LOGIN stuff too?

frame:RegisterEvent("PLAYER_ENTERING_WORLD")
  Reply With Quote
02-19-18, 09:36 AM   #26
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by X33STORM View Post
I was thinking i might need to add some PLAYER_LOGIN stuff too?
My personal UI setup addon sets CVars only on PLAYER_LOGIN, does not register or unregister events on any other frames, and does not name any dependencies, optional or otherwise. This has worked for years and years, including when I had AdvancedInterfaceOptions installed, though I never used the "enforce" option Semlar mentioned earlier in this thread.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-19-18, 09:58 AM   #27
X33STORM
A Murloc Raider
Join Date: Sep 2017
Posts: 9
Originally Posted by Phanx View Post
My personal UI setup addon sets CVars only on PLAYER_LOGIN, does not register or unregister events on any other frames, and does not name any dependencies, optional or otherwise. This has worked for years and years, including when I had AdvancedInterfaceOptions installed, though I never used the "enforce" option Semlar mentioned earlier in this thread.
As i use AIO and XCT+ to apply some loose settings, the dependencies as i understand it, overrides any settings set by my addon that they have.

The addon is named X33STORM, and alphabetically it should override any addons named from 1 > 9 and A > W. Could name it differently i guess, what is the last loaded symbol/number/letter ? !Z9 or something?

As to register/unregister, i don't even know what they mean.. Just got a template from someone online, and put my own stuff in it.

Could i see your addon you think?
  Reply With Quote
02-19-18, 10:10 AM   #28
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
I reiterate, you should be more specific about what's not working. Just "some things aren't working" doesn't really help anyone figure out what may be wrong.

You might as well try and add a delay using C_Timer.After on those vars. Ghetto solution, but if it works.
  Reply With Quote
02-19-18, 10:31 AM   #29
X33STORM
A Murloc Raider
Join Date: Sep 2017
Posts: 9
Originally Posted by Ammako View Post
I reiterate, you should be more specific about what's not working. Just "some things aren't working" doesn't really help anyone figure out what may be wrong.

You might as well try and add a delay using C_Timer.After on those vars. Ghetto solution, but if it works.
I'm sorry, i am not actually sure anymore.
I might just be it doesn't apply the cvars on ui reload, leaving me to think it wasn't working.

Just looking for the event name for ui reload i suppose then, which i can't seem to find.

frame:RegisterEvent("PLAYER_LOGIN")
Maybe?

I don't know lua or C** i'm afraid.. I really should take some time to learn what i need to know, to do what i want, just lazy i guess.
  Reply With Quote
02-19-18, 10:46 AM   #30
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Let's start over. Your original post implies, but doesn't actually say, that the code you posted isn't working the way you expect. Is it working as expected, or not? If it is working, what is the question you actually want answered? If it's not working, how is it not working -- what are you expecting it to do, and what actually happens instead?
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-19-18, 11:07 AM   #31
Ammako
A Frostmaul Preserver
AddOn Author - Click to view addons
Join Date: Jun 2016
Posts: 256
There is no event for reload, it just fires PLAYER_ENTERING_WORLD again (maybe some others, but that one is your best bet.)

That event also fires whenever you go through a loading screen, on entering/exiting instances, for instance. Pun intended :]
  Reply With Quote
02-19-18, 01:22 PM   #32
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
You don't have to know C++ to write addons for WoW. Lua and XML is all you need to know.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote
02-20-18, 10:14 AM   #33
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by jeffy162 View Post
You don't have to know C++ to write addons for WoW. Lua and XML is all you need to know.
You don't need to know anything about XML either unless you're writing secure templates, which you (general "you" that applies to anyone who will ever read this post) will almost certainly never do; in 12+ years of writing WoW addons I have done that once. Everything else that can be done in XML can also be done in Lua.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-20-18, 10:29 AM   #34
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Anyway, back on topic, @X33STORM if you can't just set your CVars through Advanced Interface Options and your current code isn't working, here is the code I've been using to set my CVars for about a decade without any problems:

https://github.com/phanx-wow/PhanxUI...ster/CVars.lua
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
02-20-18, 03:49 PM   #35
jeffy162
A Pyroguard Emberseer
 
jeffy162's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 2,364
@Phanx - I know, I know. My memory is totally shot, now, and I couldn't remember what XML was (basically) used for . Thank you for clearing that up.
__________________
Ahhhh, the vagueries of the aging mind. Wait.... What was I saying?


Carbonite <----- GitHub main module (Maps ONLY) download link. The other modules are also available on GitHub.
Carbonite-CLASSIC<----- GitHub link to Carbonite Classic. Thanks to ircdirk for this!
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Help with simple addon - enforcing cvars

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off