WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   How can I turn this into a togglable key? (https://www.wowinterface.com/forums/showthread.php?t=59049)

cheesewiz 02-13-22 11:09 PM

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)


Dridzt 02-14-22 05:22 AM

Code:

/run SetCVar(GetCVar("UIScale")=="1.15" and "0.65" or "1.15")

cheesewiz 02-14-22 03:13 PM

Quote:

Originally Posted by Dridzt (Post 340327)
Code:

/run SetCVar(GetCVar("UIScale")=="1.15" and "0.65" or "1.15")

This doesn't seem to do anything.

Dridzt 02-14-22 03:19 PM

Quote:

Originally Posted by cheesewiz (Post 340328)
This doesn't seem to do anything.

How did you test it?

cheesewiz 02-14-22 09:55 PM

Quote:

Originally Posted by Dridzt (Post 340329)
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?

Dridzt 02-14-22 11:14 PM

Quote:

Originally Posted by cheesewiz (Post 340330)
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.

cheesewiz 02-15-22 12:36 AM

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.

Dridzt 02-15-22 01:09 AM

You assign it from the default keybindings menu under Addons.


All times are GMT -6. The time now is 12:41 AM.

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