Results 1 to 4 of 4

Thread: object enabled

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    216

    object enabled

    For my game you will have to buy items but i cant figure out how to make it be like - You dont have a 'gun' or You have put on the Gun.

    But even when i do this /wear rocket, it works when i havnt even bought the item.

    so my question is, how can i get it so that the p rogram knows that i have one thing, and not the other item?

    VB Code:
    1. Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
    2.         If TextBox1.Text = "" And (Asc(e.KeyChar)) = 13 Then
    3.             MsgBox("Need to type something")
    4.         ElseIf TextBox1.Text = "/buy gun" Then
    5.             chatwin.Text = chatwin.Text & vbCrLf & "You have bought a Paintball gun for $150"
    6.             TextBox1.Clear()
    7.         ElseIf TextBox1.Text = "/buy tube" Then
    8.             chatwin.Text = chatwin.Text & vbCrLf & "You have bought a tube of paintballs for $30"
    9.             TextBox1.Clear()
    10.         ElseIf TextBox1.Text = "/wear gun" Then
    11.             chatwin.Text = chatwin.Text & vbCrLf & "You have put on" & gun
    12.             TextBox1.Clear()
    13.  
    14.         ElseIf (Asc(e.KeyChar)) = 13 Then
    15.  
    16.             chatwin.Text = chatwin.Text & vbCrLf & (UserName) & ":" & " " & TextBox1.Text
    17.             TextBox1.Clear()
    18.         End If
    19.     End Sub

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    You should use a collection for the items that are available and another one for items that you have. Then before using an item you should see if it is in the collection of items you have.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    216
    so should i have like a list inventory and make it like
    If ' ' ' = /buy gun then
    linventory.items.add"gun"

    or something like that right?

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Nov 2002
    Posts
    216
    Also how can i make it so that if the item is not in the listbox(inventory) it will say "its not there" in other words how can i make the program check to see if there is an item on the person.?

    Thanks

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