Mirage Source http://web.miragesource.net/forums/ |
|
Forget Spell Command http://web.miragesource.net/forums/viewtopic.php?f=210&t=35 |
Page 1 of 2 |
Author: | grimsk8ter11 [ Thu Jun 01, 2006 8:42 pm ] |
Post subject: | Forget Spell Command |
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 <= 0 Or 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
|
Author: | alexisg [ Wed Mar 21, 2007 10:43 pm ] |
Post subject: | |
I seem to have a problem with the coding of this. When I added in this line 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 I get an error on this line Code: 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 Could any one please tell me what is wrong?[/code] |
Author: | Dark Echo [ Thu Mar 22, 2007 1:02 am ] |
Post subject: | |
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? |
Author: | Verrigan [ Thu Mar 22, 2007 1:55 am ] |
Post subject: | |
Quote: 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
|
Author: | Braydok [ Tue Mar 27, 2007 12:51 pm ] |
Post subject: | |
I'm getting a type mismatch on the msgbox. Any help? |
Author: | Robin [ Tue Mar 27, 2007 2:11 pm ] |
Post subject: | |
Braydok wrote: I'm getting a type mismatch on the msgbox. Any help?
Verrigan just pointed it out! Cretin. |
Author: | Braydok [ Tue Mar 27, 2007 8:50 pm ] |
Post subject: | |
Darn you, I did that, but I fixed it, no help to you. |
Author: | Verrigan [ Tue Mar 27, 2007 11:05 pm ] |
Post subject: | |
Did you not see the bold in my quote? I thought it was fairly clear... And Robin was just pointing out how clear it was after you missed it, so no need to attack him. If you had another error after fixing the bold, you should have said so... No need to be so disrespectful.. Just be more clear when asking for help. |
Author: | Braydok [ Wed Mar 28, 2007 1:51 am ] |
Post subject: | |
good point, I'm sorry Robin, I have just been crabby cakes today. I just deleted the part where it named the spell. |
Author: | Robin [ Wed Mar 28, 2007 8:59 am ] |
Post subject: | |
No problem. Did you manage to get it to work now? |
Author: | Braydok [ Wed Mar 28, 2007 11:23 am ] |
Post subject: | |
Yes. Now it just says, "Are you sure that you want to forget this spell?" Without naming the spell. ~Braydok |
Author: | Boo [ Tue Apr 10, 2007 2:40 am ] |
Post subject: | |
i did that fix Verrigan but im getting an error on 'Then' at end and it says.. Quote: Expected: list separator or )
Any idea? |
Author: | Rian [ Tue Apr 10, 2007 3:52 am ] |
Post subject: | |
Add a ) somewhere, or remove a ( somewhere |
Author: | funkynut [ Tue Apr 10, 2007 3:29 pm ] |
Post subject: | |
Sonire wrote: Add a ) somewhere, or remove a ( somewhere
Love how simple the solutions to the problems being posted today are |
Author: | Robin [ Tue Apr 10, 2007 4:04 pm ] |
Post subject: | |
funkynut wrote: Sonire wrote: Add a ) somewhere, or remove a ( somewhere 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. |
Author: | funkynut [ Tue Apr 10, 2007 6:16 pm ] |
Post subject: | |
Robin wrote: funkynut wrote: Sonire wrote: Add a ) somewhere, or remove a ( somewhere 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 |
Page 1 of 2 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |