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

New Editor


DeathKnight
 Share

Recommended Posts

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
errorhandler:
HandleError "SendSaveSpell", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
Err.Clear
End Sub

```
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

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).
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...