Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Meh...
#1
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
Reply
#2
where does it fail?
Reply
#3
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.
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#4
@ 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
Reply
#5
basic debugging.


comment out the addtext line. Does it work?
Reply
#6
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
Quote:Robin:
Why aren't maps and shit loaded up in a dynamic array?
Jacob:
the 4 people that know how are lazy
Robin:
Who are those 4 people?
Jacob:
um
you, me, and 2 others?
Reply
#7
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.
Reply
#8
does it get to the if statement? maybe those strings dont = "" but = vbnullstring. Not sure though.
Reply
#9
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
Reply
#10
no it executes addtext just fine its the if statement thats the problem.
Reply
#11
break at Npc(Map(GetUserMap(Index)).MapNpc(i)).Name
and add a watch to it
check the value of it every time.
Reply
#12
add a Stop, or a break point just after the addtext, then keep pressing F8 and see where it goes.
Reply
#13
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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)