Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,618 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: why no send_skill_to? or send_skill_id ? [Re: RicheyMB2] #177719
02/12/08 18:36
02/12/08 18:36
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
JCL, I've also found another bug regarding structs and send_var_to. It appears that if you have more then one variable in the struct and you try to send more then 1 the game crashes. If need be I will provide a working example, but it's easy to replicate

[edit]
Below shows an example of what I mean. It's a complete copy of my testing.c file which you can copy and run it as is.

Code:

#include <acknex.h> // Pure Mode
#include <default.c>

typedef struct MYDATA
{
//int x;
var x;
char c[20];
} MYDATA;
MYDATA mydata;

typedef struct sZone
{
var zPosX;
var zPosY;
var zPosZ;
var zPan;
} sZone;
sZone z1s0;

sZone* pZoneStruct;

PANEL* pnlTesting =
{
flags = VISIBLE;
digits(300,300,"z1s0.zPosX: %015.5f",*,1,z1s0.zPosX);
digits(300,310,"z1s0.zPosY: %015.5f",*,1,z1s0.zPosY);
}

//receiving data
function on_client_event(void* buffer)
{
if(event_type == EVENT_DATA)
memcpy(mydata,buffer,sizeof(MYDATA));
}

function fTest()
{
my.skill50 = 12345;
while(1)
{
wait(1);
if(key_w == 1 && connection == 3)
{
while(key_w == 1){wait(1);}
z1s0.zPosX = 999;
z1s0.zPosY = 999;
send_var_to(my,z1s0.zPosX);
send_var_to(my,z1s0.zPosY);
}
}

/*
while(1)
{
wait(1);
if(key_w && connection == 3)
{
while(key_w == 1){wait(1);}
beep();
mydata.x = my.skill50;
send_var_to(NULL,mydata.x);

}
}
*/
}

function main()
{
if (0 == connection) {
video_window(NULL,NULL,16,"Looking for session...");
if (!session_connect("","")) // if no other server found,
{
session_open(""); // become the server
video_window(NULL,NULL,16,"SERVER");

}
else
{
video_window(NULL,NULL,16,"CLIENT");
}
}
level_load("testing.wmb");
wait(-1);
screen_color.blue = 255;
#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

// on_server = server_event;
on_client = on_client_event;

if(connection == 2)
{
player = ent_create("testing.mdl",vector(200,0,0),fTest);
}

wait(-1);
while(1)
{
wait(1);
if(key_q == 1 && connection == 3)
{
while(key_q == 1){wait(1);}
beep();
// sending data
mydata.x = 1234;
strcpy(mydata.c,"Test!");
send_data_to(NULL,mydata,sizeof(MYDATA));
}
}
}



Wow JCL, I can't wait until the next update if send_skill_to / send_data_to and if this is another bug also send_var_to are fixed! I honestly think A7 multiplayer will be 10X better then everyone thinks after those small fixes. Everyone's biggest complaint has always been: "A# multiplayer sucks because it's all or nothing when it comes to sending information". I'm honestly looking foward to it, and I'm almost certain tons of other people are also. send_skill_to should make multiplayer coding a joke (meaning super easy).

Last edited by PrenceOfDarkness; 02/13/08 06:03.

"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: why no send_skill_to? or send_skill_id ? [Re: PrenceOfDarkness] #177720
02/13/08 09:46
02/13/08 09:46
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
You can not send parts of a struct with send_var_to. You can send the whole struct, or any global variable, but not a part from a struct or a variable from inside a struct.

Re: why no send_skill_to? or send_skill_id ? [Re: jcl] #177721
02/13/08 17:26
02/13/08 17:26
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
Oh, sorry the manual wasn't very clear on that part. Thank you!


"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: why no send_skill_to? or send_skill_id ? [Re: PrenceOfDarkness] #218695
07/30/08 00:06
07/30/08 00:06
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Hi, I'm having trouble with this too on A6 with send_string_to,

I can get the client event to be trigger when receiving a string to clients from the server

send_string("TEST");

but not when specifying a single clientName

(strClientName,"TEST");

is this the same problem and will it be fixed or should I be more thorough so you can investigate it further

Many thanks!

Re: why no send_skill_to? or send_skill_id ? [Re: MrGuest] #218736
07/30/08 09:06
07/30/08 09:06
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
No, that was not discussed in this topic. Questions about send commands in old versions should better be asked in the "Past" or "Multiplayer" forums.

Page 3 of 3 1 2 3

Moderated by  old_bill, Tobias 

Gamestudio download | 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