Yeah, you read that right. I don't know if this is already public knowledge or not but I just found out, that the UI-stuff grants you access to prett much every setting a player can access (write only).
While figuring out how to implement the UI for my map, I stumbled upon a crude and not so well planned UI implementation by blizzard. Playing around with it, I created this code sample, that lets you force a player to change his graphics settings to the maximum (skipped stuff that needs a restart/additional confirmation and antialiazing; if the "fullscreen" constant is checked, the game is also forced to go fullscreen).
constboolbuttonOnly=true;constboolfullscreen=false;boolclicked(boola,boolb){TriggerDebugOutput(1,StringToText("Whoops, you clicked it..."),true);returntrue;}boolUITest(boola,boolb){intoptionsMenu;intmp;intgraphicsPanel;intdisplayMode;inttextureQuality;intshader;intlighting;intshaderQuality;intterrainQuality;intreflectionQuality;inteffectQuality;intpostProcessingQuality;intphysicsQuality;intportraits;intacceptButton;intBG;DialogCreate(500,400,c_anchorCenter,0,0,true);DialogSetFullscreen(DialogLastCreated(),true);DialogSetImageVisible(DialogLastCreated(),false);DialogSetVisible(DialogLastCreated(),PlayerGroupAll(),true);mp=DialogControlCreate(DialogLastCreated(),c_triggerControlTypePanel);optionsMenu=DialogControlCreateInPanelFromTemplate(mp,c_triggerControlTypePanel,"GameMenuDialog/GameMenuDialogOptionsPanelTemplate");DialogControlSetSize(DialogControlLastCreated(),PlayerGroupAll(),1600,1150);DialogControlSetPosition(DialogControlLastCreated(),PlayerGroupAll(),c_anchorTopLeft,0,0);graphicsPanel=DialogControlHookup(optionsMenu,c_triggerControlTypePanel,"GraphicsOptionsPanel");displayMode=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"DisplayPanel/DisplayModePulldown");textureQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"TextureQualityPanel/TextureQualityPulldown");shader=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/ShaderDetailPulldown");lighting=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/LightingQualityPulldown");shaderQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/ShadowQualityPulldown");terrainQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/TerrainQualityPulldown");reflectionQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/ReflectionQualityPulldown");effectQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/EffectsQualityPulldown");postProcessingQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/PostProcessingQualityPulldown");physicsQuality=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/PhysicsQualityPulldown");portraits=DialogControlHookup(graphicsPanel,c_triggerControlTypePulldown,"GraphicsPanel/PortraitsPulldown");acceptButton=DialogControlHookup(optionsMenu,c_triggerControlTypeButton,"AcceptButton");TriggerAddEventDialogControl(TriggerCreate("clicked"),-1,acceptButton,c_triggerControlEventTypeClick);if(buttonOnly){DialogControlSetSize(mp,PlayerGroupAll(),300,120);DialogControlSetPosition(mp,PlayerGroupAll(),c_anchorCenter,0,0);DialogControlSetPositionRelative(acceptButton,PlayerGroupAll(),c_anchorTopLeft,mp,c_anchorTopLeft,-80,0);BG=DialogControlHookup(optionsMenu,c_triggerControlTypeImage,"TopLeftCornerImage");DialogControlSetVisible(BG,PlayerGroupAll(),false);BG=DialogControlHookup(optionsMenu,c_triggerControlTypeImage,"BlackMaskImage");DialogControlSetVisible(BG,PlayerGroupAll(),false);BG=DialogControlHookup(optionsMenu,c_triggerControlTypeImage,"GradientImage");DialogControlSetVisible(BG,PlayerGroupAll(),false);BG=DialogControlHookup(optionsMenu,c_triggerControlTypeImage,"BorderImage");DialogControlSetVisible(BG,PlayerGroupAll(),false);BG=DialogControlHookup(optionsMenu,c_triggerControlTypeImage,"InnerLineImage");DialogControlSetVisible(BG,PlayerGroupAll(),false);BG=DialogControlHookup(optionsMenu,c_triggerControlTypeImage,"TitleBorderImage");DialogControlSetVisible(BG,PlayerGroupAll(),false);}else{DialogControlSetSize(mp,PlayerGroupAll(),1600,1150);}Wait(0.0625,c_timeGame);if(fullscreen){DialogControlAddItem(displayMode,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(displayMode,PlayerGroupAll(),3);}DialogControlAddItem(textureQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(textureQuality,PlayerGroupAll(),4);DialogControlAddItem(shader,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(shader,PlayerGroupAll(),4);DialogControlAddItem(lighting,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(lighting,PlayerGroupAll(),4);DialogControlAddItem(shaderQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(shaderQuality,PlayerGroupAll(),3);DialogControlAddItem(terrainQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(terrainQuality,PlayerGroupAll(),4);DialogControlAddItem(reflectionQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(reflectionQuality,PlayerGroupAll(),2);DialogControlAddItem(effectQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(effectQuality,PlayerGroupAll(),4);DialogControlAddItem(postProcessingQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(postProcessingQuality,PlayerGroupAll(),3);DialogControlAddItem(physicsQuality,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(physicsQuality,PlayerGroupAll(),5);DialogControlAddItem(portraits,PlayerGroupAll(),StringToText("Derp"));DialogControlSelectItem(portraits,PlayerGroupAll(),2);returntrue;}voidUITest_init(){TriggerExecute(TriggerCreate("UITest"),false,false);}
This button can look any way you like and be inside the dialog of your choice; the amount of buttons is unlimited.
I personally will probably use this method to force the standard hotkeys in my map (because I don't use the standard layout).
No matter what, I consider this the biggest bug I have yet to encounter in the game.
Interresting find, but I would not rely on such code since it will most likely be fixed by Blizzard. They have stated various times that they do not want maps to be able to access graphics settings directly to make sure people with lower end hardware can not be excluded from games or other stuff like that.
Since your code appearantly can even set specific settings for players and enforce them it seems to be a pretty big violation of Blizzards principles.
I do not recommend changing graphics with it. I also posted it in the bugs section because I don't think this is supposed to be this way.
I will, however, abuse it to change hotkeys back to standard, because my layout will not be standard. Grid layout fucks up most of the non-standard ui maps. In case blizzard patches it, there will be a hidden error message, no big deal.
Edit:
If you want a really funny feature, you can reduce graphics settings to the minimum when the hero is low hp/dead :P
Getting back the graphics setting that were active previously, you just have to create 2 instances of the graphics menu. They are created with the current settings. Activating the unchanged version reverts everything back.
Yeah, you read that right. I don't know if this is already public knowledge or not but I just found out, that the UI-stuff grants you access to prett much every setting a player can access (write only).
While figuring out how to implement the UI for my map, I stumbled upon a crude and not so well planned UI implementation by blizzard. Playing around with it, I created this code sample, that lets you force a player to change his graphics settings to the maximum (skipped stuff that needs a restart/additional confirmation and antialiazing; if the "fullscreen" constant is checked, the game is also forced to go fullscreen).
This button can look any way you like and be inside the dialog of your choice; the amount of buttons is unlimited.
I personally will probably use this method to force the standard hotkeys in my map (because I don't use the standard layout). No matter what, I consider this the biggest bug I have yet to encounter in the game.
Edit:
Interesting find. :D
Btw, to allows us to compile the code, we need to change this line
edit: yay, the BBCode tag handling is broken...
Oh well, I ran this through a texteditor to replace all the c_allPlayers. Somehow that was left alone.
Fixed it, thanks!
Interresting find, but I would not rely on such code since it will most likely be fixed by Blizzard. They have stated various times that they do not want maps to be able to access graphics settings directly to make sure people with lower end hardware can not be excluded from games or other stuff like that.
Since your code appearantly can even set specific settings for players and enforce them it seems to be a pretty big violation of Blizzards principles.
@Mille25: Go
I do not recommend changing graphics with it. I also posted it in the bugs section because I don't think this is supposed to be this way.
I will, however, abuse it to change hotkeys back to standard, because my layout will not be standard. Grid layout fucks up most of the non-standard ui maps. In case blizzard patches it, there will be a hidden error message, no big deal.
Edit:
If you want a really funny feature, you can reduce graphics settings to the minimum when the hero is low hp/dead :P
Getting back the graphics setting that were active previously, you just have to create 2 instances of the graphics menu. They are created with the current settings. Activating the unchanged version reverts everything back.