Mirage Source
Small Issue with Spells - Printable Version

+- Mirage Source (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)
+----- Thread: Small Issue with Spells (/showthread.php?tid=2647)



Small Issue with Spells - Jared - 24-03-2009

Well for some odd reason when i go into the /editspell menu and choose "say number 4" it crashes.
now in VB6 it did the same but took me to the code

Code:
frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlFrame.Value).SurfDescription.lWidth \ SIZE_X) - 1

im not exactly sure what to do, any help would be much appreciated. Smile


Re: Small Issue with Spells - Matt - 24-03-2009

Jared Wrote:Well for some odd reason when i go into the /editspell menu and choose "say number 4" it crashes.
now in VB6 it did the same but took me to the code

Code:
frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlFrame.Value).SurfDescription.lWidth \ SIZE_X) - 1

im not exactly sure what to do, any help would be much appreciated. Smile

The exact error code would help a lot.


Re: Small Issue with Spells - Jared - 24-03-2009

Code:
"Runtime error 9  -   Subscript 9 out of range
thats the general error i get when trying to edit a spell or make a new one.

That is the exact error code... was the only thing i got..


Re: Small Issue with Spells - Matt - 24-03-2009

This is my sub:

Code:
Public Sub SpellEditorBltSpell()
Dim SpellNum As Long
Dim sRECT As DxVBLib.RECT
Dim dRECT As DxVBLib.RECT

    SpellNum = frmSpellEditor.scrlPic.Value

    If SpellNum < 1 Or SpellNum > NumSpells Then
        frmSpellEditor.picPic.Cls
        Exit Sub
    End If
    
    SpellTimer(SpellNum) = GetTickCount + SurfaceTimerMax

    If DDS_Spell(SpellNum) Is Nothing Then
        Call InitDDSurf("spells\" & SpellNum, DDSD_Spell(SpellNum), DDS_Spell(SpellNum))
    End If
    
    frmSpellEditor.scrlFrame.Max = (DDSD_Spell(SpellNum).lWidth \ SIZE_X) - 1
    
    sRECT.Top = 0
    sRECT.Bottom = SIZE_Y
    sRECT.Left = frmSpellEditor.scrlFrame.Value * SIZE_X
    sRECT.Right = sRECT.Left + SIZE_X
    
    dRECT.Top = 0
    dRECT.Bottom = SIZE_Y
    dRECT.Left = 0
    dRECT.Right = SIZE_X

    Call Engine_BltToDC(DDS_Spell(SpellNum), sRECT, dRECT, frmSpellEditor.picPic)

End Sub

Compare them.


Re: Small Issue with Spells - Jared - 24-03-2009

this is client side btw.


Code:
Private Sub scrlFrame_Change()
    lblFrameNum.Caption = scrlFrame.Value
    Call SpellEditorBltSpell
    frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlFrame.Value).SurfDescription.lWidth \ SIZE_X) - 1
End Sub

lol.. i didnt know witch one you were talking about so.



Code:
Public Sub SpellEditorBltSpell()
Dim SpellPic As Long
Dim sRECT As DXVBLib.RECT
Dim dRECT As DXVBLib.RECT

    SpellPic = frmSpellEditor.scrlPic.Value

    If SpellPic < 1 Or SpellPic > NumSpells Then
        frmSpellEditor.picPic.Cls
        Exit Sub
    End If
    
    Call DD_ReadySurface("spells\" & SpellPic, DDS_Spell(SpellPic))
    
    sRECT.Top = 0
    sRECT.Bottom = SIZE_Y
    sRECT.Left = frmSpellEditor.scrlFrame.Value * SIZE_X
    sRECT.Right = sRECT.Left + SIZE_X
    
    dRECT.Top = 0
    dRECT.Bottom = SIZE_Y
    dRECT.Left = 0
    dRECT.Right = SIZE_X

    Call DD_BltToDC(DDS_Spell(SpellPic).Surface, sRECT, dRECT, frmSpellEditor.picPic)

End Sub



Re: Small Issue with Spells - Matt - 24-03-2009

Jared Wrote:this is client side btw.


Code:
Private Sub scrlFrame_Change()
    lblFrameNum.Caption = scrlFrame.Value
    Call SpellEditorBltSpell
    frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlFrame.Value).SurfDescription.lWidth \ SIZE_X) - 1
End Sub

lol.. i didnt know witch one you were talking about so.



Code:
Public Sub SpellEditorBltSpell()
Dim SpellPic As Long
Dim sRECT As DXVBLib.RECT
Dim dRECT As DXVBLib.RECT

    SpellPic = frmSpellEditor.scrlPic.Value

    If SpellPic < 1 Or SpellPic > NumSpells Then
        frmSpellEditor.picPic.Cls
        Exit Sub
    End If
    
    Call DD_ReadySurface("spells\" & SpellPic, DDS_Spell(SpellPic))
    
    sRECT.Top = 0
    sRECT.Bottom = SIZE_Y
    sRECT.Left = frmSpellEditor.scrlFrame.Value * SIZE_X
    sRECT.Right = sRECT.Left + SIZE_X
    
    dRECT.Top = 0
    dRECT.Bottom = SIZE_Y
    dRECT.Left = 0
    dRECT.Right = SIZE_X

    Call DD_BltToDC(DDS_Spell(SpellPic).Surface, sRECT, dRECT, frmSpellEditor.picPic)

End Sub

Well, tbh, I meant take your code and then take my code. Compare them and find out what was different. Mine works fine.


Re: Small Issue with Spells - Jared - 24-03-2009

Well it did not work on mine, and also, just to see if anything i added was messing it up i downloaded a fresh version of MS4 and still the same exact issue without any editing.

Strange eh?

Lol also im quiet new at this so, im still learning.


Re: Small Issue with Spells - Vahz - 29-03-2009

change the
Code:
frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlFrame.Value).SurfDescription.lWidth \ SIZE_X) - 1

with this
Code:
frmSpellEditor.scrlFrame.Max = (DDS_Spell(scrlPic.Value).SurfDescription.lWidth \ SIZE_X) - 1

in case u didnt notice,
i replaced scrlFrame.value with scrlPic.value


Re: Small Issue with Spells - Jared - 29-03-2009

lol that just caused more errors. thank you though.