| Mirage Source http://miragesource.net/forums/ |
|
| Meh... http://miragesource.net/forums/viewtopic.php?f=201&t=4092 |
Page 1 of 2 |
| Author: | Pbcrazy [ Sat Aug 02, 2008 11:56 pm ] |
| Post subject: | Meh... |
ok can someone please tell me why this sub isnt executing all the way through? Code: Sub SendAttackList(ByVal Index As Integer)
Dim Packet As String Dim i As Integer Call AddText("SendList1", vbBlue) For i = 0 To MAX_MAP_NPC - 1 If Npc(Map(GetUserMap(Index)).MapNpc(i + 1)).Name <> "" Then Packet = PH_AttackList & SepChar & Npc(Map(GetUserMap(Index)).MapNpc(i + 1)).Name & SepChar & EndChar Call AddText("SendList2", vbBlue) Call SendDataTo(Index, Packet) End If Next i End Sub |
|
| Author: | Labmonkey [ Sat Aug 02, 2008 11:57 pm ] |
| Post subject: | Re: Meh... |
where does it fail? |
|
| Author: | Robin [ Sun Aug 03, 2008 12:00 am ] |
| Post subject: | Re: Meh... |
Code: For i = 1 To MAX_MAP_NPC Fixed that line of code. Probably some other errors, but I didn't read past that line. |
|
| Author: | Pbcrazy [ Sun Aug 03, 2008 12:02 am ] |
| Post subject: | Re: Meh... |
@ Robin: nah i had it like that before and it still didnt work. It will execute as far as i know to Code: Call AddText("SendList1", vbBlue) then it wont go any farther. i cant figure it out. and its prolly something obvious XD |
|
| Author: | Labmonkey [ Sun Aug 03, 2008 12:03 am ] |
| Post subject: | Re: Meh... |
basic debugging. comment out the addtext line. Does it work? |
|
| Author: | Robin [ Sun Aug 03, 2008 12:04 am ] |
| Post subject: | Re: Meh... |
Pbcrazy wrote: @ Robin: nah i had it like that before and it still didnt work. It will execute as far as i know to Code: Call AddText("SendList1", vbBlue) then it wont go any farther. i cant figure it out. and its prolly something obvious XD @ Pbcrazy: I fixed that line of code for you. Once you find out what's breaking the entire piece of code, your old for...next loop wouldn't work properly ;D |
|
| Author: | Pbcrazy [ Sun Aug 03, 2008 12:08 am ] |
| Post subject: | Re: Meh... |
ok even with it like this Code: Sub SendAttackList(ByVal Index As Integer) Dim Packet As String Dim i As Integer Call AddText("SendList1", vbBlue) For i = 1 To MAX_MAP_NPC If Npc(Map(GetUserMap(Index)).MapNpc(i)).Name <> "" Then Packet = PH_AttackList & SepChar & Npc(Map(GetUserMap(Index)).MapNpc(i)).Name & SepChar & EndChar Call AddText("SendList2", vbBlue) Call SendDataTo(Index, Packet) End If Next i End Sub it still wont work. and with out the AddText it still wont work (I put those in there so i could see how far the program got.) im utterly baffled by it. |
|
| Author: | Labmonkey [ Sun Aug 03, 2008 12:26 am ] |
| Post subject: | Re: Meh... |
does it get to the if statement? maybe those strings dont = "" but = vbnullstring. Not sure though. |
|
| Author: | Lea [ Sun Aug 03, 2008 12:32 am ] |
| Post subject: | Re: Meh... |
Place breakpoints to find what sub it fails in. Then move to that sub and add breakpoints and find exactly what line that fails on. |
|
| Author: | Pbcrazy [ Sun Aug 03, 2008 12:47 am ] |
| Post subject: | Re: Meh... |
ok i changed it and added some check/breaks whatever the fuck you want to call them in. Code: Sub SendAttackList(ByVal Index As Integer) Dim Packet As String Dim i As Integer Call AddText("SendList1", vbBlue) For i = 1 To MAX_MAP_NPC Call AddText("SendList2", vbBlue) If Npc(Map(GetUserMap(Index)).MapNpc(i)).Name <> vbNullString Then Call AddText("SendList3", vbBlue) Packet = PH_AttackList & SepChar & Npc(Map(GetUserMap(Index)).MapNpc(i)).Name & SepChar & EndChar Call AddText("SendList4", vbBlue) Call SendDataTo(Index, Packet) End If Next i End Sub it executes Code: Call AddText("SendList2", vbBlue) then wont go any farther |
|
| Author: | Lea [ Sun Aug 03, 2008 1:03 am ] |
| Post subject: | Re: Meh... |
and where does it fail within addtext? |
|
| Author: | Pbcrazy [ Sun Aug 03, 2008 1:14 am ] |
| Post subject: | Re: Meh... |
no it executes addtext just fine its the if statement thats the problem. |
|
| Author: | Labmonkey [ Sun Aug 03, 2008 1:18 am ] |
| Post subject: | Re: Meh... |
break at Npc(Map(GetUserMap(Index)).MapNpc(i)).Name and add a watch to it check the value of it every time. |
|
| Author: | Dragoons Master [ Sun Aug 03, 2008 1:22 am ] |
| Post subject: | Re: Meh... |
add a Stop, or a break point just after the addtext, then keep pressing F8 and see where it goes. |
|
| Author: | Pbcrazy [ Sun Aug 03, 2008 1:28 am ] |
| Post subject: | Re: Meh... |
ok i figured it out. I added a addtext in to see if it even had anything in there as NPC().name and it didnt. figured it out that the maps werent loading thier npcslots correctly. xD but thanks for the help guys. |
|
| Page 1 of 2 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|