Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (VoroneTZ), 1,233 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
can't send to specific entity... -_-' send_skill_id #348546
11/28/10 01:15
11/28/10 01:15
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Okay well I've gotten pretty far in making my online RPG but now I'm trying to optimize my code. I have an item who's assigned an ID number on the server side when it's created. I'm trying to send this skill to players only who need it. But for some reason i just can't get it to work.

here is my code:

Code:
function fItem()
{
//in a function:
while(my.id == 0)
{
	if(connection == 2 && my.id == 0 && player != NULL)
	{
		my.sendto = dplay_id;
		send_skill(my.sendto,0);
	}
	wait(1);
}

//inside a while loop somewhere further down the function
if(my.sendto != 0)
{
	send_skill_id(my.sendto,my.id,0);
	my.sendto = 0;
}



i tried changing it to send_skill_to and sending a handle a handle of the player to the server and then having it send it to only him but I just can't get it to work.

If i change it to send_skill(my.sendto,SEND_ALL); everything works fine again. plz help

fastlane I know your out there. I need your help wink. Are you the only one who's got this freaking acknex multiplayer crap figured out?

Last edited by PrenceOfDarkness; 11/28/10 01:16.

"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: can't send to specific entity... -_-' send_skill_id [Re: PrenceOfDarkness] #348547
11/28/10 02:43
11/28/10 02:43
Joined: Feb 2009
Posts: 2,154
Damocles_ Offline
Expert
Damocles_  Offline
Expert

Joined: Feb 2009
Posts: 2,154
Why dont you use one of the plugins?
Using the build in multiplayerstuff is a waste of time and effort.

(and you get better support from the plugin creators there)

Re: can't send to specific entity... -_-' send_skill_id [Re: Damocles_] #348561
11/28/10 10:43
11/28/10 10:43
Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
Tobias Offline

Moderator
Tobias  Offline

Moderator

Joined: Aug 2000
Posts: 1,140
Baunatal, Germany
The sending in the code you posted works. So your problem lies elsewhere, for example when id is 0 your function hangs forever in the first loop. But there is another problem. You seem to send the skill not only once but permanently in a loop to the server. This is not the reason why it does not work, but its very bad for the traffic. You send in reliable mode, so you need to send it only once. If your function does not work the first time, permanently repeating it wont make it better.

Re: can't send to specific entity... -_-' send_skill_id [Re: Tobias] #348711
11/29/10 20:40
11/29/10 20:40
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
I know tobias.. i was trying to simplify it down to help me find the problem... but it didn't help. I can't find the problem else where. I've had this problem forever with A6/A7. It's so impossible to send information to a specific person. God -_-'


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: can't send to specific entity... -_-' send_skill_id [Re: PrenceOfDarkness] #348864
12/01/10 09:58
12/01/10 09:58
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I find Gamestudio multiplayer easy to use, but when you seem to have such problems frequently, have you tried debugging your script? With the debugger you are not helpless, place breakpoints in the on_server and on_client events. Then you can see what they receive or send. Especially you can then see easily if its your client script or your server script that does not do what you want.

When you create an entity you must first wait until it exists on the network:

while (my.client_id != dplay_id) wait(1);

As long as client_id is not set you can not send anything with that entity. This is in the manual. It can be half a second. After client_id is set, you can send skills to any specific entity. This works without problem, at least in my project, I use it all the time.

Re: can't send to specific entity... -_-' send_skill_id [Re: Spirit] #348931
12/01/10 22:20
12/01/10 22:20
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Spirit that works fine if the entity was created on the client but an item needs to be created on the server so the cliend_id hangs at zero. Further more how do you debug mode using multiplayer? I can only run 1 debug instance at a time and if I run a server using test run and then I run a dubug client the script editor crashes on me.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: can't send to specific entity... -_-' send_skill_id [Re: PrenceOfDarkness] #349207
12/05/10 01:30
12/05/10 01:30
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
I am still interested in this.


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: can't send to specific entity... -_-' send_skill_id [Re: PrenceOfDarkness] #349605
12/09/10 15:41
12/09/10 15:41
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
okay here is a super basic stand alone script that should in theory but doesn't. Why?

Code:
PANEL* testPNL = {
	flags = SHOW;
	digits(0,0,6.4,*,1,player.skill1);
	digits(0,10,6.4,*,1,player.skill98);
	digits(0,20,6.4,*,1,dplay_id);
	digits(0,30,6.4,*,1,player.client_id);
}

void fPlayer()
{
	while(my == NULL){wait(1);}
	player = my;
	while(connection == 0)
	{
		wait(1);
	}
	set(my,TRANSLUCENT);
	
	while(my.skill1 == 0)
	{
		wait(-1);
		if(connection == 2 && my.skill1 == 0)
		{
			my.skill98 = dplay_id;
			send_skill(my.skill98,0);
		}
	}

	wait(-0.5);

	reset(my,TRANSLUCENT);

	while(1)
	{
		wait(1);
		
		if(my.skill98 != 0 && connection != 2)
		{
			my.skill1 = 1;
			send_skill_id(my.skill98,my.skill1,0);
			my.skill98 = 0;
		}
	}
}

void main()
{
	dplay_localfunction = 2;		//run actions on both server and client
	
	level_load("valiance.wmb");
	wait(-2);
	
	#ifdef server						//if we defined this game as a server
		while(connection == 0) {wait(1);}	// wait until we have a connection
	#endif

	#ifdef client						//if we defined this game as a client
		while(connection == 0) {wait(1);}	// wait until we have a connection
	#endif
	
	if(connection == 1 || connection == 3)
	{
		player = ent_create("testing.mdl",vector(0,0,0),fPlayer);
		player.skill1 = 100;
	}
}



I've honestly been trying to get send_skill_to to work ever since I bought A7 but I have never been able to get it working properly. I've kept putting it off for ever but now I'm at the point where I need it (almost done with the game).
PLZ help.

http://www.2shared.com/file/l8VY6-BU/test.html



Last edited by PrenceOfDarkness; 12/09/10 15:52.

"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Re: can't send to specific entity... -_-' send_skill_id [Re: PrenceOfDarkness] #349813
12/11/10 10:48
12/11/10 10:48
Joined: Sep 2003
Posts: 929
Spirit Offline

Moderator
Spirit  Offline

Moderator

Joined: Sep 2003
Posts: 929
I do not understand your script, you have some #ifdefs but they are nowhere defined, so it seems those lines in your script are never executed?

Also after level loading, you must wait until the level is synchronized to the server, just as described in the tutorial. Your wait(-2) is not good because dependent on the level size and Internet speed, synchronizing a level can take much longer or much shorter than 2 seconds. Its highly unlikely that it takes exactly two seconds.

You can debug either the client or the server with SED. When you debug the client for example, start first the server normally, then start the client in debug mode with the red arrow.

Re: can't send to specific entity... -_-' send_skill_id [Re: Spirit] #349901
12/12/10 01:50
12/12/10 01:50
Joined: Aug 2004
Posts: 1,305
New York
PrenceOfDarkness Offline OP
Serious User
PrenceOfDarkness  Offline OP
Serious User

Joined: Aug 2004
Posts: 1,305
New York
Spirit, Did you check out the 2nd code posting? That stand alone application gives me the same issue. If this is the only issue (i'm not letting the client and server synchronize) then can you please show me how? Which tutorial are you talking about? The workshop tutorials?


"There is no problem that can't be solved with time and determination." -me
prenceofdarkness for instant messages on AIM.

Looking for a model designer
PLEASE, SEND ME A PRIVATE MESSAGE OR EMAIL IF YOU'RE INTERESTED.
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1