![]() |
Subscript out of Range - Printable Version +- Mirage Engine (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: Subscript out of Range (/showthread.php?tid=1939) |
Subscript out of Range - Avalonia - 20-07-2008 Want to pass the size variable (used for sprite sizes) wich is a byte to the BltNPC function so i can choose between a few sizes when bliting and blit different if its an other size. Code: Dim sizez as Integer Code: sizez = Npc(MapNpc(i).Num).Size ' Subscript out of range error here Re: Subscript out of Range - GIAKEN - 20-07-2008 Check if the MapNpc(i).Num > 0 before using it. Re: Subscript out of Range - Avalonia - 20-07-2008 GIAKEN Wrote:Check if the MapNpc(i).Num > 0 before using it. hm MapNpc(i).Num always returns 0 , why doesnt it return the number ![]() Re: Subscript out of Range - GIAKEN - 20-07-2008 Because you aren't use an NPC on your map or the NPC is dead? Re: Subscript out of Range - Avalonia - 20-07-2008 nnum = Npc(MapNpc(i).Num).Size Sorry i meant Npc(MapNpc(i).Num).Size only returns 0 , even though it should be on 1. Have 4 npcs setup with size 1 and 1 with 0 Its 1 in the npc ini file also so that should be fine. Re: Subscript out of Range - GIAKEN - 20-07-2008 Well you still need to make sure you're checking if MapNpc().Num > 0...also make sure that the NPC editor is sending the size value right and that it's being sent to the client and that the server is saving and loading it correctly. Re: Subscript out of Range - Avalonia - 20-07-2008 GIAKEN Wrote:Well you still need to make sure you're checking if MapNpc().Num > 0...also make sure that the NPC editor is sending the size value right and that it's being sent to the client and that the server is saving and loading it correctly. Saving and loading works fine my code is now this , wich checks also if its bigger then 0: Code: ' Blit out the npcs Well i could make a Senddata("requestsize & Sep_CHAR & Npc(MapNpc(i).Num)& SEP_Char & End_CHar ") and then let the server reply with the size, will try that. Re: Subscript out of Range - GIAKEN - 20-07-2008 I definitely would not do that. You don't want several players sending dozens of packets a second. Re: Subscript out of Range - Avalonia - 20-07-2008 GIAKEN Wrote:I definitely would not do that. You don't want several players sending dozens of packets a second. Well then i have no idea, it saves it fine in the npceditor when i reopen it it receives the 1 value from the server or the 0 , depending on what i set it ,and in the ini it is also Size = 1. Msgbox(NPC(Mapnpc(2).Num)).Size) returns 0 also , wich should return 1 Re: Subscript out of Range - Labmonkey - 20-07-2008 have you made sure that you are sending the size when you send the other npc data? Re: Subscript out of Range - Matt - 20-07-2008 Labmonkey Wrote:have you made sure that you are sending the size when you send the other npc data? That's exactly what I was about to suggest. When loading the npc, server side, if you have ini loading still, make sure you add the line there that will pull the value from the npc's file. Also, when sending the npc data, add the size to the packet and don't forget to receive it on the client side. Re: Subscript out of Range - Avalonia - 20-07-2008 Ok thanks for help , just forgot to update it to all clients , i only had it update in the npceditor, works now like a charm. |