Page 1 of 1

Update script notification

Posted: August 19th, 2016, 6:17 am
by Mwthorn
Since we have started to collect data on servers using <script-tracker>, could it then respond back to notify the server that there is a new version of the script to download?

And, if possible, it would be neat to type a command to automatically download the newest script available. To save time and easy updated to the latest version. (Maybe a script could do this?)

Re: Update script notification

Posted: August 19th, 2016, 1:39 pm
by Morphan1
I think there is something to check if you're using the latest scripts already, but we won't add automatic downloads. It's unsafe, as someone could easily add in a script that you don't want and you'd never know.

Re: Update script notification

Posted: August 19th, 2016, 1:43 pm
by Anthony
My scripts already do this... in part. They will notify you if there's a new version of it available and give you a clickable link to the repo so you can download and install if you wish.

Image

Re: Update script notification

Posted: August 19th, 2016, 5:08 pm
by mcmonkey
You can also at any time do:
/denizen scriptversions

To check the status of all properly configured repo scripts.

Re: Update script notification

Posted: August 20th, 2016, 5:12 am
by Mwthorn
Morphan1 wrote:I think there is something to check if you're using the latest scripts already, but we won't add automatic downloads. It's unsafe, as someone could easily add in a script that you don't want and you'd never know.
Fair enough.
Anthony wrote:My scripts already do this... in part. They will notify you if there's a new version of it available and give you a clickable link to the repo so you can download and install if you wish.
Do you mind if I use this for my scripts? the procedure check for version
mcmonkey wrote:You can also at any time do:
/denizen scriptversions
To check the status of all properly configured repo scripts.
Neat :) Amazing that this exists in Denizen Builds for 1.8 as well

Re: Update script notification

Posted: August 20th, 2016, 5:23 am
by BlackCoyote
Mwthorn wrote:
Anthony wrote:My scripts already do this... in part. They will notify you if there's a new version of it available and give you a clickable link to the repo so you can download and install if you wish.
Do you mind if I use this for my scripts? the procedure check for versionl
it requires the webget command from 1.10

Re: Update script notification

Posted: August 20th, 2016, 6:41 am
by Anthony

Code: Select all

  updateCheck:
    - ^if !<server.has_flag[dRegions.Version.Repo]> {
      - ~webget "http://www.mcmonkey.org/denizen/repo/version/<s@dRegions_Version.yaml_key[id]>" save:page
      - ^flag server "dRegions.Version.Repo:<entry[page].result||unknown>" d:1h
      }
    - ^define repoVersion '<server.flag[dRegions.Version.Repo]||unknown>'
    - ^define currentVersion '<s@dRegions_Version.yaml_key[version]>'
    - ^if '%repoVersion%' == 'unknown' {
      - run s@msgPrefixed instantly 'def:dRegions|<&7>Unable to check for update! <&7><&o>%currentVersion%<&7> is installed!'
      }
      else if '%repoVersion%' > '%currentVersion%' {
      - run s@msgPrefixed instantly 'def:dRegions|<&7>Update from version <&o>%currentVersion%<&7> to <&o>%repoVersion%<&7>!'
      }
      else if '%repoVersion%' != '%currentVersion%' {
      - run s@msgPrefixed instantly 'def:dRegions|<&7>What happened? You are on version <&o>%currentVersion%<&7> and the repo says <&o>%repoVersion%<&7>!'
      }

Re: Update script notification

Posted: August 20th, 2016, 5:33 pm
by mcmonkey
Anthony wrote:

Code: Select all

  updateCheck:
    - ^if !<server.has_flag[dRegions.Version.Repo]> {
      - ~webget "http://www.mcmonkey.org/denizen/repo/version/<s@dRegions_Version.yaml_key[id]>" save:page
      - ^flag server "dRegions.Version.Repo:<entry[page].result||unknown>" d:1h
      }
    - ^define repoVersion '<server.flag[dRegions.Version.Repo]||unknown>'
    - ^define currentVersion '<s@dRegions_Version.yaml_key[version]>'
    - ^if '%repoVersion%' == 'unknown' {
      - run s@msgPrefixed instantly 'def:dRegions|<&7>Unable to check for update! <&7><&o>%currentVersion%<&7> is installed!'
      }
      else if '%repoVersion%' > '%currentVersion%' {
      - run s@msgPrefixed instantly 'def:dRegions|<&7>Update from version <&o>%currentVersion%<&7> to <&o>%repoVersion%<&7>!'
      }
      else if '%repoVersion%' != '%currentVersion%' {
      - run s@msgPrefixed instantly 'def:dRegions|<&7>What happened? You are on version <&o>%currentVersion%<&7> and the repo says <&o>%repoVersion%<&7>!'
      }
Huh. Usually update checkers are just a !=, because versions only form valid numbers half the time.
Just look at the Denizen version: 0.9.8 - that's not a valid number, it has two decimals in it.

Re: Update script notification

Posted: August 20th, 2016, 8:50 pm
by Anthony
mcmonkey wrote:Huh. Usually update checkers are just a !=, because versions only form valid numbers half the time.
Just look at the Denizen version: 0.9.8 - that's not a valid number, it has two decimals in it.
Totally valid point. IF your version string is NAN than you won't be able to do numeric comparisons. That being said... i intentionally keep my version strings actual numbers so i can.

YMMV

Re: Update script notification

Posted: August 22nd, 2016, 1:21 am
by Mwthorn
Using a numeric comparison version check, you could compare and show all the changes from the current version up to the newest.
This would allow a user to decide if the script should be updated or not (of course you should always update, right?).

Re: Update script notification

Posted: August 22nd, 2016, 1:22 am
by BlackCoyote
Anthony wrote:
mcmonkey wrote:Huh. Usually update checkers are just a !=, because versions only form valid numbers half the time.
Just look at the Denizen version: 0.9.8 - that's not a valid number, it has two decimals in it.
Totally valid point. IF your version string is NAN than you won't be able to do numeric comparisons. That being said... i intentionally keep my version strings actual numbers so i can.

YMMV
I just keep my version strings actual numbers cuz its easier yolo