-
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
-
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
-
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.