ULX

Author Topic: Version Check?  (Read 4558 times)

0 Members and 1 Guest are viewing this topic.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Version Check?
« on: March 15, 2015, 02:23:54 PM »
Ok so i see on alot of addons a version check that says something like... Version is not up to date download the new version here: (link)

I have no clue how to do this all i know is people do it with the github download thing.. I really dont know...

If you can find a tut on this or teach me step to step that would be awesome! Thanks!

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Version Check?
« Reply #1 on: March 15, 2015, 03:12:49 PM »

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Version Check?
« Reply #2 on: March 15, 2015, 03:49:30 PM »
These should get you started.

http://forums.ulyssesmod.net/index.php/topic,3138.0.html
http://ulyssesmod.net/downloads.php

I do not understand how this will help??? I know how to download a SVN...

Please explain how that will help???

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Version Check?
« Reply #3 on: March 15, 2015, 04:01:32 PM »
Simple.

Create a VERSION constant in one of your scripts (or probably a new one), and assign it a value.
Host a version file on the location of your choice on the public Internet. Gist or Dropbox is great for that. In the file, write nothing more than the value that you assigned VERSION.
Then, run an http.Get() on your URL in Garry's Mod, probably when a GUI is created or on a hook of some type.
In the success callback, compare the response of http.Fetch() to the VERSION constant's value. If the same, up to date. If different, outdated. Handle as you wish.
bw81@ulysses-forums ~ % whoami
Homepage

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Version Check?
« Reply #4 on: March 15, 2015, 04:26:50 PM »
Simple.

Create a VERSION constant in one of your scripts (or probably a new one), and assign it a value.
Host a version file on the location of your choice on the public Internet. Gist or Dropbox is great for that. In the file, write nothing more than the value that you assigned VERSION.
Then, run an http.Get() on your URL in Garry's Mod, probably when a GUI is created or on a hook of some type.
In the success callback, compare the response of http.Fetch() to the VERSION constant's value. If the same, up to date. If different, outdated. Handle as you wish.

This probably would help ALOT! The thing is i dont know what ANYTHING in what you said does... I'm asking for help on what to do... (this means EVERYTHING) like what file do i create? How do i make it check for the new versions? basicly where does the http thingy go? Explain a little better if you could...

Thanks so far btw!

Offline Bytewave

  • Respected Community Member
  • Hero Member
  • *****
  • Posts: 718
  • Karma: 116
  • :)
    • My Homepage
Re: Version Check?
« Reply #5 on: March 15, 2015, 04:50:21 PM »
This probably would help ALOT! The thing is i dont know what ANYTHING in what you said does... I'm asking for help on what to do... (this means EVERYTHING) like what file do i create? How do i make it check for the new versions? basicly where does the http thingy go? Explain a little better if you could...

Thanks so far btw!
*le facepalm*
If you're going to be developing addons, a simple version check script should be easy enough for you.
Seriously.
Don't push to code new addons if you can't even write small parts like this.
bw81@ulysses-forums ~ % whoami
Homepage

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Version Check?
« Reply #6 on: March 15, 2015, 05:08:12 PM »
*le facepalm*
If you're going to be developing addons, a simple version check script should be easy enough for you.
Seriously.
Don't push to code new addons if you can't even write small parts like this.

I'm making really basic ULX commands... It was just a question on a cool idea...

If you still can help pls do!

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Version Check?
« Reply #7 on: March 15, 2015, 06:01:35 PM »
It seems your current lua experience level is not up to this point of using version checks yet.
You need to understand basic coding lingo before you can learn any programming language.
Constant. Variable. Assign. Value. Callback.
All key words that relate to coding, and not just lua.

You have a web site.
Perhaps it hosts your code.
You have a file within that site that has your CURRENT up to date version number.
Plain text is easiest to work with.
File named version.txt could contain simply the text "4"
Your script contains variable "3".
Your script uses http.Fetch() and points to the file on your website that grabs "4"
As described in the gmod wiki, http.Fetch() has two functions it must point to, one on success, one on failure.
The on success function would check is current version greater than script version. Yes, tell them to update. No, do nothing.
The failure function tells them "sorry, can't contact server right now".

All these scripts you mention have perfect examples of how to do the above.
« Last Edit: March 15, 2015, 06:05:07 PM by JamminR »
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Version Check?
« Reply #8 on: March 15, 2015, 06:28:50 PM »
Ok I'll look more into it! Thanks everyone for trying to help... I will continue to learn lua from nothing... (Meaning I still don't know where i'm supposed to learn lua but whatever)

Offline lynx

  • Jr. Member
  • **
  • Posts: 59
  • Karma: 15
Re: Version Check?
« Reply #9 on: March 15, 2015, 06:31:31 PM »
Learning from nothing you should start with the tutorials. I'm not sure of any on the current wiki, but the copy of the old wiki still has the LUA tutorial series that I used to learn. Some things may have changed in updates, but it is a good place to start.

https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index7a06.html

Start with learning from tutorials then go into working on projects.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Version Check?
« Reply #10 on: March 15, 2015, 07:33:56 PM »
(Meaning I still don't know where i'm supposed to learn lua but whatever)
You asked, and were answered, the same question here - http://forums.ulyssesmod.net/index.php/topic,7970.msg40450.html#msg40450
Before you can learn lua, you must learn to read and apply what is in front of you to begin with.
I'm getting the idea you're not even there yet (applying knowledge resources)


"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline Aaron113

  • Hero Member
  • *****
  • Posts: 803
  • Karma: 102
Re: Version Check?
« Reply #11 on: March 15, 2015, 10:02:52 PM »
I thought you were asking how to fix the outdated version error.  Haha, my bad.  I'll read more carefully next time.

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Version Check?
« Reply #12 on: March 16, 2015, 03:49:39 AM »
I've done all the tutorials on the wiki and all it teaches is local vars and it doesn't help at all! Idk this is not the place to be asking for Kia help but thanks for the help on the topic anyway!

Offline Livaco

  • Full Member
  • ***
  • Posts: 133
  • Karma: -37
    • Livaco
Re: Version Check?
« Reply #13 on: March 28, 2015, 05:56:46 AM »
That Means That You Need To Update The Addon Of ULX, Once You Have Done That You Should Be Able To Use Awarn And Other Addons
Here To Help And Be Happy And Help :)

My Website
My Addons
PermaBanV1.0

Quote from:  Livaco on April 12 at 9:10:20 PM
I May Be Dum But Am Still Better Then The Rest

Livaco Products©

Offline XxLMM13xX

  • Sr. Member
  • ****
  • Posts: 265
  • Karma: -51
  • New to lua development
    • Twitch
Re: Version Check?
« Reply #14 on: March 28, 2015, 07:13:20 AM »
That Means That You Need To Update The Addon Of ULX, Once You Have Done That You Should Be Able To Use Awarn And Other Addons

This is not a problem... I think your on the wrong topic