Results 1 to 5 of 5

Thread: [RESOLVED] Help With a Long Select Case : / (need to trim it down)

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    9

    [RESOLVED] Help With a Long Select Case : / (need to trim it down)

    I'm working on an online RPG and in one of my modules, I store code for the spellbar. This chunk of code controls the image that is displayed on the spellbar. The picture that is displayed depends on which spell is in which slot in their spell book. My problem is.. I have alot of spells in the game and 11 buttons on the spellbar. I have a huge select case block and its so long that the End Select doesn't recognize the Select Case (because they're so far away from each other...). I tried doing an array but the spellbar images were all the same. Here's a little bit of the code from this module:


    VB Code:
    1. For i = 1 To MAX_PLAYER_SPELLS
    2.             Player(MyIndex).Spell(i) = Val(Parse(i))
    3.             'If Player(MyIndex).Spell(i) <> 0 Then
    4.                 frmGame.lstSpells.AddItem i & ": " & Trim(Spell(Player(MyIndex).Spell(i)).name)
    5.                 Select Case Trim(Spell(Player(MyIndex).Spell(i)).name)
    6.                     Case "Fireball I"
    7.                         Select Case i
    8.                             Case 0: frmGame.lstSpells.AddItem "Empty spell slot."
    9.                             Case 1: frmGame.Picture11.Picture = frmGame.Fireball.Picture
    10.                             Case 2: frmGame.Picture13.Picture = frmGame.Fireball.Picture
    11.                             Case 3: frmGame.Picture15.Picture = frmGame.Fireball.Picture
    12.                             Case 4: frmGame.Picture16.Picture = frmGame.Fireball.Picture
    13.                             Case 5: frmGame.Picture17.Picture = frmGame.Fireball.Picture
    14.                             Case 6: frmGame.Picture18.Picture = frmGame.Fireball.Picture
    15.                             Case 7: frmGame.Picture19.Picture = frmGame.Fireball.Picture
    16.                             Case 8: frmGame.Picture20.Picture = frmGameFireball.Picture
    17.                             Case 9: frmGame.Picture21.Picture = frmGame.Fireball.Picture
    18.                             Case 10: frmGame.Picture22.Picture = frmGame.Fireball.Picture
    19.                             Case 11: frmGame.Picture23.Picture = frmGame.Fireball.Picture
    20.                         End Select
    21.                     Case "Raging Strike I"
    22.                         Select Case i
    23.                             Case 0: frmMirage.lstSpells.AddItem "Empty spell slot."
    24.                             Case 1: frmMirage.Picture11.Picture = frmGame.RagingStrike.Picture
    25.                             Case 2: frmGame.Picture13.Picture = frmGame.RagingStrike.Picture
    26.                             Case 3: frmGame.Picture15.Picture = frmGame.RagingStrike.Picture
    27.                             Case 4: frmGame.Picture16.Picture = frmGame.RagingStrike.Picture
    28.                             Case 5: frmGame.Picture17.Picture = frmGame.RagingStrike.Picture
    29.                             Case 6: frmGame.Picture18.Picture = frmGame.RagingStrike.Picture
    30.                             Case 7: frmGame.Picture19.Picture = frmGame.RagingStrike.Picture
    31.                             Case 8: frmGame.Picture20.Picture = frmGame.RagingStrike.Picture
    32.                             Case 9: frmGame.Picture21.Picture = frmGame.RagingStrike.Picture
    33.                             Case 10: frmGame.Picture22.Picture = frmGame.RagingStrike.Picture
    34.                             Case 11: frmGame.Picture23.Picture = frmGame.RagingStrike.Picture
    35.  
    36. ..................................................
    37.  
    38. ..................................................
    39.  
    40.                   End Select

    There's over 50 blocks like this..so you could see how the End Select after all this doesn't recognize the top. Someone help please.

    //Dulokz

    Note: Each number in the Case are the spellbar buttons (1-11 and 0 displays an empty button)
    Last edited by Dulokz; Apr 30th, 2006 at 04:55 PM.

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