Results 1 to 3 of 3

Thread: read\write operations

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2000
    Location
    Mentor,Oh,US
    Posts
    33
    I am making a game launcher and it launches custom maps for a game called QUAKE 3. Basically, it writes the name of some maps (actual files) to a text file. QUAKE 3 can exec The only problem is... QUAKE 3 adds in the .bsp file extention in the game. The map name is taken from: File2.FileName
    So when in the game, it can't execute the map, and it thinks I'm specifiying smash3.bsp.bsp. So I would like to know how to get rid of the .bsp in the text, after my app outputted to the text file. Anything... ANYBODY!?

    -dead

  2. #2
    Lively Member
    Join Date
    Jan 2000
    Location
    Springfield, IL
    Posts
    124
    You strip off the .bsp before writing to your output file.

    code for VB6
    Code:
    Private Function RemoveExtension(Filename As String, ExtToRemove As String) As String
        
        
        RemoveExtension = Replace(Filename, "." & ExtToRemove, "")
        
        
    End Function
    
    Private Sub Command1_Click()
    
        MsgBox RemoveExtension(Text1.Text, "bsp")
    
    End Sub

    Code for VB5
    Code:
    Private Function RemoveExtension(Filename As String, ExtToRemove As String) As String
        
        Dim intPos As Integer
        
        intPos = InStr(1, Filename, "." & ExtToRemove)
        If intPos > 0 Then
            RemoveExtension = Mid(Filename, 1, intPos - 1) & Mid(Filename, intPos + Len(ExtToRemove) + 1)
        Else
            RemoveExtension = Filename
        End If
        
        
    End Function
    
    Private Sub Command1_Click()
    
        MsgBox RemoveExtension(Text1.Text, "bsp")
    
    End Sub

  3. #3
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Mobile, AL, USA
    Posts
    600
    I'm not completely sure what you are asking but maybe this can help:
    Code:
    If Right(ProblemString, 4) = ".bsp" Then
           ProblemString = Left(ProblemString, Len(ProblemString) - 4)
    End If
    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width