Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bloody RTE 9: Subscript out of Range
#1
Hi, I've recently used the "kingdoms" tutorial in the old tutorials section of the forum. I've made a couple of alterations to get the code to actually work, however, I've now run into a problem. Whenever anyone logs out the game, everyone else left on gets a "RTE 9: subscript out of range" error.

I've ran it through the debug and it highlights this line:

Call SetPlayerkingdom(i, Val(Parse(10)))

which is under "Player data packet", I've checked the packet the server sends and found that it does send the players kingdom information. So now I'm confused as hell, I know the answer to this is going to be simple as hell, but well atm I'm confused.

Thanks in advance for any help Smile
Reply
#2
you might check the variable types to make sure they match up, as the only thing i can think of atm, is that you either converted or didn't a variable type (may be worng, idk).

check here, and the corrosponding sub:
Code:
i, Val(Parse(10))

i'll look at the tut later, when i have time.
Reply
#3
You need to figure out if it's the 'i' or the 'val(parse(10))' that is causing the RTE 9.

My first guess would be that there's nothing in 'val(parse(10))' which means you need to check the packet server side and make sure you're sending the right amount of data.
Reply
#4
Server side, under the "SendJoinMap" sub:

' Send index's player data to everyone on the map including himself
Packet = "PLAYERDATA" & SEP_CHAR & Index & SEP_CHAR & GetPlayerName(Index) & SEP_CHAR & GetPlayerSprite(Index) & SEP_CHAR & GetPlayerMap(Index) & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & GetPlayerAccess(Index) & SEP_CHAR & GetPlayerPK(Index) & SEP_CHAR & GetPlayerkingdom(Index) & SEP_CHAR & END_CHAR

and under the "SendLeaveMap" sub:

Packet = "PLAYERDATA" & SEP_CHAR & Index & SEP_CHAR & GetPlayerName(Index) & SEP_CHAR & GetPlayerSprite(Index) & SEP_CHAR & 0 & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & GetPlayerAccess(Index) & SEP_CHAR & GetPlayerPK(Index) & SEP_CHAR & GetPlayerkingdom(Index) & SEP_CHAR & END_CHAR

and finally under the "SendPlayerData" sub:

Packet = "PLAYERDATA" & SEP_CHAR & Index & SEP_CHAR & GetPlayerName(Index) & SEP_CHAR & GetPlayerSprite(Index) & SEP_CHAR & GetPlayerMap(Index) & SEP_CHAR & GetPlayerX(Index) & SEP_CHAR & GetPlayerY(Index) & SEP_CHAR & GetPlayerDir(Index) & SEP_CHAR & GetPlayerAccess(Index) & SEP_CHAR & GetPlayerPK(Index) & SEP_CHAR & GetPlayerkingdom(Index) & SEP_CHAR & END_CHAR

Whats annoying me with it, is the fact its only happening when they actually log out the game, not when they simply change maps. :evil:
Reply
#5
I don't know what version of MS you're using, but I do believe there's also a 'SendLeftGame' that has the playerdata.
Reply
#6
Dugor, cheers mate. Sorted Tongue

lol, I'm such an idiot
Reply
#7
I just posted this:

viewtopic.php?f=120&t=5356

Might be interest to you.
Reply
#8
Dugor Wrote:You need to figure out if it's the 'i' or the 'val(parse(10))' that is causing the RTE 9.

How could the i ever be causing an RTE 9 on that line?
Reply
#9
I was thinking "Overflow', if the value is too high for that variable type. If i was a byte and it was 299.
Reply
#10
Surreee...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)