SmashPuppet Posted January 15, 2018 Share Posted January 15, 2018 (edited) I wanted to display the version status of my config in the hangar to let others know when a new version is up. So I made one for XVM to use in the hangar and login via widgets with a simple script and thought that other custom config authors might want to use it for their own config pack as well. Because it was asked and because ktulho made a script that allows clickable links via widgets, I've completely updated the script(s). The display updates itself after every battle. (When the hangar is reloaded) Again, this is only useful and meant for config authors. If you do not make and distribute your own config, this is probably not for you. Images: Status Current: Status Update Available (after a click): There is also a notification if there is a network error as well as a version conflict - (you have a newer version than what is currently online). 2 Installation: Add this line to your @xvm.xc file. I put mine just after the hangar entry. "configVersionCheck": ${"configCheck.xc":"configVersionCheck"}, // Check custom config version Add this to your widgets.xc file in the login and lobby section. Login section: ${ "widgetsTemplates.xc":"configVersionLogin" } Lobby section: ${ "widgetsTemplates.xc":"configVersionHangar" } Add this to your widgetsTemplates.xc file. (don't forget to add the comma at the end if you need to. Depends on where you paste) // Config Version Check at Login Screen "configVersionLogin": { "enabled": true, "layer": "top", "type": "extrafield", "formats": [ { "updateEvent": "PY(ON_OPEN_BROWSER)", "x": 5, "y": 80, "screenHAlign": "left", "width": "{{py:cvc.checkVersion=1?350|200", "height": 30, "textFormat": { "color": "{{py:ob.highlight?{{.configVersionCheck.settings.currentColor}}|{{.configVersionCheck.settings.updateColor}}}}", "size": 15}, "format": "{{.configVersionCheck.settings.logo}}<font>{{.configVersionCheck.settings.configName}} {{py:cvc.checkVersion=0?<font color='{{.configVersionCheck.settings.currentColor}}'>{{.configVersionCheck.settings.version}} {{.configVersionCheck.settings.currentConfig}}</font>|{{py:cvc.checkVersion<0?<u>{{.configVersionCheck.settings.updateConfig}}</u>{{py:ob.address('{{.configVersionCheck.links.updateLink}}')}}|{{py:cvc.checkVersion>0?{{.configVersionCheck.settings.versionConflict}} <u>{{.configVersionCheck.settings.conflictInstruction}}</u>{{py:ob.address('{{.configVersionCheck.links.updateLink}}')}}}}}}}}</font>", "mouseEvents": {"mouseDown": "openBrowser_Down", "mouseOver": "openBrowser_Over", "mouseOut": "openBrowser_Out"} } ] }, // Config Version Check in Hangar "configVersionHangar": { "enabled": true, "layer": "top", "type": "extrafield", "formats": [ { "updateEvent": "PY(ON_OPEN_BROWSER)", "x": -280, "y": 50, "screenHAlign": "right", "width": "{{py:cvc.checkVersion=1?350|200", "height": 30, "textFormat": { "color": "{{py:ob.highlight?{{.configVersionCheck.settings.currentColor}}|{{.configVersionCheck.settings.updateColor}}}}", "size": 15}, "format": "{{.configVersionCheck.settings.logo}}<font>{{.configVersionCheck.settings.configName}} {{py:cvc.checkVersion=0?<font color='{{.configVersionCheck.settings.currentColor}}'>{{.configVersionCheck.settings.version}} {{.configVersionCheck.settings.currentConfig}}</font>|{{py:cvc.checkVersion<0?<u>{{.configVersionCheck.settings.updateConfig}}</u>{{py:ob.address('{{.configVersionCheck.links.updateLink}}')}}|{{py:cvc.checkVersion>0?{{.configVersionCheck.settings.versionConflict}} <u>{{.configVersionCheck.settings.conflictInstruction}}</u>{{py:ob.address('{{.configVersionCheck.links.updateLink}}')}}}}}}}}</font>", "mouseEvents": {"mouseDown": "openBrowser_Down", "mouseOver": "openBrowser_Over", "mouseOut": "openBrowser_Out"} } ] } Add these scripts to your py_macro folder. configVersionCheck.py {{py:cvc.checkVersion}} returns -1 if update, 0 if current and 1 if version conflict (you are using newer than what is online) openBrowser.py Modified (originally from this topic) Add this .xc file to your config folder. Edit the settings according to your own needs. It has my own settings in it and will probably not be useful to you as is! configCheck.xc And as an example, create a text file ( .txt ) and write your config version into it. Keep it small and concise. It can read any text-based document but a text file is simplest. Currently, the script does not allow for alphanumerics. Only numerics. - (Python's StrictVersion library) Example: 1.9.8 You will of course, need to upload this text file to a remote HTTP server and edit your config to match its URL. Every time you change your version number, package up your config after the necessary edits and then upload a new text file, containing the latest version number. If you host your own site, you should already be familiar with mod_rewrite and/or .htaccess files (assuming your host server is Unix/Linux (Apache etc) based). You may need to do some editing in order to access a file with a .txt extension. Just ask if you run into issues... I or someone here may be able to help you. Here is the provided settings file, configCheck.xc // Simple Config Version Checker for your Hangar. configVersionCheck.py ~ SmashPuppet (NA) 2018 { "configVersionCheck": { "enabled": true, "settings": { "version": "2.0.6", // Text to search for in remote file/document. Change it to your current version number before packaging config! "configName": "SmashConfig", // The name of your xvm configuration. "logo": "<img src='xvm://res/clanicons/NA/nick/SmashPuppet.png' vspace='-4' width='22' height='22'>", // your chosen config logo "updateConfig": "New Version!", // Text to display when a new version is available. "updateColor": "{{py:replace('{{.colors.system.enemy_alive}}', '0x', '#')}}", // The colour of the update text. (HTML colours) "currentConfig": "is Current.", // Text to display if configuration is current. "currentColor": "{{py:replace('{{.colors.system.ally_alive}}', '0x', '#')}}", // The colour of the current text. (HTML colours) "updateInstruction": "<b>Press F8</b> to view update.", // Text to display about updating "notAvailable": "Information not available!", // Text to display if network error. "versionConflict": "Version Conflict!", // Text to display if online version is older than current version. "conflictInstruction": "Check configCheck.xc!", // Text to display about a version conflict. IE if your version is newer than what is online. "internalBrowser": false // true - use the in-game web browser. false - use external web browser. }, "links": { "remoteLink": "https://smashpuppet.net/SmashConfig/version.txt", // link to remote text file containing the version text. "updateLink": "https://smashpuppet.net/smashconfig" // The update URL to get latest configuration. } } } Like I said, it is very simple. There is one catch, you cannot actually download anything from download links in the internal browser. If you would like to use your default desktop browser, then edit configVersionCheck.xc and make sure that "internalBrowser" is set to false. Many thanks to everyone here and the XVM devs for their tireless work. I hope you find this useful. Cheers! Edited September 1, 2018 by SmashPuppet Update August 31, 2018 4 @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted April 7, 2018 Share Posted April 7, 2018 Is not it possible to directly make a link that you can click ??? So you can directly download the mod MFG SicFunzler @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted April 9, 2018 Author Share Posted April 9, 2018 On 4/7/2018 at 2:04 PM, sicfunzler said: Is not it possible to directly make a link that you can click ??? So you can directly download the mod MFG SicFunzler It might be if I had used a button that is similar to the "store" for instance. Or if I had used the notifications centre at the bottom. Like XVM does. But I was going for very simple and something that will most likely not break in new versions of the game. Many of the other version checkers are no longer working after being abandoned. I will look into it though when I have time. Cheers! 2 @ Quote Link to comment Short link Share on other sites More sharing options...
konrad509 Posted April 10, 2018 Share Posted April 10, 2018 (edited) Didn't he mean the link here on the forums to download the whole thing, instead of individual files? At least that's how I understood it. Edited April 10, 2018 by konrad509 @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted April 11, 2018 Share Posted April 11, 2018 Thx Man pls look when you have time !!! MFG SicFunzler @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted April 11, 2018 Author Share Posted April 11, 2018 22 hours ago, konrad509 said: Didn't he mean the link here on the forums to download the whole thing, instead of individual files? At least that's how I understood it. 44 minutes ago, sicfunzler said: Thx Man pls look when you have time !!! MFG SicFunzler Good points both. Cheers! @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted June 3, 2018 Author Share Posted June 3, 2018 (edited) (This reply is no longer relevant) I finally found some time. =) I've made a few changes with the suggestions made in mind. Although you cannot download the update directly from within the hangar with this, you can however, hit a function key (in this case F8) to open the awesomium browser and view the update online from within the hangar. Borrowing some inspiration from @ktulho's siteXVM.py addon with a few changes. (Many thanks for his tireless work and sharing!)... I've also made the version comparison a little more intelligent than the original. I'll leave the main post as is for some may still want it as simple as can be. Installation is still the same as above. Configure the configCheck.xc, login.xc and widgetsTemplates.xc to your own parameters of course. Changed files: configVersionCheck.py configCheck.xc widgets.xc add/change these entries: /** * List of widgets. * Список виджетов. */ { "widgets": { "login": [ ${ "widgetsTemplates.xc":"configVersionLogin" } ], "lobby": [ ${ "widgetsTemplates.xc":"configVersionHangar" } ] } } widgetsTemplates.xc add/change these entries: // Config Version Check at Login Screen "configVersionLogin": { "enabled": true, "layer": "top", "type": "extrafield", "formats": [ { "x": 5, "y": 80, "screenHAlign": "left", "width": 400, "height": 60, "textFormat": { "color": "0xA8A888", "size": 12}, "format": "<img src='xvm://res/clanicons/{{region}}/nick/SmashPuppet.png' vspace='-4' width='22' height='22'><font size='15'>{{py:cvc.checkVersion}}</font>" } ] }, // Config Version Check in Hangar "configVersionHangar": { "enabled": true, "layer": "top", "type": "extrafield", "formats": [ { "x": -180, "y": 50, "screenHAlign": "right", "width": 400, "height": 60, "textFormat": { "color": "0xA8A888", "size": 12}, "format": "<img src='xvm://res/clanicons/{{region}}/nick/SmashPuppet.png' vspace='-4' width='22' height='22'><font size='15'>{{py:cvc.checkVersion}}</font>" } ...and that should be about it for changing it from a simple checker to something a little more "flashy". ;) Screenshot of Login Screen Enjoy! Edited June 18, 2018 by SmashPuppet @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted June 18, 2018 Author Share Posted June 18, 2018 Script updated to use clickable links. @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted June 19, 2018 Share Posted June 19, 2018 (edited) Только что, sicfunzler сказал: I hear ther are Problems with WG when you take the Browser form WG ???? MFG SicFunzler Edited June 19, 2018 by sicfunzler @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted June 20, 2018 Author Share Posted June 20, 2018 (edited) 5 hours ago, sicfunzler said: So far for my own page, the only thing that does not work is actually downloading a file. I was thinking of using a key press to download a file to the local drive. Getting the file URL from the config and placing it in the system's default downloads folder. Or, perhaps I can make a choice to use the internal or external browser(s). Of course, I would need to find out how opening an external browser works! Haha EDIT: Oh ok. I figured it out. I will update the main post soon. Added new option in configVersionCheck.xc. "internalBrowser": false // true - use the in-game web browser. false - use external web browser. Small modification to ktulho's openBrowser.py script. Updated main post. Edited June 20, 2018 by SmashPuppet @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted June 21, 2018 Share Posted June 21, 2018 THX man TOP work !!! MFG SicFunzler 1 @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted June 21, 2018 Author Share Posted June 21, 2018 Glad you find it useful @sicfunzler. =) 1 @ Quote Link to comment Short link Share on other sites More sharing options...
DKRUBEN Posted June 23, 2018 Share Posted June 23, 2018 good work man 1 @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted June 24, 2018 Author Share Posted June 24, 2018 (edited) I am not sure but maybe this thread would be better served in Components of XVM and addons (py_macro) section. Edit: Thank you Mr. Moderator! ;) Edited June 25, 2018 by SmashPuppet 1 @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted August 31, 2018 Share Posted August 31, 2018 Hello man i need a update for openBrowser.py Modified (originally from this topic) THX man MFG SicFunzler @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted August 31, 2018 Author Share Posted August 31, 2018 (edited) 9 hours ago, sicfunzler said: Hello man i need a update for openBrowser.py Modified (originally from this topic) THX man MFG SicFunzler Working on it! =D I might have to ask in the forums here if I can't find what changed. As soon as I have a solution, it will be posted here. In the meantime, set the config to use the internal browser. OK, first my apologies. I had thought the script was broken for different reasons than it was. Here it is and I will update the main post in a short while. Modified from kthulo's original script:openBrowser.py Cheers! Updated main post... Edited September 1, 2018 by SmashPuppet @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted September 1, 2018 Share Posted September 1, 2018 THX MAN MFG SicFunzler @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted October 21, 2018 Share Posted October 21, 2018 (edited) War ein XVM Fehler jetzt geht es wieder ;) MFG SicFunzler Edited October 28, 2018 by sicfunzler 1 @ Quote Link to comment Short link Share on other sites More sharing options...
SicFunzler Posted November 30, 2018 Share Posted November 30, 2018 (edited) 2018-11-30 18:00:00.538: ERROR: [EXCEPTION] (res_mods/configs/xvm/py_macro\configVersionCheck.py, 59): Traceback (most recent call last): File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 56, in checkVersion cmp = vMatch(search, page) File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 55, in <lambda> vMatch = lambda search, page: StrictVersion(search).__cmp__(page) File "scripts/common/Lib/distutils/version.py", line 40, in __init__ File "scripts/common/Lib/distutils/version.py", line 107, in parse ValueError: invalid version number '118' 2018-12-01 00:19:04.830: ERROR: [EXCEPTION] (res_mods/configs/xvm/py_macro\configVersionCheck.py, 59): Traceback (most recent call last): File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 56, in checkVersion cmp = vMatch(search, page) File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 55, in <lambda> vMatch = lambda search, page: StrictVersion(search).__cmp__(page) File "scripts/common/Lib/distutils/version.py", line 40, in __init__ File "scripts/common/Lib/distutils/version.py", line 107, in parse ValueError: invalid version number '120' Now know the Problem: when i give Version only 120 came ERROR When i give Version 1.2.120 it go :) ;) :) MFG SicFunzler Edited December 1, 2018 by sicfunzler @ Quote Link to comment Short link Share on other sites More sharing options...
SmashPuppet Posted December 1, 2018 Author Share Posted December 1, 2018 On 11/30/2018 at 8:04 AM, sicfunzler said: 2018-11-30 18:00:00.538: ERROR: [EXCEPTION] (res_mods/configs/xvm/py_macro\configVersionCheck.py, 59): Traceback (most recent call last): File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 56, in checkVersion cmp = vMatch(search, page) File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 55, in <lambda> vMatch = lambda search, page: StrictVersion(search).__cmp__(page) File "scripts/common/Lib/distutils/version.py", line 40, in __init__ File "scripts/common/Lib/distutils/version.py", line 107, in parse ValueError: invalid version number '118' 2018-12-01 00:19:04.830: ERROR: [EXCEPTION] (res_mods/configs/xvm/py_macro\configVersionCheck.py, 59): Traceback (most recent call last): File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 56, in checkVersion cmp = vMatch(search, page) File "res_mods/configs/xvm/py_macro\configVersionCheck.py", line 55, in <lambda> vMatch = lambda search, page: StrictVersion(search).__cmp__(page) File "scripts/common/Lib/distutils/version.py", line 40, in __init__ File "scripts/common/Lib/distutils/version.py", line 107, in parse ValueError: invalid version number '120' Now know the Problem: when i give Version only 120 came ERROR When i give Version 1.2.120 it go :) ;) :) MFG SicFunzler Yes, the python uses "strict" versioning checks. Glad you figured it out. Cheers! =) 1 @ Quote Link to comment Short link Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.