Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Need a help with error


Warden
 Share

Recommended Posts

Hey,i added a updater in my client but when i try to open the client it loads till "loading menu" and then gives me error "type mismatch"

heres the form_load of frmMenu

> picprogress.width = 0
>     lblStatus.Caption = "Welcome to the " & GameName & " Launcher."
>    
>     CheckVersion
>    
>     If UpToDate = 0 Then
>     RunUpdates
>     Else
>    
>     End If

i think theres something wrong cause i added it and im a little nooby:D

checkversion is defined like that

> Public Sub CheckVersion()
> Dim Filename As String
>
>     ChangeStatus "Connecting to update server…"
>     SetProgress 0
>     ' get the file which contains the info of updated files
>     DownloadFile UpdateURL & "/update.ini", App.Path & "\tmpUpdate.ini"
>    
>     ChangeStatus "Connected to server!"
>     SetProgress 50
>     ChangeStatus "Retrieving version information."
>    
>     ' read the version count
>     VersionCount = GetVar(App.Path & "\tmpUpdate.ini", "UPDATER", "Version")
>    
>     ' check if we've got a current client version saved
>     If FileExist(App.Path & "\Data Files\Config.ini") Then
>         CurVersion = GetVar(App.Path & "\Data Files\Config.ini", "UPDATER", "Version")
>     Else
>         CurVersion = 0
>     End If
>    
>     SetProgress 100
>    
>     ' are we up to date?
>     If CurVersion < VersionCount Then
>         UpToDate = 0
>         ChangeStatus "Your client is outdated!"
>         VersionsToGo = VersionCount - CurVersion
>         PercentToGo = 100 / (VersionsToGo * 2)
>     Else
>         UpToDate = 1
>         ChangeStatus "Your client is up to date!"
>        
>        
>     End If
> End Sub

and RunUpdates

> Public Sub RunUpdates()
> Dim Filename As String
> Dim i As Long
> Dim UpdateID As Long
> Dim CurProgress As Long
>
>     If CurVersion = 0 Then CurVersion = 1
>     UpdateID = 0
>     CurProgress = 0
>     ' loop around, download and unrar each update
>     For i = CurVersion + 1 To VersionCount
>         ' Increase Update ID by 1
>         UpdateID = UpdateID + 1
>        
>         ' let them know we're actually doing something..
>         CurProgress = CurProgress + PercentToGo
>         ChangeStatus "Downloading update " & Str(UpdateID) & "/" & Str(VersionsToGo) & "…"
>         SetProgress CurProgress
>        
>         ' Download time!
>         Filename = "version" & Trim(Str(i)) & ".rar"
>         DownloadFile UpdateURL & "/" & Filename, App.Path & "\" & Filename
>        
>         ' Done downloading? Awesome.. Time to change the status
>         CurProgress = CurProgress + PercentToGo
>         ChangeStatus "Installing update " & Str(UpdateID) & "/" & Str(VersionsToGo) & "..."
>         SetProgress CurProgress
>        
>         ' Extract date from the update file.
>         RARExecute OP_EXTRACT, Filename
>        
>         ' Delete the update file.
>         Kill App.Path & "\" & Filename
>     Next
>    
>     ' Update the version of the client.
>     PutVar App.Path & "\Data Files\Config.ini", "UPDATER", "Version", Str(VersionCount)
>    
>     ' Done? Niiiice..
>     SetProgress 100 'Just to be sure, sometimes it misses ~1% due to the lack of decimals.
>     ChangeStatus "Your client is up to date!"
>     UpToDate = 1
> End Sub

thank you.
Link to comment
Share on other sites

@Warden:

> from vb6 i debug?
> i guess thats it

if you run EO in VB6 a window will apear when getting an error, there's a button with Debug on it, click it and it will select a piece of code (yellow), tell us the code hes selecting.
Link to comment
Share on other sites

didnt work :(
EDIT: now i got other prob..it gives me error "object variable or With block variable not set"
after i login into game….how to fix it?

> Sub HandleLoginOk(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
> Dim Buffer As clsBuffer
>
>     ' If debug mode, handle error then exit out
>     If Options.Debug = 1 Then On Error GoTo errorhandler
>    
>     Set Buffer = New clsBuffer
>     Buffer.WriteBytes Data()
>    
>     ' save options
>     Options.SavePass = frmMenu.chkPass.Value
>     Options.Username = Trim$(frmMenu.txtLUser.text)
>
>     If frmMenu.chkPass.Value = 0 Then
>         Options.Password = vbNullString
>     Else
>         Options.Password = Trim$(frmMenu.txtLPass.text)
>     End If
>    
>     SaveOptions
>    
>     ' Now we can receive game data
>     MyIndex = Buffer.ReadLong
>    
>     ' player high index
>     Player_HighIndex = Buffer.ReadLong
>    
>     Set Buffer = Nothing
>     frmLoad.Visible = True
>     Call SetStatus("Receiving game data…")
>    
>     ' Error handler
>     Exit Sub
> errorhandler:
>     HandleError "HandleLoginOk", "modHandleData", Err.Number, Err.Description, Err.Source, Err.HelpContext
>     Err.Clear
>     Exit Sub
> End Sub

i think theres some prob cause when loader writes "receiving game data…" it will crash and give the error...
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

×
×
  • Create New...