Jump to content

Game Updating


Recommended Posts

I wondered how i can make a updater for a Half Life2 Mod.

I have tried to make one but it didn't work.

Can some one make a updater that:

- checks what version of the game by viewing an version.ini file that is in the game directiory

- checks an version.ini file on a server/website that it will check what version you got

- downloads a folder from the internet and put it into the game directory

Could someone help us?

Edit: Scroll down :)

Edited by Chris86
Link to comment
Share on other sites

Even though they didn't work... Post what source you have tried. Proof of concept is always a plus. :)

You will need the Global local directory for the INI, the server path/URL to the latest INI, and the URL for the folder, and local directory for storage. :P

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

Even though they didn't work... Post what source you have tried. Proof of concept is always a plus. :)

You will need the Global local directory for the INI, the server path/URL to the latest INI, and the URL for the folder, and local directory for storage. :P

Ok. I got some ideas now.. but im not sure how to use iniread on a ini file on a webserver

but heres my code that i have been working on.

#include <GUIConstants.au3>
#include <IE.au3>
#include <File.au3>
GUICreate("PVKII Updater",300,200)

;Settings
Opt("TrayAutoPause",0) 
GuiSetIcon ("pvkii.ico")

;Tray Menu
$checkbutton = TrayCreateItem("Check For Updates")
$exitbutton = TrayCreateItem("Exit")

;Knapper
$filemenu = GuiCtrlCreateMenu ("Options")
$fileitem = GuiCtrlCreateMenuitem ("Set Game Directory...",$filemenu)
$separator1 = GuiCtrlCreateMenuitem ("",$filemenu)
$helpmenu = GuiCtrlCreateMenu ("Help")
$helpitem = GuiCtrlCreateMenuitem ("Help",$helpmenu)
$aboutitem = GuiCtrlCreateMenuitem ("About",$helpmenu)
$exitbutton = GuiCtrlCreateButton ("EXIT",200,150,70,20)

$downloadbutton = GuiCtrlCreateButton ("Download",20,1000,120,20)
$visitbutton = GuiCtrlCreateButton ("Visit PVKII Website",20,125,120,20)
$checkbutton = GuiCtrlCreateButton ("Check For Updates",80,20,140,20)
$forumbutton = GuiCtrlCreateButton ("Visit PVKII Forum",20,150,120,20)

$ping = Ping("www.google.com",4000)
;GUICtrlCreatePic("1.jpg", 0, 0, 300, 200) 
;----------------------------------------------------




GuiSetState()

While 1
    $msg = GUIGetMsg()
    

    Select
        Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitbutton
            ExitLoop
        
        Case $msg = $fileitem
            $gamedir = FileSelectFolder("Set Gamedirectory...", "Pvkii")
            If @error <> 1 Then ExitLoop
            If FileExists($gamedir & '/updatersettings.ini') Then
            IniWrite($gamedir & '/updatersettings.ini', "Settings", $gamedir);Here it saves the path to the gamedirectory into an ini File
                                                                        ;But i get an error :'(
            Else
          
          $createini = _FileCreate ($gamedir & '/updatersettings.ini')  
          EndIf

           
        
            Case $ping = 0
        MsgBox(0, "Error", "You must be connected to the Internet!")        
        ExitLoop

    
        Case $msg = $checkbutton
;First it need to check what version the game is by getting the gameversion from version.ini that comes with the game
        
;Here it need to look for new updates by checking updates.ini that is located somewhere on the web
        
        Msgbox(0,"PVKII - Updater","New Update Avable!");This need to be fixed
        
        $downloadbutton = GuiCtrlCreateButton ("DOWNLOAD UPDATE",80,20,140,20)
        GUICtrlDelete($checkbutton)
        
        Case $msg = $visitbutton 
        $oIE = _IECreate ("http://www.PVKII.com", 1, 1, 0)
        
        Case $msg = $helpitem
        MsgBox(262208,"PVKII Updater - Help","How To Get Started:" & @CRLF & "" & @CRLF & "The only thing you have to do to get the updater to work is to select the game directory." & @CRLF & "Go to Option>Set Gamedirectory and go to the sourcemods folder that is located here:" & @CRLF & "Steam/Steamapps/sourcemods and select PVKII")
        
        Case $msg = $forumbutton
       $oIE = _IECreate ("http://forums.Pvkii.com", 1, 1, 0)
       
       Case $msg = $downloadbutton
       $progressbar = GUICtrlCreateProgress (45,45,200,20,$PBS_SMOOTH)
       Msgbox(0,"PVKII - Updater","Update Succesful")
       ContinueLoop
        Case $msg = $aboutitem
            Msgbox(0,"PVKII - Updater","PVKII Updater 1.0" & @CRLF & "Made By The PVKII TEAM")
    EndSelect
WEnd

GUIDelete()

Exit

Examples of the updates.ini that is on a website:

[Updates]
1.2.2
1.2.1
1.2.0

this list up all the updates that is avable.

so if the script decide to download update 1.2.2

then it downloads this folder: http://www.mysite.com/updates/1.2.2 to the computer and copy the folder inside it named pvkii and pasts it in the gamedirectory

I had an idea that the script writes the gamedir into the same file as the version.ini file that comes with the game.(then gamedir have to be on the second line so the gameversion don't get messed up)

Example of the version.ini that is in the gamedirectory

[Version]
gameversion=1.2.0
[Gamedir]
gamedir=C:/programfiles/pvkii
Edited by Chris86
Link to comment
Share on other sites

Ok Chris, I think you have more than proved that you want to accomplish this...

IniWrite($gamedir & '/updatersettings.ini', "Settings","GameDir", $gamedir) <--- You forgot the "key" Look at the Syntax usage again.... :)

