I need some major guidance.

Hello! I am writing a program in Visual Basic 2005 and I am stumped. The program is for some fellow game developers on another forum. This program is a main menu for a online PC game. It has a chat function and a level selection menu and everything. But I want to allow other people to customize the menu for thier game. I need to know how to compile the program and allow a .ini file or something of the sort to change the details of the program. Like for example when you click the about button I have it display in a message box "GAME NAME was created by AUTHOR NAME. Copyright 2007." I want people to be able to change the information to "Pacman was created by John Doe. Copyright 2007 John Doe."

I think the way to do this is make config files that the users can edit with notepad to change the program. Is this possible? If so I need a pretty in depth tutorial or something. If any one is willing to go step by step with me please post back.

Comments

  • seancampbellseancampbell Pennsylvania, USA
    Hmmm, I do something like this for some software I wrote for work. My program loads and assigns where panels and buttons are located based on the user's last setup (I wrote functons that allow the user to click and drag the objects).

    There are advanced ways to go about doing the function you are explaining, but I think you will find it easier to just write a function like this:

    [Code]
    Private Sub LoadSettings()

    'This will set FF = 1 in most cases
    Dim FF As Integer = FreeFile()
    'Create a String Array to split each line of
    'the config file into
    Dim Str() As String
    'Create a temp String to grab the full line into
    Dim TempStr As String

    'Open File with FF as the reference number
    'Can change the filepath to whatever you need
    FileOpen(FF, "C:program nameconfig.txt", OpenMode.Input)

    Do While Not EOF(FF)

    'Grab the next line out of the text file
    Input(FF, TempStr)
    'Split the line into an array of strings
    'In the config file it would be entered as follows:
    'AuthorName=Angus
    'GameName=Steak
    'WhosTheBaddest=ShoNuff
    Str = TempStr.Split("=")

    Select Case Str(0)
    Case "AuthorName"
    'AuthorName = Str(1)
    Case "GameName"
    'GameName = Str(1)
    Case "WhosTheBaddest"
    'SeanCampbell = Str(1)
    End Select

    Loop

    FileClose(FF)

    End Sub

    Private Sub SaveSettings()

    'This will set FF = 1 in most cases
    Dim FF As Integer = FreeFile()

    'Open File with FF as the reference number
    'Can change the filepath to whatever you need
    FileOpen(FF, "C:program nameconfig.txt", OpenMode.Output)

    PrintLine(FF, "AuthorName=" & AuthorName)
    PrintLine(FF, "GameName=" & GameName)
    PrintLine(FF, "WhosTheBaddest=" & WhosTheBaddest)

    FileClose(FF)

    End Sub
    [/code]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion