Thread Tools Display Modes
09-18-09, 04:37 PM   #1
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
CVar's before first load.

Im trying to set the useUIscale and UIscale CVars but the issue i have is it does not find them in the setup when you do a fresh install. Is their a way to set them with out it having to find it in the config.wtf first? So on a fresh install of both game and the GrimUI it would automatically set the useUIscale and UIscale settings for the user on first log in?
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-18-09, 06:04 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
/console uiScale x
SetCVar('uiScale', x)
  Reply With Quote
09-18-09, 10:00 PM   #3
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
that parts easy.... the hard part is how do you make it so that it it loads when the game first loads....

/console requires it to reload and the cvars dont work if it cant find it in the config.wtf already. on a fresh install it is not in there.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-18-09, 10:19 PM   #4
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Originally Posted by Grimsin View Post
that parts easy.... the hard part is how do you make it so that it it loads when the game first loads....

/console requires it to reload and the cvars dont work if it cant find it in the config.wtf already. on a fresh install it is not in there.
Ofcourse it works
  Reply With Quote
09-18-09, 11:18 PM   #5
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
..... uh what im saying is it does not work for what im trying to do.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-19-09, 12:39 AM   #6
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Then you're not doing it at the appropriate stage of the UI loading process. You'll probably want to do this when PLAYER_LOGIN fires, and have a SavedVariable called "FirstRun", for example, and have its value set to true. When you've done your setup, set FirstRun to false so you won't execute the setup stuff again.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
09-19-09, 12:51 AM   #7
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
your completely right... unfortunately i dont know how to do saved variables yet... i need this function for a number of things like the chat setup and the setup of other addons in the compilation which should only setup on the users firstrun then it should allow them to adjust and the various addons save accordingly.

Heh i was going to study saved variables tonight but im about to go to bed after hours of frustration on the darn chat issues. Ive come to the conclusion that chat settings must also save server side and for some darn reason half the time some old setting loads up instead of what ever changes i have made to the code. its driving me nuts because half the time i think i have made a mistake or some code line i used was not valid.... so i go change change change and still it remains exactly the same.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-19-09, 12:56 AM   #8
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
oh wait... i forgot though that still will not alleviate the fact that if its a fresh install and useUiScale has never been set in the video options before then using SetCVar does not work. It requires that graphix be restarted or something. Or a log out or reload... so yea how do i get around that? the /console script im using works but only after you log in and then do a /reload.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-19-09, 04:25 AM   #9
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
One way to get around it might be like this but it does increase loading time if it is run me thinks

Code:
if tonumber(GetCVar("useUiScale")) ~= 1 then
 SetCVar("useUiScale", 1)
 ReloadUI()
end
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
09-19-09, 06:25 AM   #10
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Not being in the Config.wtf has nothing to do with it. Try using this:

Code:
        BlizzardOptionsPanel_SetCVarSafe("uiscale", your_value)
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
09-19-09, 08:33 AM   #11
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Originally Posted by Yourstruly View Post
One way to get around it might be like this but it does increase loading time if it is run me thinks

Code:
if tonumber(GetCVar("useUiScale")) ~= 1 then
 SetCVar("useUiScale", 1)
 ReloadUI()
end
hmm i saw similer code in the old mazzle UI core. im going to have to go look again as i did not see the reload part anywhere maybe their is a way. going to check our torhals.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
09-19-09, 08:58 AM   #12
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
alright i tried that and no go. Plain and simple. IT DOES matter if UiScale is not already in the config.wtf.

every command that involves UiScale or useUiScale returns an error stating it can not find that command. If you add it to the config.wtf then all of the above setcvar methods work just fine.

which is why that error pops at first but then does not pop on /reload and why it sets itself properly on a /reload when i have this following script in their or any of the other setcvar methods that do not involve /console. i tried puting this into an event trigger and set it the trigger for a chat msg and still it did not load up right. Still cant find useUiScale on first load no mater what.

Code:
 local function RunSlashCmd(cmd) 
	      local slash, rest = cmd:match("^(%S+)%s*(.-)$") 
	      for name in pairs(SlashCmdList) do 
	         local i = 1 
	         local slashCmd 
	         repeat 
	            slashCmd = _G["SLASH_"..name..i] 
	 
	            if slashCmd == slash then 
	               -- Call the handler  
	               SlashCmdList[name](rest) 
	               return true 
	            end 
	            i = i + 1 
	         until not slashCmd 
	      end 
	    end
  RunSlashCmd("/console useUiScale 1")
  RunSlashCmd("/console UiScale 0.63999998569489")
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 09-19-09 at 09:08 AM.
  Reply With Quote
09-20-09, 04:43 AM   #13
Layrajha
A Frostmaul Preserver
 
Layrajha's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 275
Are CVars case-sensitive? Or, just as in windows's wonderful file system, are names case-sensitive when you create them, but not when you try to match them (not sure if I'm very clear, but well...). Or the case could matter when you use SetCVar, but not in config.wtf (meaning that a wrongly cased CVar would not work, but be saved in config.wtf anyway, still wrongly cased, and then corrected automatically when config.wtf is loaded).

wowwiki says that uiscale is in lower case and only useUiScale is mixed with upper cases. Maybe it's just a dumb suggestion, but well, most of the times what looks like a lack in the API is just a stupid bug.

If it doesn't help, I have two questions:
- Do you have to reload your UI if you set your UI scale via blizzard's interface options menu?
- If not, can't you simulate the process via lua by having a look at blizzard's code on wdn (or wowcompare now?) and calling their functions?

Last edited by Layrajha : 09-20-09 at 04:46 AM.
  Reply With Quote
09-20-09, 06:27 AM   #14
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
- Do you have to reload your UI if you set your UI scale via blizzard's interface options menu?
Pretty sure it does gxRestart on enabling/disabling UI Scale but not when changing the scale.

/console gxRestart
RestartGx()



Edit: I'm following this thread as I have a small addon with all my settings and UI Scale is one of 'em.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
09-20-09, 11:55 AM   #15
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
to change the scale though i think the useuiscale has to be on. it is case sensitive. according to the stuff ive read the cases are... useUiScale and uiScale

it does do a gxrestart.
it was off on the uiscale setting but.... the useuiscale needs to be set first... i think. haha. i moved away from this issue for the moment and em trying to figure out why i have chat frame placement problems. its driving me crazy.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » CVar's before first load.

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