| Mirage Source http://miragesource.net/forums/ |
|
| Again... http://miragesource.net/forums/viewtopic.php?f=201&t=4144 |
Page 1 of 1 |
| Author: | Pbcrazy [ Tue Aug 12, 2008 1:43 am ] |
| Post subject: | Again... |
ok so can any one tell me why this is crashing my server? Code: If Parse(0) = PH_AttackNPC Then
npcname = Parse(1) Call AddText("recieved backet", vbBlack) For i = 1 To MAX_NPC Call AddText("in for loop", vbBlack) If Npc(i).Name = npcname Then Call AddText("in if statement", vbBlack) Call AttackNPC(Index, i) Call AddText("recieved attack request", vbBlack) End If Next i End If |
|
| Author: | GIAKEN [ Tue Aug 12, 2008 1:49 am ] |
| Post subject: | Re: Again... |
Give us more details (error number / whatever, and so on) |
|
| Author: | Pbcrazy [ Tue Aug 12, 2008 2:05 am ] |
| Post subject: | Re: Again... |
unfortunately i dont have a error number for you as the only way i can get to that part of the sub is if i compile it, and then, it just crashes the entire program. and im not sure how to go through debug line by line -_- |
|
| Author: | Matt [ Tue Aug 12, 2008 2:21 am ] |
| Post subject: | Re: Again... |
Comment it all out, recreate the issue and see if it still happens. |
|
| Author: | Pbcrazy [ Tue Aug 12, 2008 2:30 am ] |
| Post subject: | Re: Again... |
ok thanks for the advice, should have thought of that earlier -_- but i figured out whats actually crashing it i think Code: Sub AttackNPC(ByVal Index As Integer, ByVal NPCnum As Integer) Dim PlayerDmg As Integer Dim NPCDmg As Integer Dim PlayerDef As Integer Dim NPCDef As Integer Dim BattleFinished As Boolean Dim battlecount As Byte Dim LastSec As Integer BattleFinished = False battlecount = 0 LastSec = 0 Call AddText("in attack sub", vbBlack) Do Until BattleFinished = True If ServerSecond <= LastSec + 5 Then If GetUserWeaponSlot(Index) <> 0 Then PlayerDmg = (GetUserSTR(Index) + Item(GetUserWeaponSlot(Index)).Data1) / 2 + Rand(0, 2) Else PlayerDmg = (GetUserSTR(Index) + Rand(0, 2)) End If If GetUserBodySlot(Index) <> 0 Then PlayerDef = ((GetUserDEF(Index) + Item(GetUserBodySlot(Index)).Data1) / 2) Else PlayerDef = (GetUserDEF(Index)) End If If GetUserShieldSlot(Index) <> 0 Then PlayerDef = PlayerDef + (Item(GetUserShieldSlot(Index)).Data1 / 2) End If If GetUserHelmetSlot(Index) <> 0 Then PlayerDef = PlayerDef + (Item(GetUserHelmetSlot(Index)).Data1 / 2) End If If GetUserPantSlot(Index) <> 0 Then PlayerDef = PlayerDef + (Item(GetUserPantSlot(Index)).Data1 / 2) End If NPCDmg = ((Npc(NPCnum).STR + Rand(0, 2)) / 2) NPCDef = (Npc(NPCnum).DEF) PlayerDmg = PlayerDmg - NPCDef If PlayerDmg <= 0 Then PlayerDmg = 1 End If NPCDmg = NPCDmg - PlayerDef If NPCDmg < 0 Then NPCDmg = 0 End If 'If battlecount = 0 Then 'If GetUserWeaponSlot(Index) = Item_Type_Rifle Or Item_Type_MachineGun Or Item_Type_SMG Or Item_Type_Pistol Then 'User(Index).Battle.PlayerReport(0) = User(Index).Name & " spots a " & Npc(NPCnum).Name & " in the distance. " & User(Index).Name & " pulls out his " & Item(GetUserWeaponSlot(Index)).Name & " and fires at the enemy. Damage = " & PlayerDmg 'User(Index).Battle.NPCReport(0) = Npc(NPCnum).Name & " takes a hit from " & User(Index).Name & "'s weapon. Blood spurts out of the wound, but " & Npc(Index).Name & " lunges at " & User(Index).Name & ". Damage = " & NPCDmg 'End If 'If BattleCount >= 1 Then 'User(Index).Battle.PlayerReport(BattleCount) = User(Index).Name & " spots a " & Npc(NPCnum).Name & " in the distance. " & User(Index).Name & " pulls out his " & Item(GetUserWeaponSlot(Index)).Name & " and fires at the enemy. Damage = " & PlayerDmg 'User(Index).Battle.NPCReport(BattleCount) = Npc(NPCnum).Name & " takes a hit from " & User(Index).Name & "'s weapon. Blood spurts out of the wound, but " & Npc(Index).Name & " lunges at " & User(Index).Name & ". Damage = " & NPCDmg 'End If User(Index).Battle.PlayerReport(battlecount) = GetUserName(Index) & " dealt " & PlayerDmg & " damage. " & Npc(NPCnum).Name & " health left = " & Npc(NPCnum).HP - PlayerDmg User(Index).Battle.NPCReport(battlecount) = Npc(NPCnum).Name & " dealt " & NPCDmg & " damage. " & GetUserName(Index) & " health left = " & User(Index).HP - NPCDmg User(Index).HP = User(Index).HP - NPCDmg Npc(Index).HP = Npc(Index).HP - PlayerDmg Call SendBattleReport(Index, battlecount) If GetUserHP(Index) <= 0 Then BattleFinished = True ElseIf Npc(NPCnum).HP <= 0 Then BattleFinished = True 'ElseIf User(Index).Battle.flee = True Then 'BattleFinished = True ElseIf battlecount >= 10 Then BattleFinished = True End If battlecount = battlecount + 1 LastSec = ServerSecond Call AddText("finished attack loop", vbBlack) End If Loop End Sub hope you can sort through that. |
|
| Author: | Matt [ Tue Aug 12, 2008 2:43 am ] |
| Post subject: | Re: Again... |
Um. If you think that's the spot, YOU sort through it. Learn from your mistakes. Personally, I'd comment each of it out first, just to make sure it is in fact the issue. |
|
| Author: | Lea [ Tue Aug 12, 2008 3:44 am ] |
| Post subject: | Re: Again... |
breakpoint F8 until it stops working Then you know what line. |
|
| Author: | Pbcrazy [ Tue Aug 12, 2008 12:58 pm ] |
| Post subject: | Re: Again... |
Dave wrote: breakpoint F8 until it stops working Then you know what line. wait how do i do the break point and stuff -_- |
|
| Author: | Robin [ Tue Aug 12, 2008 1:00 pm ] |
| Post subject: | Re: Again... |
Pbcrazy wrote: Dave wrote: breakpoint F8 until it stops working Then you know what line. wait how do i do the break point and stuff -_- http://www.google.co.uk/search?hl=en&q=vb6+breakpoints&btnG=Google+Search&meta= |
|
| Author: | Matt [ Tue Aug 12, 2008 1:01 pm ] |
| Post subject: | Re: Again... |
I click the area next to the code, which makes it highlight the line in red. Makes the code break there, and show you what's going on, IF it reaches that point. |
|
| Author: | Pbcrazy [ Tue Aug 12, 2008 1:04 pm ] |
| Post subject: | Re: Again... |
thanks ill see what i can do |
|
| Author: | Asrrin29 [ Tue Aug 12, 2008 1:55 pm ] |
| Post subject: | Re: Again... |
you can also use the "Stop" command inside the code to create a breakpoint. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|