Sorry I ask too many simple questions :D


Public Class Weapon
    Dim name As String
    Dim type As String
    Dim damage As Integer
    Dim speed As Double
    Dim durability As Integer
    Dim value As Integer

    Dim RustySword As Weapon
    'What kind of declaration must I make? Its an error and says "Declaration expected"    right before the rusty sword. = "Rusty Sword"
End Class

2. How do I make an editable database where I can just set properties for a new weapon, instead of setting them in the code? Kinda like a form where I can do File -> New Weapon -> Whats the name -> What type? etc etc
EDIT: found a tutorial for this... plan on using DataGridView and making a New(....) function.

Sorry I'm such a newbie at programming. I'm still in high school and making such a "complex" game (a text based rpg... what more can I say) already to start off. Its been a great learning experience, and I'm going to take AP CompScience next year, which is gonna be easy considering all the things I've learned

Would appreciate it :D

Edited 6 Years Ago by pasido: n/a

Your dim rustysword as new weapon done inside of the class is causing a circular reference... Think about it. That declaration would be done out side of the class to instantiate the class. Then you seem to be missing the public procedures (let/get) to assign and retrieve the values. Next up is the Dim type declaration as the word type is a keyword as is the word value and the word name.

Now this is an example of using a UDT (User Defined Type)...(as if it was declared in a form)

Option Explicit

Private Type Weapons
  WeaponName As String
  WeaponType As String
  WeaponDmg As Integer
  WeaponSpeed As Double
  WeaponDur As Integer
  WeaponVal As Integer
End Type

Dim Weapon() As Weapons

So now you would have an array of the type weapons that you can redimension just as you would a regular array.

No, I'm not suggesting you change your code to this, I'm just trying to make a point, which is going to be pretty much mute once I make my next one...

Time to use your friends (yahoo, google, ask, answers, bing) to search for VB6 ADO Tutorial. This information will allow you to access a database and retrieve a recordset that will also act like the type example above or your proposed class and depending upon how you design your database, you could pull up all of the weapons or just a subset of them for the character in question...

Good Luck

This article has been dead for over six months. Start a new discussion instead.