WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Issues with SetCVar (https://www.wowinterface.com/forums/showthread.php?t=40033)

dstruct2k 05-07-11 02:57 AM

Issues with SetCVar
 
I've been working on an addon that dynamically adjusts draw distance based on FPS; I'll be adding many more "dynamic" settings to it once I've fleshed out the concept with farclip.

My issue is... In 4.0.6, I was able to use SetCVar("farclip", newfarclip) to change draw distance, and it was updated immediately. Now in 4.1, the same code isn't having the desired effect; What happens is the cvar is changed but the actual render distance stays the same. If I type /console print(GetCVar("farclip")), I get the expected new value assigned by my addon, yet the game world doesn't change to reflect this new value.

Example:
Farclip @ 1600
Getting 10 FPS out of 60; Addon responds by dropping farclip to 266
Rendered world does not change, but console reports farclip is now @ 266

A quick sample of how I go about this follows:

Code:

if (fps/requestedfps) < 0.9 then
  local newfarclip = floor((fps/requestedfps)*(GetCVar("farclip")))
  SetCVar("farclip", newfarclip)
end

Any ideas? I can pastebin my LUA if anyone wants to take a look.

Ketho 05-07-11 03:44 PM

Quote:

Originally Posted by dstruct2k (Post 236784)
If I type /console print(GetCVar("farclip"))

You have a "typo" there :)

I just went on Live and tested out these commands and they both worked immediately for me ..
Code:

/console farclip 25
/run SetCVar("farclip", 25)


Nibelheim 05-07-11 04:07 PM

Careful when using math on GetCVar, as it can return strings even for numerical settings. tonumber() works well.


All times are GMT -6. The time now is 07:52 AM.

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