Mirage Engine
Visual Spells - Error - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Source Code Development (https://mirage-engine.uk/forums/forumdisplay.php?fid=51)
+----- Forum: Mirage Source 4 (Visual Basic 6) (https://mirage-engine.uk/forums/forumdisplay.php?fid=44)
+------ Forum: Bugs Reports (https://mirage-engine.uk/forums/forumdisplay.php?fid=9)
+------ Thread: Visual Spells - Error (/showthread.php?tid=2914)



Visual Spells - Error - AkselJ - 05-07-2009

Hey there,
Well basically, while making Visual Inventory (which now works) and Visual Spells (with icons) I encountered an error. The spells icon won't save so I always end up with the blank one...

What I did was remove the frame from the spell editor. I called the icon's variable "Frame" as it is easier to remember since scrlFrame already existed. Spell casting works, learning spells works but not getting the proper icons. So, if anyone could list up all the places I need to add stuff to make a new variable in spells so I can see if I am misssing some, please do so.

Thanks,
AkselJ


Re: Visual Spells - Error - Matt - 05-07-2009

Follow your save and edit spell packets.


Re: Visual Spells - Error - AkselJ - 05-07-2009

I tried that, but I couldn't find anything there...


Re: Visual Spells - Error - Matt - 05-07-2009

Is this the byte array packets version or the original method?

Either way, you have to send in the exact same order and when it comes to the byte array method, if you write a long, you have to read a long.


Re: Visual Spells - Error - AkselJ - 05-07-2009

I tried following the packets again, and noticed somplace i forgot to add the new variable. Now, though, the pictures won't load in the spells list, it only returns the spell as 0 loading the empty spell frame... Any ideas?


Re: Visual Spells - Error - Matt - 06-07-2009

Possibly not setting the scrlframe value to whatever the value you saved to the item, properly.


Re: Visual Spells - Error - AkselJ - 06-07-2009

Matt Wrote:Possibly not setting the scrlframe value to whatever the value you saved to the item, properly.

Whenever I save an spell, I can open it fine and it displays the correct picture.

Code:
' :::::::::::::::::::
' :: Spells packet ::
' :::::::::::::::::::
Private Sub HandleSpells(ByVal Index As Long, ByRef Data() As Byte, ByVal StartAddr As Long, ByVal ExtraVar As Long)
Dim i As Long
Dim j As Long
Dim n As Long
Dim k As Long
Dim Buffer As clsBuffer

    Set Buffer = New clsBuffer
    
    Buffer.WriteBytes Data()
    
    With frmSpells
        .Visible = True
                
        For i = 1 To MAX_PLAYER_SPELLS
           k = Buffer.ReadLong
           PlayerSpells(k) = Buffer.ReadLong
        Next
        
        ' Put spells known in player record
        For i = 1 To MAX_PLAYER_SPELLS
            If PlayerSpells(i)  0 Then
                .picSpell(Int(i - 1)).Picture = LoadPicture(App.Path & "\gfx\spells\icons\" & Trim$(Spell(i).Frame) & ".bmp")
            Else
                .picSpell(Int(i - 1)).Picture = Nothing
            End If
        Next
    End With
End Sub
Apparently, this line returns 0 as the frame...
Code:
.picSpell(Int(i - 1)).Picture = LoadPicture(App.Path & "\gfx\spells\icons\" & Trim$(Spell(i).Frame) & ".bmp")
And, obviously, this line from the Sub SpellEditorInit loads the picture the same way, and it works fine there...
Code:
.scrlFrame = Spell(EditorIndex).Frame
So I have no idea what's wrong.... Well I am a newb in working with MS though...


Re: Visual Spells - Error - Matt - 06-07-2009

Why are you subtracting 1 from i at the start of it, but not anywhere else? That makes no sense..


Re: Visual Spells - Error - AkselJ - 06-07-2009

It makes perfect sense as the index for the picSpell starts with 0 and spell indexes starts with 1

Edit: Figured out I was wrong, I was supposed to use Trim$(Spell(PlayerSpells(i)).Frame) and not Trim$(Spell(i).Frame).. Thanks, you got me on the tought Big Grin

Still suffering from the error though.... :S


Re: Visual Spells - Error - AkselJ - 19-07-2009

Bump


Re: Visual Spells - Error - AkselJ - 02-08-2009

Bump =(


Re: Visual Spells - Error - AkselJ - 09-09-2009

Bump

C'mon someone must know