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

Dude don't blame the fact that you don't know how to implement it right on my code. I've had it work perfectly twice and warconns done it and others. It works fine, except for yes the casting the spells when you're chatting but that's easy to fix as warconn already showed and I just haven't had time to put up the fix. Don't blame my code for your incompetence.
Link to comment
Share on other sites

  • Replies 154
  • Created
  • Last Reply

Top Posters In This Topic

Well you were saying that you don't wanna use my code because it has "apparent bugs" and getting defensive with me because I was telling you how to deal with the multiple declarations. I'm not getting defensive just saying that if it doesn't work for you then don't blame the code because it's obviously working fine.
Link to comment
Share on other sites

Ghost… I run into a problem. It's when I memorize a spell, and the i memorize a different one, then both spells are the same as the first one. eg. I memorize Double Shot for my Archer in Lostica, then the second spell i memorize would be Archer Buff, then when i try to use archer buff, it does the same thing as Double shot.
Link to comment
Share on other sites

Well it is in fact an error on my part. Working on it.
EDIT- My bad. Actually not my error, I just forgot to make the 2nd spell scripted which is why nothing happened lol >.<

Anyways, I guess if you used sadscript for this somehow that that would be the error because I don't use sadscript at all in this edit except for my scripted spells
Link to comment
Share on other sites

@Gh0st:

> Well it is in fact an error on my part. Working on it.
> EDIT- My bad. Actually not my error, I just forgot to make the 2nd spell scripted which is why nothing happened lol >.<
>
> Anyways, I guess if you used sadscript for this somehow that that would be the error because I don't use sadscript at all in this edit except for my scripted spells

Lol, damn because all my spells are scripted. Any way of fixin this?
Link to comment
Share on other sites

I mean. I think you must've slipped up somewhere in source. All of my spells are scripted two.

In scripted spells, i have 2 cases (as of now)

case 1 and case 0\. Zero is Poison Axe and one is Dragon Spirit. When I press 0 it does poison axe animation and when i press 1 it does dragon spirit. Soooo I'm not sure where you went wrong. Maybe you copied the same sub for key 0 into the spot for key 1?
Link to comment
Share on other sites

@Gh0st:

> I mean. I think you must've slipped up somewhere in source. All of my spells are scripted two.
>
> In scripted spells, i have 2 cases (as of now)
>
> case 1 and case 0\. Zero is Poison Axe and one is Dragon Spirit. When I press 0 it does poison axe animation and when i press 1 it does dragon spirit. Soooo I'm not sure where you went wrong. Maybe you copied the same sub for key 0 into the spot for key 1?

ill try reinstalling your source edit, thanks for the help btw.

::EDIT::\
I fixed it, all I did was reinstall the section that specifies the packets sent when pressing vbkey1 ~ vbkey0
Link to comment
Share on other sites

Hey

when i try to loginto the game i get a compile error variable not defined on the server side and it takes me to
```
FileData = ReadINI("SK1", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)
```

and it highlights FileData can you please tell me what am i doing wrong.

Thank you
Link to comment
Share on other sites

You're not doing anything wrong, just means that I had FileData declared in a previous serverside packet.

All you have to do is make it into this
```
Dim FileData as String
FileData = ReadINI("SK1", "sid", App.Path & "\Scripts\db\" & GetPlayerName(Index) & ".ini", vbNullString)

```
And I believe that will work
Link to comment
Share on other sites

did you change Private Sub lstSpells_DblClick() in frmMirage 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
```
Link to comment
Share on other sites

Yea i did but I found the problem  :) I just made a small careless mistake. Everything works great now. Except my spells are messed up for some reason  :sad: only the the spells with area effect work. 

Edit going to try that spell fix tutorial now

Edit I fixed everything. Everything runs smoothly :) Thanks a lot
Link to comment
Share on other sites

Hey me again  :cheesy: I have a small problem. Everything works great but when i place the spells in the action bar and i exit the game, and log back on it doesn't load the spells back into the action bar, I have to put the in again.
Link to comment
Share on other sites

> Now, find modGameLogic in the server, inside the sub JoinGame put this code
> Code: [Select]
>     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.

you must've missed that.
Link to comment
Share on other sites

Sorry i didn't reply sooner.

I did add that code i placed it in there like this.
```
Public Sub JoinGame(ByVal Index As Long)
    Dim MOTD As String
    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)
    ' Set the flag so we know the person is in the game
    Player(Index).InGame = True

    ' Send an ok to client to start receiving in game data
    Call SendDataTo(Index, "loginok" & SEP_CHAR & Index & END_CHAR)

    ReDim Player(Index).Party.Member(1 To MAX_PARTY_MEMBERS)

    Call CheckEquippedItems(Index)
    Call SendClasses(Index)
    Call SendItems(Index)
    Call SendEmoticons(Index)
    Call SendElements(Index)
    Call SendArrows(Index)
    Call SendNpcs(Index)
    Call SendShops(Index)
    Call SendSpells(Index)
    Call SendInventory(Index)
    Call SendBank(Index)
    Call SendHP(Index)
    Call SendMP(Index)
    Call SendSP(Index)
    Call SendPTS(Index)
    Call SendStats(Index)
    Call SendWeatherTo(Index)
    Call SendTimeTo(Index)
    Call SendGameClockTo(Index)
    Call DisabledTimeTo(Index)
    Call SendSprite(Index, Index)
    Call SendPlayerSpells(Index)
    Call SendOnlineList

    ' Warp the player to his saved location
    Call PlayerWarp(Index, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))

    If SCRIPTING = 1 Then
        MyScript.ExecuteStatement "Scripts\Main.txt", "JoinGame " & Index
    Else
        ' Send a global message that he/she joined.
        If GetPlayerAccess(Index) = 0 Then
            Call GlobalMsg(GetPlayerName(Index) & " has joined " & GAME_NAME & "!", 7)
        Else
            Call GlobalMsg(GetPlayerName(Index) & " has joined " & GAME_NAME & "!", 15)
        End If

        Call PlayerMsg(Index, "Welcome to " & GAME_NAME & "!", 15)

        ' Send the player the welcome message.
        MOTD = Trim$(GetVar(App.Path & "\MOTD.ini", "MOTD", "Msg"))
        If LenB(MOTD) <> 0 Then
            Call PlayerMsg(Index, "MOTD: " & MOTD, 11)
        End If

        ' Update all clients with the player.
        Call SendWhosOnline(Index)
    End If

    ' Tell the client the player is in-game.
    Call SendDataTo(Index, "ingame" & END_CHAR)

    ' Update the server console.
    Call ShowPLR(Index)
End Sub
```
I also made the db folder inside my Scripts folder and it dose save the (playername).ini file in there And inside the .ini it has

[SK1]
sid=Cure
[SK2]
sid=Cure
because i put the spell only in the first two.

I don't get any errors everything works great except that.

Also for the little problem that you have with when you type the number in the chat box, and it attempts to cast a spell you might want to look here.

I had this similar problem with something else. :) Tyr made me a similar code
http://www.touchofdeathforums.com/smf/index.php?topic=32816.msg299226#msg299226
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...