Mirage Source
Forget Spell Command - 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: Resources (https://mirage-engine.uk/forums/forumdisplay.php?fid=49)
+---- Thread: Forget Spell Command (/showthread.php?tid=24)



Forget Spell Command - grimsk8ter11 - 01-06-2006

Difficulty: 1/5

In the server, open modHandleData.bas.
find this:
Code:
' :::::::::::::::::
' :: Cast packet ::
' :::::::::::::::::
If LCase(Parse(0)) = "cast" Then
' Spell slot
n = Val(Parse(1))

Call CastSpell(Index, n)

Exit Sub
End If

and underneath it add:
Code:
' :::::::::::::::::::::::::
' :: Forget spell packet ::
' :::::::::::::::::::::::::
If LCase(Parse(0)) = "forgetspell" Then
' Spell slot
n = CLng(Parse(1))

' Prevent subscript out of range
If n  MAX_PLAYER_SPELLS Then
HackingAttempt Index, "Invalid Spell Slot"
Exit Sub
End If

With Player(Index).Char(Player(Index).CharNum)
If .Spell(n) = 0 Then
PlayerMsg Index, "No spell here.", Red

Else
PlayerMsg Index, "You have forgotten the spell """ & Trim$(Spell(.Spell(n)).Name) & """", Green

.Spell(n) = 0
SendSpells Index
End If
End With

Exit Sub
End If

In the client, open frmMirage.
Add a label to picPlayerSpells, set it's name property to "lblForgetSpell", and set it's caption property to "Forget Spell".
Double-click it and add this code:
Code:
If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
If MsgBox("Are you sure you want to forget the spell """ & Trim$(Spell(Player(MyIndex).Spell(lstSpells.ListIn dex + 1)).Name) & """?", vbQuestion Or vbYesNo, "Forget Spell" = vbNo Then Exit Sub

SendData "forgetspell" & SEP_CHAR & lstSpells.ListIndex + 1 & SEP_CHAR & END_CHAR
picPlayerSpells.Visible = False
End If
Else
AddText "No spell here.", BrightRed
End If

All done.

Now you can click on the Forget Spell label to forget spells you don't want anymore, yay.

Quote:Posted by EnigmaWave on Feb 6, 04



- Dark Echo - 22-03-2007

You are missing an End if.. Nest your code its really hard to work out whats with what..

Code:
If Player(MyIndex).Spell(lstSpells.ListIndex + 1) > 0 Then
    If GetTickCount > Player(MyIndex).AttackTimer + 1000 Then
        If MsgBox("Are you sure you want to forget the spell """ & Trim$(Spell(Player(MyIndex).Spell(lstSpells.ListIn dex + 1)).Name) & """?", vbQuestion Or vbYesNo, "Forget Spell" = vbNo Then Exit Sub

        SendData "forgetspell" & SEP_CHAR & lstSpells.ListIndex + 1 & SEP_CHAR & END_CHAR
        picPlayerSpells.Visible = False
    End If
Else
    AddText "No spell here.", BrightRed
End If

No wait.. you arent missing an End if.. I found that out when i nested it.. I have no idea whats wrong at the moment.. What error did you get mate?


- Braydok - 27-03-2007

I'm getting a type mismatch on the msgbox. Any help?


- Robin - 27-03-2007

Braydok Wrote:I'm getting a type mismatch on the msgbox. Any help?

Verrigan just pointed it out! Cretin.


- Braydok - 27-03-2007

Darn you, I did that, but I fixed it, no help to you.


- Braydok - 28-03-2007

good point, I'm sorry Robin, I have just been crabby cakes today. Sad

I just deleted the part where it named the spell.


- Robin - 28-03-2007

No problem.

Did you manage to get it to work now?


- Braydok - 28-03-2007

Yes. Now it just says, "Are you sure that you want to forget this spell?" Without naming the spell. Smile

~Braydok


- Boo - 10-04-2007

i did that fix Verrigan but im getting an error on 'Then' at end and it says..

Quote:Expected: list separator or )

Any idea?


- Rian - 10-04-2007

Add a ) somewhere, or remove a ( somewhere


- funkynut - 10-04-2007

Sonire Wrote:Add a ) somewhere, or remove a ( somewhere

:lol: :lol: Love how simple the solutions to the problems being posted today are


- Robin - 10-04-2007

funkynut Wrote:
Sonire Wrote:Add a ) somewhere, or remove a ( somewhere

:lol: :lol: Love how simple the solutions to the problems being posted today are

That's because the problems are simple. So are the people who post them.


- funkynut - 10-04-2007

Robin Wrote:
funkynut Wrote:
Sonire Wrote:Add a ) somewhere, or remove a ( somewhere

:lol: :lol: Love how simple the solutions to the problems being posted today are

That's because the problems are simple. So are the people who post them.
I was trying to say that, just in a tactful way Big Grin