Jump to content

Online update scripts?


shanespen

Recommended Posts

I'm contemplating making a script for Buzzen, but before I do, I'd like to find out how to make an automatic updater that cran grab files off a server, and download and replace them over the current script's files, to update it. Kind of like the old GD's Gaurd Doctor. Is there a simple way to do something like that? A simple dialog pops up, you click check updates, it lists updates that the script doesn't have, and has a check box by it so you can check what you'd like to update, and then click download, and it shows the progress of the update? It would be greatly appreciated if someone could help me :P

Link to comment
Share on other sites

Guest X-Fusion

You'd have to query the server for version numbers. Travis and Gwen have both made one for VSIXc (I think), but, I believe they're both in private release. I've also made one, but, it's a full on script updater, so, you can update your script through it. Basic steps:

Connect to a server through a socket and downloading port

Query the server to see if there are similiarities between version numbers.

If your version is less than the one on the server, it updates it.

Loads it by using load -rs %var ..

alias -l MyScript.Version return versionhere
on *:signal:MyScript.Update:{
sockopen MyScript.Update $1 $2
sockmark MyScript.Update $1 $3-
}
on *:sockopen:MyScript.Update:{
sockwrite -n $sockname GET $+(/,$gettok($sock($sockname).mark,2-,32)) HTTP/1.0
sockwrite -n $sockname Host: $gettok($sock($sockname).mark,1,32)
sockwrite -n $sockname Connection: Close
sockwrite -n $sockname $crlf
sockmark $sockname 0 0
}
on *:sockread:MyScript.Update:{
var %MyScript.Read | sockread %MyScript.Read | tokenize 32 %MyScript.Read
if ($sock($sockname).mark == 0 0) && (!$1) { sockmark $sockname 1 0 }
if ($sock($sockname).mark == 1 0) && (alias -l MyScript.Version return isin $1-) && ($gettok($1-,$gettok($1-,0,32),32) != $MyScript.Version) { .write -c $+(",$script,") | sockmark $sockname 1 1 }
if ($sock($sockname).mark == 1 0) && (alias -l MyScript.Version return isin $1-) && ($gettok($1-,$gettok($1-,0,32),32) == $MyScript.Version) { sockclose $sockname }
if ($sock($sockname).mark == 1 1) { .write $+(",$script,") $1- }
}
on *:sockclose:MyScript.Update:{
.load -rs $+(",$script,")
}

Syntax: /signal MyScript.Update <Website URL (No http://)> <Port> <File Name>

It's more complicated then most think if your not used to sockets and the actual downloading process of it.

Edited by X-Fusion
Link to comment
Share on other sites

I made one that Gwen uses. Its not for VSIXc. You can see it in my SoulFly release. Available soon.

 

Basically I save my version information in an ini file. I save a txt file on my server that has the version information for the files on the server. So I read the txt file and match it with the version info I have from my script. If any version on the server is a greater number or if there is a file that is not on my script, it lists the file. If you choose it it will overwrite the existing file or create a new one respectively.

 

 

 

Edit: and I started with the script that X Fusion showed you. Granted I wrote it from scratch, but that code showed me how to use sockets.

Edited by Travis
Link to comment
Share on other sites

What do you mean the updater is not for VSIXc Travis?

 

Anyways, yes I started on my own using the code X-fusion posted, but I didn't have time to get very far on it, before Travis had his updater code all written.

 

:) So I'm using the updater code Travis made, to update the CE script for VSIXc, though I haven't even had time to get it all put together yet. It works nicely like the old GD one did though.

 

Looking forward to the SoulFly release :)

 

 

 

 

Link to comment
Share on other sites

I know that my GuarD-Doctor was a mad feature, and so were a few other features in GD, but the main reason why i haven't released any as addons were that they required to many codes from other sections of GD5. That can be overcome, i know. But if you were to say have 3 of my addons, i'm sure you would have 10 to 20 lines of code, identical to each script. Who knows, if i get bored, i might start releasing my stuff in GD5 as addons, but i doubt that'll happen as university starts up in 2 weeks.

 

Added: Don't expect these updater to be 100% effective. I know that with GuarD-Doctor, i struggled to get it to opperate at an optimum. People might think it done the job well, but i found there were still significant errors that i weren't happy with. However, this is me, the creator. I'm sure any creator will tell you that they are one of the biggest critics of their own work. If they aren't, then... well, the work may not be worth using.

Edited by The Gate Keeper
Link to comment
Share on other sites

Gwen, I meant the updater isnt network specific. It doesnt matter what network you are on. You upload files to the server and if they have a higher version number they will download them into your mirc folder.

 

TGK, maybe you can make an alias file. If anyone wants to use any of your addons they have to load the one alias file.

 

I know what you mean, this update code has been tricky. It went so easily the first time and was working great till I wanted something more out of it and the whole thing broke. Ive gone through that twice, but at least it's in better shape than it was. The hard part I haven't tackled yet is updating the updater script. I've given it a little thought. Download and load a temporary installer, unload the update script and run off the temp script which loads the new updater file. Unload and Delete the temp script. But for the meantime I'll just say, hey!! download this file and replace the old updater! :D

 

But I tell you, having an updater is so nice. Any little fix you find, you can upload and people will automatically get it. No more uploading the complete script. Just have to upload one file. :D

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...