since the resolution libary by desiderius1 requierd the User to click, and had some little errors when moving the mouse during the measurement, i decided to write a new one.
The new libary has a diffrent approch to measure the resolution and has more options doing this:
Advantages
No more Click required
Precise Resolution measuerment: 2-4px might differ i it's not a standart resolution
Instant Resolution measuerment: The Player just notices camera flickering one time, with little errors like desiderius1 library
Condition: Resolution Changed: User won't notice anything.
Disadvantages
Increased loading time (2-3 Seconds)
Known Issues
The fast detection detects the scale often very wrong. This results in a false resolution. The internal UI resolution ist still correct.
Documentation(Basic)
Installation
Change the lirbary ID to 0E15B1AE
(Right click on the library -> Library -> Change Library ID -> Use Shared ID -> Hexadecimal -> 0E15B1AE)
Action: UI - Resolution - Setup
It's initailizes everything you need. If you want to risk a lagg when detecting the resolution you should run this action in adavance. It usally takes 2-3 seconds. I recommend running this at Map initialization. This will generate the needed dialogs for the system and initalize the resolution database.
Action: Resolution - Refresh
This is the heart of the system. Running this action it will set the global variables.
Parameter: Player(0-15)
Playernumber of the Player you want to detect the resolution of.
Parameter: Mode(on/off)
Turning on the precison mode will ensure the quallity of the result. If the mouse is moved rapidly it will take some additional seconds to detect the resolution. When turned off the result will be nearly instant, but on moving the mouse it will be inaccurate the same way like desiderius1 library.
Parameter: Tolerance(0-infty)
Setting this parameter to a value greater than zero the system will use the resolutiontable(Source:Wikipedia) and trys to match the measured resolution to a common resolution. Since the error of the measurement is about 1% i recommend a value of 2.5%, this will ensure quallity of the result.
Parameter: Debugmode(on/off)
This will display the measured variables when done.
Variable(Record): UI - Resolution
This contains all information measured. The array is the playernumber(0-15). All values are set to zero in the beginning. If youre not sure if the variable has been set then use the "Condition: Resolution - Decent check". I will return false if the variales aren't set.
X-Mouse(Integer): Internal X UI resolution of starcraft
Y-Mouse(Integer): Internal Y UI resolution of starcraft
X-Resolution(Integer): X Resolution of the window (eg 800)
Y-Resolution(Integer): Y Resolution of the window (eg 600)
Scale(Real): Quotient of "Internal UI resolution" to "Resolution"
Enableing this option might speed up the detections Prozess. I do not recommend leaveing this option turned on since it fires a trigger on mouse movement and generates this way a lot of traffic. Single player shouldn't be a probem.
Condition: Resolution - Decent check
This condition will check if the player has changed his resolution. It's a lot faster than refreshing the resolution variables. It will return false if the resolution has changed, true if it's still the same. I will NOT correct the resolution variables!
Settings(Advanced): Record: Settings
UI X (Max) = 3000, currently 3000 is enough for all common resolution. Raise this value if you work on a screen with an X-Resolution(Windows) of 7000 or more.
UI Y (Max) = 2000, same as UI X (Max).
Detection Dialogs Transparency = 99.9, if this value is lower than 99 the player might see the windows flickering when detecting.
Detection Time = 0.1, just change this if the system doesn't work when you mouse of hovering over a Dialog while detecting. Then you might try 0.15 or 0.2
Permanent Traking = Off, the initial value of Permanent Traking
Accuracy = 50, Possible Range 1 to 300, the higher the more accurate it is. It will sort of cut of the detecting if the mouse is to close to the border for detecting the Scale.
By-product: Show/Hide Dialogs Below Mouse
This will hide all dialogs below your mouse and show them again on command.
Parameter: Player(0-15)
Playernumber of the Player you want to hide the dialogs for.
Parameter: Display(show/hide)
Show or hide the Dialogs
I hope this Documentation helps a litte ;).
Since i have no Idea if these changes are enough for a new post in the library section and i would like to have some feedback i postet this here for now.
Hope this helps some mapmakers ;)
It detects my 1280x1024 as 1280x960 from time to time(precise and fast). Also, if I move the mouse rapidly while calculating, I got results like 462x363 or 89x63 (precise). The mouse disappears while determining, and if I don't move the mouse, I don't get any result at all. Also, from time to time, I got: 00:04:22.94 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero 00:04:32.50 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero
All of this in Windowed (Fullscreen). In Fullscreen, it seems to always detect correctly, Windowed with varying window sizes seems to be problematic as well, similar problems to Windowed (Fullscreen).
It detects my 1280x1024 as 1280x960 from time to time(precise and fast).
Hmm i quess there is something wrong with finding the best fitting standard Screensize. I tried to reproduce the Problem but i can't. Could you post the Results of the "calculated" value when it was detecting 1280x960 instead of 1280x1024?
Also, from time to time, I got:
00:04:22.94 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero
00:04:32.50 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero
The scale is being calculated by getting the vertical mouse position and creating a dialog at the same time with lots 1px rows.
With two events i get the mouse position and the "entered" dialogitem. Since there is an delay between these two events its important to make sure the Player didn't move the mouse in between.
Then i get the Y-Offset of the dialog Item and divide it by the mouse position. Thats it for the scale.
Getting the maximal X and Y screen sizes works similar to desiderius1 library. Therefore I set the coursor to the middle of the screen using the build in action by blizzard. Then i get the mouse position again by showing these dialogs and getting the X and Y offsets and multiply them by 2.
The last thing i do i checking if the resolution is relativly close to a standart resolution. If it's close to a standart resolution, i assume it's the players resolution and then set the scale to an exact value.
EDIT:@Kueken531: I figuerd out all the errors, currently working on fixing them, because of your feedback I had quite a nice idea which allows getting the resolution even faster.
"lp_mousePosition = lib0E15B1AE_gv_internal[lp_player].lv_mousePositionRes;" in the library does not compile.
It's the same for "lib0E15B1AE_gv_resolutionDatabase[0][0] = 160;".
It needs to be "lib1_" in my testmap to work. :S
Also I was able to bug the testmap on battle.net. At least I was permanently unable to click anything on the screen.
But I'm not sure, if the testmap contains the updated library.
Nah, that was a stupid bug. I just changed some varnames. That was about it.
I just uploaded a version with the Hotfix. I got this Library working on a (currenty) single playermap with no more issues.
The compiling error was because i forgot to write that after importing you have to change the library ID to 0E15B1AE.
Hope everything works now.
I just added some documentation stuff and wrote you a pm. Hope it helps.
If there is anything else or you find a bug just ask. ;)
And there is a new version avalible with a better describitons and with a minor bugfix.
I imported your library, and I can make it show me my resolution, but now when I try to create a dialog, I am setting it up like this, and It does not create a dialog.
Hey there,
since the resolution libary by desiderius1 requierd the User to click, and had some little errors when moving the mouse during the measurement, i decided to write a new one. The new libary has a diffrent approch to measure the resolution and has more options doing this:
Advantages
Disadvantages
Known Issues
Documentation(Basic)
Installation
Change the lirbary ID to 0E15B1AE (Right click on the library -> Library -> Change Library ID -> Use Shared ID -> Hexadecimal -> 0E15B1AE)
Action: UI - Resolution - Setup
It's initailizes everything you need. If you want to risk a lagg when detecting the resolution you should run this action in adavance. It usally takes 2-3 seconds. I recommend running this at Map initialization. This will generate the needed dialogs for the system and initalize the resolution database.
Action: Resolution - Refresh
This is the heart of the system. Running this action it will set the global variables.
Parameter: Player(0-15)
Playernumber of the Player you want to detect the resolution of.
Parameter: Mode(on/off)
Turning on the precison mode will ensure the quallity of the result. If the mouse is moved rapidly it will take some additional seconds to detect the resolution. When turned off the result will be nearly instant, but on moving the mouse it will be inaccurate the same way like desiderius1 library.
Parameter: Tolerance(0-infty)
Setting this parameter to a value greater than zero the system will use the resolutiontable(Source:Wikipedia) and trys to match the measured resolution to a common resolution. Since the error of the measurement is about 1% i recommend a value of 2.5%, this will ensure quallity of the result.
Parameter: Debugmode(on/off)
This will display the measured variables when done.
Variable(Record): UI - Resolution
This contains all information measured. The array is the playernumber(0-15). All values are set to zero in the beginning. If youre not sure if the variable has been set then use the "Condition: Resolution - Decent check". I will return false if the variales aren't set.
Documentation(Advanced)
Action: UI - Resolution - Disable Permanent Tracking
Parameter: Permanent Tracking(Enable/Disable)
Enableing this option might speed up the detections Prozess. I do not recommend leaveing this option turned on since it fires a trigger on mouse movement and generates this way a lot of traffic. Single player shouldn't be a probem.
Condition: Resolution - Decent check
This condition will check if the player has changed his resolution. It's a lot faster than refreshing the resolution variables. It will return false if the resolution has changed, true if it's still the same. I will NOT correct the resolution variables!
Settings(Advanced): Record: Settings
By-product: Show/Hide Dialogs Below Mouse
This will hide all dialogs below your mouse and show them again on command.
Parameter: Player(0-15)
Playernumber of the Player you want to hide the dialogs for.
Parameter: Display(show/hide)
Show or hide the Dialogs
I hope this Documentation helps a litte ;).
Since i have no Idea if these changes are enough for a new post in the library section and i would like to have some feedback i postet this here for now. Hope this helps some mapmakers ;)
Taldeen
It detects my 1280x1024 as 1280x960 from time to time(precise and fast). Also, if I move the mouse rapidly while calculating, I got results like 462x363 or 89x63 (precise). The mouse disappears while determining, and if I don't move the mouse, I don't get any result at all. Also, from time to time, I got:
00:04:22.94 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero
00:04:32.50 Trigger Error in 'lib0E15B1AE_gt_GetMousePos_Func': Divide by zero
All of this in Windowed (Fullscreen). In Fullscreen, it seems to always detect correctly, Windowed with varying window sizes seems to be problematic as well, similar problems to Windowed (Fullscreen).
Hmm i quess there is something wrong with finding the best fitting standard Screensize. I tried to reproduce the Problem but i can't. Could you post the Results of the "calculated" value when it was detecting 1280x960 instead of 1280x1024?
Hmm, thats wierd what does the scale say? A screenshot(if possible) would be even better.
Do you use the Testmap, or have you imported the library? Does the error still occur when you change the mouse position before detecting?
I have an Idea about that, i will fix that ;).
Thanks for the quick feedback :).
Since I can't try this out myself right now, could you explain how this works behind the scenes?
The scale is being calculated by getting the vertical mouse position and creating a dialog at the same time with lots 1px rows. With two events i get the mouse position and the "entered" dialogitem. Since there is an delay between these two events its important to make sure the Player didn't move the mouse in between. Then i get the Y-Offset of the dialog Item and divide it by the mouse position. Thats it for the scale.
Getting the maximal X and Y screen sizes works similar to desiderius1 library. Therefore I set the coursor to the middle of the screen using the build in action by blizzard. Then i get the mouse position again by showing these dialogs and getting the X and Y offsets and multiply them by 2.
The last thing i do i checking if the resolution is relativly close to a standart resolution. If it's close to a standart resolution, i assume it's the players resolution and then set the scale to an exact value.
EDIT:@Kueken531: I figuerd out all the errors, currently working on fixing them, because of your feedback I had quite a nice idea which allows getting the resolution even faster.
Hey there, i just updated the Library. I hope there are not so much bugs anymore. Would be really cool to get some feedback again ;).
Thanks Taldeen
I've some compiling errors on 1.5:
"lp_mousePosition = lib0E15B1AE_gv_internal[lp_player].lv_mousePositionRes;" in the library does not compile.
It's the same for "lib0E15B1AE_gv_resolutionDatabase[0][0] = 160;".
It needs to be "lib1_" in my testmap to work. :S
Also I was able to bug the testmap on battle.net. At least I was permanently unable to click anything on the screen.
But I'm not sure, if the testmap contains the updated library.
Nah, that was a stupid bug. I just changed some varnames. That was about it. I just uploaded a version with the Hotfix. I got this Library working on a (currenty) single playermap with no more issues.
The compiling error was because i forgot to write that after importing you have to change the library ID to 0E15B1AE. Hope everything works now.
I'm looking into implementing your Library's function into my map, however I'm not sure how to approach it, can you give me some advice?
http://www.sc2mapster.com/forums/development/triggers/41320-complex-talent-skill-tree-dialog-creation/
I just added some documentation stuff and wrote you a pm. Hope it helps. If there is anything else or you find a bug just ask. ;) And there is a new version avalible with a better describitons and with a minor bugfix.
I cant seem to get this to work?
I imported your library, and I can make it show me my resolution, but now when I try to create a dialog, I am setting it up like this, and It does not create a dialog.
I DID run both the setup and refresh action at initialization. Any idea why this is not working, or do I have to use another method.