Mirage Source
Meh... - 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: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: Meh... (/showthread.php?tid=1985)



Meh... - Pbcrazy - 02-08-2008

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



Re: Meh... - Labmonkey - 02-08-2008

where does it fail?


Re: Meh... - Robin - 03-08-2008

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.


Re: Meh... - Pbcrazy - 03-08-2008

@ 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


Re: Meh... - Labmonkey - 03-08-2008

basic debugging.


comment out the addtext line. Does it work?


Re: Meh... - Robin - 03-08-2008

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


Re: Meh... - Pbcrazy - 03-08-2008

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.


Re: Meh... - Labmonkey - 03-08-2008

does it get to the if statement? maybe those strings dont = "" but = vbnullstring. Not sure though.


Re: Meh... - Pbcrazy - 03-08-2008

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


Re: Meh... - Pbcrazy - 03-08-2008

no it executes addtext just fine its the if statement thats the problem.


Re: Meh... - Labmonkey - 03-08-2008

break at Npc(Map(GetUserMap(Index)).MapNpc(i)).Name
and add a watch to it
check the value of it every time.


Re: Meh... - Dragoons Master - 03-08-2008

add a Stop, or a break point just after the addtext, then keep pressing F8 and see where it goes.


Re: Meh... - Pbcrazy - 03-08-2008

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.