Unhandled message

fuloprichard

很久以前 | 帖子#1
I have problems with message handling.. flash saz that there is an unhandled meassage, but theres the code which have to handle that... i dont understand..

fuloprichard

很久以前 | 帖子#2
and another question: at server side, whats the problem with this:

public int[] playerid;


then in Userjoined:

playerid[player.UserId] = 1; <--------- it saz theres a problem with this but i dont know what..

CanzectoCanzecto

很久以前 | 帖子#3
I cannot tell you about the first part. However the second question, do you have a debug info to go with that error? Don't know which IDE you are using or simply going notepad->compiler. Guessing its C# with express edition?

It should tell you whats wrong, that information might be useful in giving you a right response.

Some things you can check so far. My experience is mostly with C++ and Java. Don't know if C# likes the [] (array accessor) to be after the type instead of after the identifier. Maybe try public int playerid[]. This however might be totally wrong and again, error information would be good help.

Other things to check is:

- That you have accessrights/within scope to/of the values you are trying to access.

- The problem might be in the code previous to the assignment, maybe you forgot some symbol in the code just before this segment, like forgetting to close an arguement?

- Out of bounds error? You enter a situation where you try to access data that doesnt exist and you are therefore out of the bounds of the array.


--- Is it a checked or unchecked error, like, does it happen at execution/testing whatever, or on compile-time.



Just alot of ideas for you to test out, just know that problems are easierly solved by providing the context and the effect.

:) Hope it helps, and good luck on your project.

rdzrdz

很久以前 | 帖子#4
In your 2nd question you show the declaration of 'playerid' and the you assign a value to 'UserId'... :-S

Either i simply do not get the question, or you are comparing apples to peres here.



edit: i see now i am a little late with responding here. :-X
最后编辑很久以前

CanzectoCanzecto

很久以前 | 帖子#5
Yeah i noticed too that it looks like his user is no longer active :) Just alittle too late. But to answer your question.

He is using the value of player.UserId in the array accessor. Its actually correct if its what he wants to do.

MyArray [ NUMBER OF ELEMENT ]

So, if I do this:

public int[] playerId = new int[5]; // however you do it :P

then you can access all 5 variables, within the array through the accessor by using another variable (or just constant), like this:

for ( int x = 0; x < 5; x++ )
{
println/cout/printf/trace playerId [ x ] ;
}


Please notice that in most languages the array must be initialized, as apposed to what the first poster did :) just noticed.

You need to have your object reference (in this case int[]) point at some memory for it to work usually. Again its dependent on your programming language.

Also please note that it is different between language whether or not they resets the memory assigned to your variables, meaning a new int my get reset to 0 at initialization, or it might regain the int value of the 4 bytes it has been granted as memory space.



--- Again the problem is that the original poster havent given us any sort of error message to follow, he is simply saying "this is wrong" <-- fix it

回复主题

现在就注册以回复主题

5dyouxi

5dyouxi.com是一个独立的游戏网站,在这里你将可以免费玩到各种好玩的单人和多人游戏。

开发者工具

如果你是一位flash游戏开发者,我们有一些非常强大的工具来帮助你开发更加优秀的游戏。

经典游戏

为什么不试试我们这里的一些最为优秀的在线flash游戏呢?这可是完全免费的!

Copyright ©2007-2012 5dyouxi™ - All rights reserved.337.0193ms on SERVER34097
注册 或者