home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- BorderStyle = 1 'Fixed Single
- Caption = "Simple Character Editor"
- ClientHeight = 6330
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 6660
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 422
- ScaleMode = 3 'Pixel
- ScaleWidth = 444
- StartUpPosition = 3 'Windows Default
- Begin VB.TextBox txtLevel
- Height = 375
- Left = 5280
- TabIndex = 8
- Top = 1800
- Width = 1095
- End
- Begin VB.TextBox txtExp
- Height = 375
- Left = 5280
- TabIndex = 7
- Top = 1320
- Width = 1095
- End
- Begin VB.TextBox txtSta
- Height = 375
- Left = 1920
- TabIndex = 6
- Top = 3240
- Width = 1095
- End
- Begin VB.CommandButton Command1
- Caption = "RESET"
- Height = 495
- Left = 240
- TabIndex = 18
- Top = 5280
- Width = 1215
- End
- Begin VB.TextBox txtFilename
- Height = 405
- Left = 1920
- TabIndex = 16
- Top = 4440
- Width = 3495
- End
- Begin VB.ComboBox cboClass
- Height = 315
- ItemData = "Form1.frx":0000
- Left = 1920
- List = "Form1.frx":0013
- TabIndex = 1
- Text = "Combo1"
- Top = 720
- Width = 2415
- End
- Begin VB.TextBox txtCha
- Height = 375
- Left = 1920
- TabIndex = 5
- Top = 2760
- Width = 1095
- End
- Begin VB.TextBox txtInt
- Height = 375
- Left = 1920
- TabIndex = 4
- Top = 2280
- Width = 1095
- End
- Begin VB.TextBox txtDex
- Height = 375
- Left = 1920
- TabIndex = 3
- Top = 1800
- Width = 1095
- End
- Begin VB.TextBox txtStr
- Height = 375
- Left = 1920
- TabIndex = 2
- Top = 1320
- Width = 1095
- End
- Begin VB.CommandButton cmdSave
- Caption = "SAVE"
- Height = 495
- Left = 4920
- TabIndex = 22
- Top = 5280
- Width = 1215
- End
- Begin VB.CommandButton cmdLoad
- Caption = "LOAD"
- Height = 495
- Left = 3240
- TabIndex = 21
- Top = 5280
- Width = 1215
- End
- Begin VB.TextBox txtName
- Height = 375
- Left = 1920
- TabIndex = 0
- Top = 240
- Width = 3495
- End
- Begin VB.Label Label10
- Caption = "LEVEL:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 3480
- TabIndex = 20
- Top = 1800
- Width = 1215
- End
- Begin VB.Label Label9
- Caption = "EXPERIENCE:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 3480
- TabIndex = 19
- Top = 1320
- Width = 1455
- End
- Begin VB.Label Label8
- Caption = "FILENAME:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 17
- Top = 4440
- Width = 1215
- End
- Begin VB.Label Label7
- Caption = "CLASS:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 15
- Top = 840
- Width = 1215
- End
- Begin VB.Label Label6
- Caption = "STAMINA:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 14
- Top = 3240
- Width = 1215
- End
- Begin VB.Label Label5
- Caption = "CHARISMA:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 13
- Top = 2760
- Width = 1215
- End
- Begin VB.Label Label4
- Caption = "INTELLECT:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 12
- Top = 2280
- Width = 1215
- End
- Begin VB.Label Label3
- Caption = "DEXTERITY:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 11
- Top = 1800
- Width = 1215
- End
- Begin VB.Label Label2
- Caption = "STRENGTH:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 10
- Top = 1320
- Width = 1215
- End
- Begin VB.Label Label1
- Caption = "NAME:"
- BeginProperty Font
- Name = "Arial"
- Size = 9.75
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 255
- Left = 240
- TabIndex = 9
- Top = 240
- Width = 1215
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- '---------------------------------------------------------------
- ' Visual Basic Game Programming for Teens
- ' Character Editor Program
- '---------------------------------------------------------------
- Option Explicit
- Option Base 0
- Private Type TCHARACTER
- name As String * 20
- classtype As String * 20
- experience As Integer
- level As Integer
- strength As Integer
- dexterity As Integer
- intellect As Integer
- charisma As Integer
- stamina As Integer
- fillerstr As String * 80
- fillerint(10) As Integer
- End Type
- Dim Player As TCHARACTER
- Private Sub cmdLoad_Click()
- Player = LoadCharacterBinaryFile(txtFilename.Text)
- With Player
- txtName.Text = Trim(.name)
- cboClass.Text = Trim(.classtype)
- txtStr.Text = Trim(.strength)
- txtDex.Text = .dexterity
- txtInt.Text = .intellect
- txtCha.Text = .charisma
- txtSta.Text = .stamina
- txtExp.Text = .experience
- txtLevel.Text = .level
- End With
- End Sub
- Private Sub Command1_Click()
- txtName.Text = ""
- cboClass.ListIndex = -1
- txtStr.Text = ""
- txtDex.Text = ""
- txtInt.Text = ""
- txtCha.Text = ""
- txtSta.Text = ""
- txtExp.Text = ""
- txtLevel.Text = ""
- End Sub
- Private Sub cmdSave_Click()
- Player.name = txtName.Text
- Player.classtype = cboClass.Text
- If IsNumeric(txtStr.Text) Then
- Player.strength = CInt(txtStr.Text)
- Else
- MsgBox "Strength must be numeric"
- Exit Sub
- End If
- If IsNumeric(txtDex.Text) Then
- Player.dexterity = CInt(txtDex.Text)
- Else
- MsgBox "Dexterity must be numeric"
- Exit Sub
- End If
- If IsNumeric(txtInt.Text) Then
- Player.intellect = CInt(txtInt.Text)
- Else
- MsgBox "Intellect must be numeric"
- Exit Sub
- End If
- If IsNumeric(txtCha.Text) Then
- Player.charisma = CInt(txtCha.Text)
- Else
- MsgBox "Charisma must be numeric"
- Exit Sub
- End If
- If IsNumeric(txtSta.Text) Then
- Player.stamina = CInt(txtSta.Text)
- Else
- MsgBox "Stamina must be numeric"
- Exit Sub
- End If
- If IsNumeric(txtExp.Text) Then
- Player.experience = CInt(txtExp.Text)
- Else
- MsgBox "Experience must be numeric"
- Exit Sub
- End If
- If IsNumeric(txtLevel.Text) Then
- Player.level = CInt(txtLevel.Text)
- Else
- MsgBox "Level must be numeric"
- Exit Sub
- End If
- SaveCharacterBinaryFile txtFilename.Text, Player
- End Sub
- Private Function LoadCharacterBinaryFile(ByVal filename As String) As TCHARACTER
- On Error GoTo error1
- Dim filenum As Integer
- Dim dude As TCHARACTER
- filenum = FreeFile()
- Open filename For Binary As filenum Len = Len(dude)
- Get filenum, , dude
- Close filenum
- LoadCharacterBinaryFile = dude
- Exit Function
- error1:
- MsgBox Err.Description
- End Function
- Private Function SaveCharacterBinaryFile(ByVal filename As String, ByRef dude As TCHARACTER)
- On Error GoTo error1
- Dim filenum As Integer
- filenum = FreeFile()
- Open filename For Binary As filenum Len = Len(dude)
- Put filenum, , dude
- Close filenum
- Exit Function
- error1:
- MsgBox Err.Description
- End Function
-