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

Recommended Posts

  • Replies 255
  • Created
  • Last Reply

Top Posters In This Topic

```
Public Sub MySQL_SaveSpell(ByVal Index As Long)
Dim Query As String

    ' Write the Query.
    Query = "UPDATE data_spell SET name='" & Trim(Spell(Index).Name) _
            & "',descr='" & Trim(Spell(Index).Desc) _
            & "',sound='" & Trim(Spell(Index).Sound) _
            & "',type='" & STR$(Spell(Index).Type) _
            & "',mpcost='" & STR$(Spell(Index).mpCost) _
            & "',levelreq='" & STR$(Spell(Index).LevelReq) _
            & "',accessreq='" & STR$(Spell(Index).AccessReq) _
            & "',classreq='" & STR$(Spell(Index).ClassReq) _
            & "',casttime='" & STR$(Spell(Index).CastTime) _
            & "',cdtime='" & STR$(Spell(Index).CDTime) _
            & "',icon='" & STR$(Spell(Index).Icon) _
            & "',map='" & Trim(STR$(Spell(Index).Map)) _
            & "',x='" & STR$(Spell(Index).x) _
            & "',y='" & STR$(Spell(Index).y) _
            & "',dir='" & STR$(Spell(Index).Dir) _
            & "',vital='" & STR$(Spell(Index).Vital) _
            & "',duration='" & STR$(Spell(Index).Duration) _
            & "',inval='" & STR$(Spell(Index).Interval) _
            & "',rng='" & STR$(Spell(Index).Range) _
            & "',isaoe='" & Trim(STR$(Spell(Index).IsAoE)) _
            & "',aoe='" & STR$(Spell(Index).AoE) _
            & "',castanim='" & STR$(Spell(Index).CastAnim) _
            & "',spellanim='" & STR$(Spell(Index).SpellAnim) _
            & "',stunduration='" & STR$(Spell(Index).StunDuration)

            ' Too many line breaks.. again, continuation!
    Query = Query & "',uniqueindex='" & STR$(Spell(Index).UniqueIndex) _
            & "',nextrank='" & STR$(Spell(Index).NextRank) _
            & "',nextuses='" & STR$(Spell(Index).NextUses) _
            & "' WHERE id='" & STR$(Index) & "'"

    Call PutVar(App.Path & "\query.ini", "SQL", "Q", Query)

    ' Send the Query.
    Set DataSet = New Recordset
    DataSet.Open Query, MySQL

    ' Close the reader.
    Set DataSet = Nothing
End Sub
```
Got to love copy/pastaing subs and modifying them to work with the data you're going to save.
Link to post
Share on other sites
The idea is that you post the last thing you copied from anywhere, and leave a post.. Not that Ctrl+V is supposed to magically make your computer float or anything ;]

```
Sub HandleMapGetItem(ByVal index As Long, ByRef Data() As Byte, ByVal StartAddR As Long, ByVal ExtraVar As Long)
    Dim b As Long

    If Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).Type = TILE_TYPE_CHEST Then
        If Val(GetVar("data\chests\" & Trim(GetPlayerName(index)) & ".ini", "Chests_Map_" & Trim(STR(GetPlayerMap(index))), Trim(STR(GetPlayerX(index))) & "_" & Trim(STR(GetPlayerY(index))))) = 0 Then
            b = FindOpenInvSlot(index, Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data1)
            Call PlayerMsg(index, "You opened the chest and found " & Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data2 & " " & Item(Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data1).Name, White)
            Call SetPlayerInvItemNum(index, b, Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerY(index)).data1)
            Call SetPlayerInvItemValue(index, b, Map(GetPlayerMap(index)).Tile(GetPlayerX(index), GetPlayerInvItemValue(index, b) + GetPlayerY(index)).data2)
            Call PutVar("data\chests\" & Trim(GetPlayerName(index)) & ".ini", "Chests_Map_" & Trim(STR(GetPlayerMap(index))), Trim(STR(GetPlayerX(index))) & "_" & Trim(STR(GetPlayerY(index))), "1")
            Call SendInventoryUpdate(index, b)
        Else
            Call PlayerMsg(index, "You have already looted this chest!", BrightRed)
        End If
    Else
        Call PlayerMapGetItem(index)
    End If
End Sub
```
Link to post
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

×
×
  • Create New...