Thread Tools Display Modes
02-13-22, 11:09 PM   #1
cheesewiz
A Fallenroot Satyr
Join Date: Jan 2021
Posts: 29
How can I turn this into a togglable key?

Code:
/run SetCVar("UIScale", 0.65)
/run SetCVar("UIScale", 1.15)

I'd like to be able to bind the max ui scale and the min ui scale into a single key via an addon. What else do I need?

Code:
local binding = "F1";

SET SetCVar("UIScale", 0.65)
SET SetCVar("UIScale", 1.15)
  Reply With Quote
02-14-22, 05:22 AM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Code:
/run SetCVar(GetCVar("UIScale")=="1.15" and "0.65" or "1.15")
  Reply With Quote
02-14-22, 03:13 PM   #3
cheesewiz
A Fallenroot Satyr
Join Date: Jan 2021
Posts: 29
Originally Posted by Dridzt View Post
Code:
/run SetCVar(GetCVar("UIScale")=="1.15" and "0.65" or "1.15")
This doesn't seem to do anything.
  Reply With Quote
02-14-22, 03:19 PM   #4
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Originally Posted by cheesewiz View Post
This doesn't seem to do anything.
How did you test it?
  Reply With Quote
02-14-22, 09:55 PM   #5
cheesewiz
A Fallenroot Satyr
Join Date: Jan 2021
Posts: 29
Originally Posted by Dridzt View Post
How did you test it?
Tried using it in game, then as a macro in game. Do I need to use https://addon.bool.no/ instead?
  Reply With Quote
02-14-22, 11:14 PM   #6
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
Originally Posted by cheesewiz View Post
Tried using it in game, then as a macro in game. Do I need to use https://addon.bool.no/ instead?
This was just a script that you would run directly in chatframe to test if the code works.

To assign it to a keybind and make it into an addon you'd need a couple more steps.

As to why it does nothing, are you sure you have "Use UI Scale" option checked?
You can find it at Esc > System > Advanced or by
Code:
/dump GetCVar("useUIScale")
If it doesn't return "1" that's your problem.

To make this into a minimal addon you'd need something like this.
1. Bindings.xml file with
Code:
<Bindings>
	<Binding name="CHEESY_UISCALE_TOGGLE" header="CHEESY_UISCALE_TITLE" category="ADDONS">
		Cheesy_UIScaleToggle();
	</Binding>
</Bindings>
2. cheesy.lua file with
Code:
BINDING_HEADER_CHEESY_UISCALE_TITLE = "CheeseWiz UI Scale"
BINDING_NAME_CHEESY_UISCALE_TOGGLE = "Toggle UI Scale"

function Cheesy_UIScaleToggle()
  SetCVar("useUIScale","1")
  SetCVar((GetCVar("uiScale")=="1.15") and "0.65" or "1.15")
end
Finally a .toc file that loads the lua.
  Reply With Quote
02-15-22, 12:36 AM   #7
cheesewiz
A Fallenroot Satyr
Join Date: Jan 2021
Posts: 29
How do you assign a keybind within Bindings.xml with what you wrote?

I'm thinking it has to do with Cheesy_UIScaleToggle(); but I'm not sure.
  Reply With Quote
02-15-22, 01:09 AM   #8
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
You assign it from the default keybindings menu under Addons.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » How can I turn this into a togglable key?

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