New Editor

I’m looking for some help implementing a new editor into an engine (using Eclipse Worlds 1.1.7, but that should matter).

Essentially what I’m doing is trying to copy the spell editor to make a talent editor (once I get the editor working, I’ll adjust the system).  My problem is it crashes when it saves, so I’m just wondering if someone can explain where exactly something in the spell system is being pulled from.

This is the particular sub in question.  What happens is when I run my talent editor, it pops up with the basic editor (only have name, icon and a lstIndex on the form right now) .  When I make the edit and save, the client closes down, no error, just exits.  In the staff log’s it shows that a talent was edited, though when I load it doesn’t show any information on the talent screen (though that could just be my loading isn’t correct).  Can someone explain to me where the information for this line comes from exactly?

buffer.WriteBytes SpellData

Public Sub SendSaveSpell(ByVal SpellNum As Long)
    Dim buffer As clsBuffer
    Dim SpellSize As Long
    Dim SpellData() As Byte

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set buffer = New clsBuffer
    SpellSize = LenB(Spell(SpellNum))
    ReDim SpellData(SpellSize - 1)
    CopyMemory SpellData(0), ByVal VarPtr(Spell(SpellNum)), SpellSize
    buffer.WriteLong CSaveSpell
    buffer.WriteLong SpellNum
    buffer.WriteBytes SpellData
    SendData buffer.ToArray()

    Set buffer = Nothing
    Exit Sub

' Error handler
    HandleError "SendSaveSpell", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
End Sub

The error might be taking place but not being raised. Go to the error log and check if there are any new entries. To make it easier in the future change Options -> Debug to 0.

The value of SpellData is set by using an API call. This line in the given method does it.

CopyMemory SpellData(0), ByVal VarPtr(Spell(SpellNum)), SpellSize

What is done is that SpellData is first declared and it’s size/dimension is set which is equal to the number of bytes in the spellrec.

This “buffer” is given to the copymemory directly as the first parameter. As the second parameter the pointer of the the spell rec is passed and then finally the size of the rec is passed.

What copymemory does is it takes this “buffer” and starts setting the data from the spell rec starting from the first variable sequentially downwards on to the buffer. The amount of data copied it the SpellSize.

This byte buffer is then added into the packet buffer.

Thanks, this really helped me understand it a bit better.  Didn’t help me get it fixed, I’m thinking of using a different engine, and I was able to start over and do a more complete copy and get done what needed to be done.  (for the most part).  At least it’s working like it should (I focused more on copying the system and less on ripping out what it doesn’t need.  I’ll work on that soon).

If you need any more help then don’t hesitate to ask.

Thanks.  I’ll probably come to you when the system is done for some debugging (currently one thing I can’t figure out how to do, but it shouldn’t be too difficult), but I know once I hit the 2nd half of it then it will be way more difficult for me.

Volvex I am not here often if you need me Find me on skype or send a messege to this profile and wait for a response i can help you personally get it working.

Skype: [email protected]

Log in to reply