mIRC Homepage
Posted By: SnakeRulez How I can make a update socket? - 23/05/03 04:37 PM
please help me to make a update soket for my bot
Posted By: Knappen Re: How I can make a update socket? - 23/05/03 05:37 PM
What exactly do you want? An update checker or an update dowloader? I can provide you with both if you want! smile
Posted By: SnakeRulez Re: How I can make a update socket? - 23/05/03 05:40 PM
Yes, That what i need
Posted By: Knappen Re: How I can make a update socket? - 24/05/03 01:01 PM
OK...

First of all you have to have a version checker to check if there is a new update..

Code:
 

alias update.check
  sockclose script.updatecheck
  sockopen script.updatecheck www.geocities.com 80
}

on *:sockopen:script.updatecheck:{
  if ($sockerr) { echo -a Cannot resolve server | halt }
  sockwrite -n $sockname GET /botsnake/index.htm HTTP/1.1
  sockwrite -n $sockname Host: www.geocities.com
  sockwrite -n $sockname $crlf
}

on *:sockread:script.updatecheck:{  
var %version = your current version
  var %ver
  :loop 
  sockread -f %ver 
  if (!$sockbr) return  
  if (!%ver) %ver = -  
if (Version * iswm %ver) { %ver = $gettok(%ver,2,32) }
  if (%ver == %version) { echo -a There is no updates }
  if (%ver > %version) { echo -a A new update!  | $download.update }  
  goto loop
}



If there is an new update, the script will execute the following commands..

Code:
 

alias -l download.update {
sockopen download.update www.geocities.com 80
}

on *:sockopen:download.update:{
  sockwrite -n $sockname GET /botsnake/Bot.exe 
echo -a Downloading...
}

on *:sockread:download.update:{
  sockread &temp   
  if (!$sockbr) return   
  bwrite Bot.exe -1 &temp       
}

on *:sockclose:download.update:{
echo -a Download complete!
}

 

Posted By: SnakeRulez Re: How I can make a update socket? - 24/05/03 01:57 PM
1. What i need to replace? - I don't know sockets..
The site that be for downloading the bot is www.geocities.com/botsnake/Bot.exe
and the page that be writing there the new versions is
www.geocities.com/botsnake/index.htm

So what i need to change?
Posted By: Knappen Re: How I can make a update socket? - 24/05/03 02:44 PM
I have editet the code for you so you can copy it clean and paste it in to your remote.

!!!!!! The only thing you have to change is where it says
var %version = your current version
replace the blue text with whatever version your script is.
Posted By: NaquadaServ Re: How I can make a update socket? - 26/05/03 03:57 PM
I have some good upgrading code in my Qserve scripts...

The script automates producing upgrades and automates upgrading on the user end. The upgrade is installed without shutting down mirc. Upgrades are downloaded via http and uploaded via FTP. It also supports upgrading it's self.

Goto www.qserve.org and download, look at the following files...

Code:
- system\Remotes\other.ini (Upgrade the Upgrade Module)
   * on *:SIGNAL:UPGRADE_START
   * alias webget.f
   * alias install.upgrade.upgrade
   * on 1:sockopen:webfile2
   * on 1:sockread:webfile2
   * on 1:sockclose:webfile2
   * on *:SIGNAL:UPGRADE_COMPLETE (Remove run.once from here)
'
- system\Remotes\Upgrades.ini (Primary upgrade code)
   * Look at the whole file
   * %FTP.Site 80.80.80.80
   * %FTP.Port 21
   * %FTP.Login loginname 
   * %FTP.Pass password
   * %FTP.PostUpload $true
   * %FTP.RemoteFolder /Qserve-Update/
'
- gzip.exe
   * Used for compression

%FTP.Login and %FTP.Pass are not in the scripts, they are variables only needed on the producers end and should be set manulally...

- You will need to create a "version.txt" file as a template of what files to include in the upgrade. Put it in $mircdir.
Code:
MASTER_LIST (Dummy line, not used...)
fileserver.ini
ftp_addon.ini


Also I use a global variable called "%Version". It is increment by 0.001 every time /make.upgrade is done.
© mIRC Discussion Forums