Ulysses

General => Developers Corner => Topic started by: XxLMM13xX on March 15, 2015, 02:23:54 PM

Title: Version Check?
Post by: XxLMM13xX 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!
Title: Re: Version Check?
Post by: Aaron113 on March 15, 2015, 03:12:49 PM
These should get you started.

http://forums.ulyssesmod.net/index.php/topic,3138.0.html (http://forums.ulyssesmod.net/index.php/topic,3138.0.html)
http://ulyssesmod.net/downloads.php (http://ulyssesmod.net/downloads.php)
Title: Re: Version Check?
Post by: XxLMM13xX on March 15, 2015, 03:49:30 PM
These should get you started.

http://forums.ulyssesmod.net/index.php/topic,3138.0.html (http://forums.ulyssesmod.net/index.php/topic,3138.0.html)
http://ulyssesmod.net/downloads.php (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???
Title: Re: Version Check?
Post by: Bytewave 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.
Title: Re: Version Check?
Post by: XxLMM13xX 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!
Title: Re: Version Check?
Post by: Bytewave 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.
Title: Re: Version Check?
Post by: XxLMM13xX 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!
Title: Re: Version Check?
Post by: JamminR 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.
Title: Re: Version Check?
Post by: XxLMM13xX 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)
Title: Re: Version Check?
Post by: lynx 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.
Title: Re: Version Check?
Post by: JamminR 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 (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)


Title: Re: Version Check?
Post by: Aaron113 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.
Title: Re: Version Check?
Post by: XxLMM13xX 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!
Title: Re: Version Check?
Post by: Livaco 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
Title: Re: Version Check?
Post by: XxLMM13xX 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