Results 1 to 3 of 3

Thread: [RESOLVED] Option butten Enabling for a game.

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2012
    Location
    Georgia, USA
    Posts
    44

    Resolved [RESOLVED] Option butten Enabling for a game.

    Ok i have a selection of classes you can chose from threw option buttens. But i am trying to make it so that the stats that the system randomly generates determines what class you can be and if the stat dosent match up then the class is disabled. The problem is that the code only works half the time. Can someone tell me what about my code isnt working? Or maybe a new code that might work.

    This is my code :

    Private Sub CheckStats()
    'Checks Int and dex for Mage"
    If Integer.Parse(lblInt.Text) >= 19 And Integer.Parse(lblDex.Text) >= 16 Then
    optMage.Enabled = True
    ElseIf Integer.Parse(lblInt.Text) <= 18 And Integer.Parse(lblDex.Text) <= 15 Then
    optMage.Enabled = False
    End If
    'Checks Str for Knight'
    If lblStr.Text >= Int(18) Then
    optKnight.Enabled = True
    ElseIf (lblStr.Text) <= Int(17) Then
    optKnight.Enabled = False
    End If
    'Checks Con for Knight'
    If lblCon.Text >= Int(18) Then
    optKnight.Enabled = True
    ElseIf lblCon.Text <= Int(17) Then
    optKnight.Enabled = False
    End If




    As you can see i have tryed it in 2 differnt ways but both ways give the same results.

    I have CheckStats() on my form_load and Roller_click that way it checks them as the form loads and the butten is pushed so that no one can cheat and get a class without having the stats. But as i said it only works half the time. Ty for your help. If you have any questions on it feel free to ask i might not have explained it well enough.

  2. #2
    Elite Hacker Jacob Roman's Avatar
    Join Date
    Aug 2004
    Location
    Miami Beach, FL
    Posts
    5,349

    Re: Option butten Enabling for a game.

    I did an experiment with your code and made some changes. Im assuming is VB.Net you are using:

    vb.net Code:
    1. Private Sub CheckStats()
    2.  
    3.     Dim Dexterity As Integer
    4.     Dim Intellect As Integer
    5.    
    6.     Dexterity = Integer.Parse(lblDex.Text)
    7.     Intellect = Integer.Parse(lblInt.Text)
    8.    
    9.     If Intellect >= 19 And Dexterity >= 16 Then
    10.         optMage.Enabled = True
    11.     Else
    12.         optMage.Enabled = False
    13.     End If
    14.    
    15. End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2012
    Location
    Georgia, USA
    Posts
    44

    Re: Option butten Enabling for a game.

    Awsom bro as always your code works perfectly! True programming master!

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