Update script notification

Mwthorn

Helper
Staff member
Helper
Aug 6, 2016
46
0
6
28
Roskilde, Sjælland, Denmark
ggpvp.dk
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?)
 

Morphan1

Member
Aug 6, 2016
7
0
0
26
Florida
morphanone.space
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.
 

Anthony

Active member
Aug 5, 2016
35
0
6
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.

YKymKwn.png
 

Mwthorn

Helper
Staff member
Helper
Aug 6, 2016
46
0
6
28
Roskilde, Sjælland, Denmark
ggpvp.dk
Morphan1 said:
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 said:
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 said:
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
 

BlackCoyote

Well-known member
Aug 6, 2016
78
0
0
Mwthorn said:
Anthony said:
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
 

Anthony

Active member
Aug 5, 2016
35
0
6
Code:
  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>!'
      }
 

mcmonkey

Administrator
Staff member
Helper
Anthony said:
Code:
  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.
 

Anthony

Active member
Aug 5, 2016
35
0
6
mcmonkey said:
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
 

Mwthorn

Helper
Staff member
Helper
Aug 6, 2016
46
0
6
28
Roskilde, Sjælland, Denmark
ggpvp.dk
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?).
 

BlackCoyote

Well-known member
Aug 6, 2016
78
0
0
Anthony said:
mcmonkey said:
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