Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding an Action Bar to Your Game!


zade_o
 Share

Recommended Posts

![](http://www.worldofwarcraftstuff.com/images/guides/druid/bear_form_button_thumb.jpg)
The thing in the bottom left of the image is the action bar. In case you don't know what an action bar is.

I want to warn you, this is going to get a little confusing if you're not used to source, and or not used to conforming code to fit your source…........

NOTE: THE TUTORIAL SPANS OVER 2 POSTS

First thing's first...

-Add 10 labels to your frmMirage, and make them indexed, and make them all invisible
To perfectly match this code, the labels should be:
Label14(1) through Label14(10)

-Add 10 Images to your frmMirage, do not make them indexed and align them to make an action bar
To perfectly match this code, use these 10 images...
Image7, Image8, Image9, Image10, Image11, Image12, Image13, Image14, Image15, Image5

-Also, note that to use the numbers as well as left click you need to use the code to make it so you have to press enter before you can type in chat.

Now go to frmMirage, go to the very top, right under Option Explicit and paste this code
```
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
```
Second, let's take care of the packets we're gonna use…

Go to ModHandleData in the client and add this code somewhere in sub HandleData
```
  If casestring = "getspell1" Then
        Dim s
        s = parse(1)
        frmMirage.Label14(1).Caption = s
        If s <> "" Then
            frmMirage.Image7.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If

    End If

    If casestring = "getspell2" Then

        s = parse(1)
        frmMirage.Label14(2).Caption = s
        If s <> "" Then
            frmMirage.Image8.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell3" Then

        s = parse(1)
        frmMirage.Label14(3).Caption = s
        If s <> "" Then
            frmMirage.Image9.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell4" Then

        s = parse(1)
        frmMirage.Label14(4).Caption = s
        If s <> "" Then
            frmMirage.Image10.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell5" Then

        s = parse(1)
        frmMirage.Label14(5).Caption = s
        If s <> "" Then
            frmMirage.Image11.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell6" Then

        s = parse(1)
        frmMirage.Label14(6).Caption = s
        If s <> "" Then
            frmMirage.Image12.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell7" Then

        s = parse(1)
        frmMirage.Label14(7).Caption = s
        If s <> "" Then
            frmMirage.Image13.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell8" Then

        s = parse(1)
        frmMirage.Label14(8).Caption = s
        If s <> "" Then
            frmMirage.Image14.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell9" Then

        s = parse(1)
        frmMirage.Label14(9).Caption = s
        If s <> "" Then
            frmMirage.Image15.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
    If casestring = "getspell10" Then

        s = parse(1)
        frmMirage.Label14(10).Caption = s
        If s <> "" Then
            frmMirage.Image5.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & s & ".gif")
        End If
    End If
```

Now, go to modHandleData in the server, under sub HandleData add this code
```
  Case "setspell1"
            Call WriteINI("SK1", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell1"
            FileData = ReadINI("SK1", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell1" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub

        Case "setspell2"
            Call WriteINI("SK2", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell2"
            FileData = ReadINI("SK2", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell2" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub

        Case "setspell3"
            Call WriteINI("SK3", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell3"
            FileData = ReadINI("SK3", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell3" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell4"
            Call WriteINI("SK4", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell4"
            FileData = ReadINI("SK4", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell4" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell5"
            Call WriteINI("SK5", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell5"
            FileData = ReadINI("SK5", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell5" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell6"
            Call WriteINI("SK6", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell6"
            FileData = ReadINI("SK6", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell6" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell7"
            Call WriteINI("SK7", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell7"
            FileData = ReadINI("SK7", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell7" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell8"
            Call WriteINI("SK8", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell8"
            FileData = ReadINI("SK8", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell8" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell9"
            Call WriteINI("SK9", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell5"
            FileData = ReadINI("SK5", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell9" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
        Case "setspell10"
            Call WriteINI("SK10", "sid", Parse(1), App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini")
            Exit Sub

        Case "loadspell10"
            FileData = ReadINI("SK10", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
            Call SendDataTo(Index, "getspell10" & SEP_CHAR & FileData & END_CHAR)
            Exit Sub
```

PACKETS FINISHED

Now, find modGameLogic in the server, inside the sub JoinGame put this code
```
    Dim FileData As String
    FileData = ReadINI("SK1", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell1" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK2", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell2" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK3", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell3" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK4", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell4" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK5", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell5" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK6", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell6" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK7", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell7" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK8", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell8" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK9", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell9" & SEP_CHAR & FileData & END_CHAR)
    FileData = ReadINI("SK10", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
    Call SendDataTo(Index, "getspell10" & SEP_CHAR & FileData & END_CHAR)
```
This is the code that updates your icons as soon as you log in.

Now, on the client side, go to frmMirage and double click on lstSpells. Change that ENTIRE sub to this:
```
Private Sub lstSpells_DblClick()
    Dim O, r, p, Q As String
    Dim i
    Dim X
    Dim exists As Boolean

    O = lstSpells.Text
    r = Right(O, Len(O) - 3)
    If (StrComp(Left(O, 1), "-") <> 0) Then

        If (Image7.Picture = Image16.Picture) Then
            Image7.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell1" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image8.Picture = Image16.Picture) Then
            Image8.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell2" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image9.Picture = Image16.Picture) Then
            Image9.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell3" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image10.Picture = Image16.Picture) Then
            Image10.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell4" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image11.Picture = Image16.Picture) Then
            Image11.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell5" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image12.Picture = Image16.Picture) Then
            Image12.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell6" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image13.Picture = Image16.Picture) Then
            Image13.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell7" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image14.Picture = Image16.Picture) Then
            Image14.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell8" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image15.Picture = Image16.Picture) Then
            Image15.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell9" & SEP_CHAR & r & END_CHAR)
        ElseIf (Image5.Picture = Image16.Picture) Then
            Image5.Picture = LoadPicture(App.Path & "\GUI\SpellIcons\" & r & ".gif")
            Call SendData("setspell10" & SEP_CHAR & r & END_CHAR)

        Else
            Call AddText("All of your spell slots are full.", WHITE)
        End If

    End If

End Sub

```
Add this code inside of frmMirage to allow left clicking on the spells
```
Private Sub Image5_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(10).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image5.Picture = Image16.Picture
        Call SendData("setspell10" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image5.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image7_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(1).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image7.Picture = Image16.Picture
        Call SendData("setspell1" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image7.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image8_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(2).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image8.Picture = Image16.Picture
        Call SendData("setspell2" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image8.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image9_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(3).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image9.Picture = Image16.Picture
        Call SendData("setspell3" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image9.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image10_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(4).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image10.Picture = Image16.Picture
        Call SendData("setspell4" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image10.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image11_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(5).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image11.Picture = Image16.Picture
        Call SendData("setspell5" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image11.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image12_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(6).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image12.Picture = Image16.Picture
        Call SendData("setspell6" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image12.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image13_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(7).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image13.Picture = Image16.Picture
        Call SendData("setspell7" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image13.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image14_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(8).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image14.Picture = Image16.Picture
        Call SendData("setspell8" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image14.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

Private Sub Image15_Click()
    Dim ssp As String
    Dim i
    Dim j
    ssp = Label14(9).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image15.Picture = Image16.Picture
        Call SendData("setspell9" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image15.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
End Sub

```
Again, in the client, go to frmMirage and find sub form_keyUp and add these at the bottom
```
If KeyCode = vbKey0 And frmMirage.txtMyTextBox.visible=false Then
        Dim ssp As String

    Dim j
    ssp = Label14(10).Caption
    i = 0
    j = 0
    Dim p As String
    Dim r As String

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image5.Picture = Image16.Picture
        Call SendData("setspell10" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image5.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If

    If KeyCode = vbKey1 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(1).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image7.Picture = Image16.Picture
        Call SendData("setspell1" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image7.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If

    If KeyCode = vbKey2 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(2).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image8.Picture = Image16.Picture
        Call SendData("setspell2" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image8.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If

    If KeyCode = vbKey3 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(3).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image9.Picture = Image16.Picture
        Call SendData("setspell3" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image9.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If

    End If
    If KeyCode = vbKey4 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(4).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image10.Picture = Image16.Picture
        Call SendData("setspell4" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image10.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If
    If KeyCode = vbKey5 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(5).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image11.Picture = Image16.Picture
        Call SendData("setspell5" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image11.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If

```
Link to comment
Share on other sites

  • Replies 154
  • Created
  • Last Reply

Top Posters In This Topic

```
If KeyCode = vbKey6 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(6).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image12.Picture = Image16.Picture
        Call SendData("setspell6" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image12.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If
    If KeyCode = vbKey7 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(7).Caption
    i = 0
    j = 0

    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image13.Picture = Image16.Picture
        Call SendData("setspell7" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image13.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If
    If KeyCode = vbKey8 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(8).Caption
    i = 0
    j = 0
    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image14.Picture = Image16.Picture
        Call SendData("setspell8" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image14.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If
    If KeyCode = vbKey9 And frmMirage.txtMyTextBox.visible=false Then

    ssp = Label14(9).Caption
    i = 0
    j = 0
    While i < lstSpells.ListCount
        p = lstSpells.List(i)
        r = Right(p, Len(p) - 3)
        If StrComp(r, ssp) = 0 Then
            j = i
        End If
        i = i + 1
    Wend
    If GetAsyncKeyState(2) <> 0 Then
        Image15.Picture = Image16.Picture
        Call SendData("setspell9" & SEP_CHAR & Null & END_CHAR)
    Else
        If Image15.Picture <> Image16.Picture Then
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            SpellMemorized = Val#(lstSpells.List(j))
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
            If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
            If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
                        Call SendData("cast" & SEP_CHAR & SpellMemorized & END_CHAR)
                        Player(MyIndex).Attacking = 1
                        Player(MyIndex).AttackTimer = GetTickCount
                        Player(MyIndex).CastedSpell = YES
                End If
            Else
                Call AddText("No spell in this slot.", BRIGHTRED)
            End If
        End If
    End If
    End If
```-======================================================
Nowww! Here's an explanation on how you make spells work with this.

Make this directory from your client folder

Client\GUI\SpellIcons\

Save files in there. All files must be .gif to work with this script ( you can change that if you want)

But take a simple fire spell as an exmaple.

Make a spell using the /Editspell command

Name the spell  FireBlast

Now, save the icon as  Client\GUI\SpellIcons\FireBlast.gif

Aaannnnndddd I think that's all there is to it. I'll try to provide support if anyone has issues. Feel free to make improvements but i swear to god if you use this and don't credit I will hunt you down and kill you. Other than that…have fun and good luck.
Link to comment
Share on other sites

@Gh0st:

> List of Known Bugs that I'll fix tomorrow :
> - Clicking on a spell in your spell book that has no spell there causes a crash
> - typing a number when talking in chat attempts to cast a spell

nice job, i have edited the code for my liking if that is alright with you, still crediting you for the main code.  also it is much easier to use the F's instead of numbers, just a thought though, thats what i am doing.  Havent got to test it yet, just making some adjustments still.

ill let you know how it turns out
Warconn
Link to comment
Share on other sites

Image16 is just an empty picture. Sorry about that. For some reason it wouldn't work when i checked to see if the slots' images were = to null, so I just threw in a picture but never gave it a picture.

Then when it checks to see if say.. Image7.picture = Image16.picture

they will be equal if there is no spell in Image7

Does that make sense?
Link to comment
Share on other sites

yea, thats what i figured you ment lol, i still cant test as i am having major problems with my spell form, i get a 380 error everytime i try and open it, i can give you specifics when i get back to my original computer.

It just stopped working when i implemented your snippet, so i thought i would post here :)

Thanks
Link to comment
Share on other sites

Your spells stopped working when you put in this code?…

EDIT- I did just realize that I left part of the code out, I don't know why this would affect your spells though but it's worth a try.
If you go back up to the first post, the first snippet of code that I tell you to put under Option explicit, I forgot to add that the first time so I just put it in now. I guess try that out?
Link to comment
Share on other sites

@Gh0st:

> Your spells stopped working when you put in this code?…
>
> EDIT- I did just realize that I left part of the code out, I don't know why this would affect your spells though but it's worth a try.
> If you go back up to the first post, the first snippet of code that I tell you to put under Option explicit, I forgot to add that the first time so I just put it in now. I guess try that out?

yea, im back on my base comp now, and i added what you said, but it still didnt make any difference.

i am getting RTE 380 on this like of code

    frmSpellEditor.scrlSpellTime.Value = Spell(EditorIndex).SpellTime

it says Invaliad Property Value

What does that mean. i got rid of all of my spells, and put in blanks in there place, but it still didnt fix it?
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share


×
×
  • Create New...