I started the build of a small script that will

- checks what version of the game by viewing an version.ini file that is in the game directiory

- checks an version.ini file on a server/website that it will check what version you got

- downloads a folder from the internet and put it into the game directory

I'll see what you think tomorrow... :P

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

Ok Chris, I think you have more than proved that you want to accomplish this...

IniWrite($gamedir & '/updatersettings.ini', "Settings","GameDir", $gamedir) <--- You forgot the "key" Look at the Syntax usage again.... :)

I started the build of a small script that will

- checks what version of the game by viewing an version.ini file that is in the game directiory

- checks an version.ini file on a server/website that it will check what version you got

- downloads a folder from the internet and put it into the game directory

I'll see what you think tomorrow... :P

Perfect! :)

this list up all the updates that is avable.

so if the script decide to download update 1.2.2

then it downloads this folder: http://www.mysite.com/updates/1.2.2 to the computer and copy the folder inside it named pvkii and pasts it in the gamedirectory

Remember this?.

I think that the updatefolder should have the version name then it will be easier to download

Case $msg = $downloadbutton
       
       $progressbar = GUICtrlCreateProgress (45,45,200,20,$PBS_SMOOTH)
      ;$newversion = Newest version
      ;$updatelink(or something) = Link to the update folder
      ;$newupdatefolder = $updatelink"/" & $newversion (like: http://mysite.com/update/1.2.0)
      ;for the download u can for example do:
      ;$newupdatefolder"/" & $gamename (like: http://mysite.com/update/1.2.0/pvkii)
Edited by Chris86
Link to comment
Share on other sites

While 1
sleep(1000000)
InetGet("URL TO UPDATED INI","C:\onlineversion.txt")
$OnlineVersion = FileRead("C:\onlineversion.txt")
$number[7] = ["3","4","5","6","7","8","9","10"]
If StringInStr($OnlineVersion,"2.2." & $number) Then
InetGet("URL OF UPDATED DIRECTORY","C:\LOCAL")
EndIf
$number += 1
Else
    If $number = 7 Then
        $number = 0
    EndIf
EndIf
WEnd

This would work for updates like 2.2.2 ---> 2.2.3 --->2.2.4--->ETC

I really wasn't going to post this, because your GUI and src, surpasses mine by a mile. I was just going to say, it it were me... I'de be simple... :)

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

While 1
sleep(1000000)
InetGet("URL TO UPDATED INI","C:\onlineversion.txt")
$OnlineVersion = FileRead("C:\onlineversion.txt")
$number[7] = ["3","4","5","6","7","8","9","10"]
If StringInStr($OnlineVersion,"2.2." & $number) Then
InetGet("URL OF UPDATED DIRECTORY","C:\LOCAL")
EndIf
$number += 1
Else
    If $number = 7 Then
        $number = 0
    EndIf
EndIf
WEnd

This would work for updates like 2.2.2 ---> 2.2.3 --->2.2.4--->ETC

I really wasn't going to post this, because your GUI and src, surpasses mine by a mile. I was just going to say, it it were me... I'de be simple... :)

Woah! Ur the best man!

But

$number[7] = ["3","4","5","6","7","8","9","10"]

so if its update 1.1.0 then it will not download?

Well it doesn't matter if the script need to do it on your way but i only need versioncheck func , updatecheck func , downloader and the func that copies the files into the gamedir

If u forget the GUI and just think about the code for the mentioned funcs and i work on inserting it into an GUI. i dont really need a download progressbar. After a while i will update the Game Updater.

Edit: can u make it update from 1.0.0 and up?

and can u tell me that ur code is doing? xD

Edited by Chris86
Link to comment
Share on other sites

While 1
sleep(1000000) ; Waits a while before runnign the loop again...
InetGet("URL TO UPDATED INI","C:\onlineversion.txt") ; downloads the latest INI
$OnlineVersion = FileRead("C:\onlineversion.txt") ;  Load that file into a variable
$number[10] = ["0","1","2","3","4","5","6","7","8","9","10"] ; Add the 3rd version extension... like *.*.(3rd extension) --> *.*.*
If StringInStr($OnlineVersion,"1.0." & $number) Then ; Right here it looks and see's if the latest online version is higher than your current
InetGet("URL OF UPDATED DIRECTORY","C:\LOCAL") ; If so download the latest URL
EndIf
$number += 1 ; Add one to the version number to check for
Else
    If $number = 7 Then
        $number = 0
    EndIf
EndIf
WEnd

It's all simple, I'll rewrite it correctly tonight, something like 10pm EST. I'll actually use better functions... :)

SIGNATURE_0X800007D NOT FOUND

Link to comment
Share on other sites

  • 2 weeks later...

Maybe try this?...

#include<Array.au3>
Dim $number
$number=_ArrayCreate("0","1","2","3","4","5","6","7","8","9","10")
It seems like i have to change whole the code..

because i get this error if i change it:

If $number = 7 Then 
If ^ ERROR
Edited by Chris86
Link to comment
Share on other sites

After i read the code above and realized it doesn't make sense, what are you trying to do? Maybe explain better? or how do you obtain the version info

That code was made by BinaryBrother, i only need a script that checks what version of the game and new version buy viewing an ini file on the website

this ini will be places somewhere on a website that lists up all newest version from 1.0.0 and up

Updates
1.0.1
1.0.8
1.2.2

so if i have version 1.0.0 and going to update to 1.0.1 then it will for example download this folder: http://www.mysite.com/updates/1.0.1/PVKII(the game name/gamefolder name)

and place it in C:\Programfiles\PVKII

without messing up the other gamefiles

the version.ini(here can the script get the current version of the game) file that comes with the game looks like this

Version
version=1.0.0

Better now??

Edited by Chris86
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...