1 registered members (TipmyPip),
18,633
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: why no send_skill_to? or send_skill_id ?
[Re: jcl]
#177709
02/08/08 18:42
02/08/08 18:42
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
@fastlane69 I'm using A7, so ya I'm using lite-c. @JCL, okay well in that case I must be doing something horrificly wrong. Here is my full test script: Code:
#include <acknex.h> // Pure Mode #include <default.c>
PANEL* pnlTesting = { flags = VISIBLE; digits(300,300,"mydata.x: %015.5f",*,1,mydata.x); }
typedef struct MYDATA { //int x; var x; char c[20]; } MYDATA; MYDATA mydata;
//receiving data function on_client_event(void* buffer) { // if(event_type == EVENT_DATA) memcpy(mydata,buffer,sizeof(MYDATA)); }
function main() { 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; player = ent_create("testing.mdl",vector(200,0,0),NULL); 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)); } if(key_w && connection == 3) { while(key_w == 1){wait(1);} beep(); mydata.x = 54321; send_var_to(NULL,mydata.x); } } }
Here is a downloadable link of the script that's ready to go: http://www.filesend.net/download.php?f=02370cdad5cb6747cc308c432c26bb3dsend_var works fine when I change mydata.x to var. No matter what, send_data wont work. It doesn't even effect the bandwith
"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: jcl]
#177711
02/11/08 16:29
02/11/08 16:29
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
In wed, when the code is ran I use -cl and -sv doesnt that define a server and client? Also my: function on_client_event(void* buffer) { // if(event_type == EVENT_DATA) memcpy(mydata,buffer,sizeof(MYDATA));}
doesn't work even if I uncomment the event type
"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: FBL]
#177713
02/11/08 17:46
02/11/08 17:46
|
Joined: Feb 2008
Posts: 39
RicheyMB2
Newbie
|
Newbie
Joined: Feb 2008
Posts: 39
|
I'm having a similar problem. In my test code I cannot get the client event to recognise that send_data_to has been called. It works if I comment out send_data_to and uncomment send_string. Basically pressing B should cause a server event. HELP - it's driving me nuts. Code:
#include <acknex.h> #include <default.c>
typedef struct MYDATA { int a; int b; int c; } MYDATA;
MYDATA* mydata = {a=1;b=2;c=3;} STRING* mystring = "test";
function client_event(void* buffer) { video_window(NULL, NULL, 112, "Client event triggered"); if (event_type == EVENT_DATA) { video_window(NULL, NULL, 112, "Client event triggered - Data"); } if (event_type == EVENT_STRING) { video_window(NULL, NULL, 112, "Client event triggered - String"); } }
function server_event(void* buffer, var id) { video_window(NULL, NULL, 112, "Server event triggered"); if (event_type == EVENT_DATA) { beep(); } }
function send_some_data() { video_window(NULL, NULL, 112, "Send"); send_data_to(NULL, mydata, sizeof(MYDATA)); //send_string(mystring); }
function main() { dplay_diag = 1;
vec_set(screen_color, vector(255,0,0)); video_mode = 7; on_b = send_some_data; on_client = client_event; on_server = server_event; }
|
|
|
Re: why no send_skill_to? or send_skill_id ?
[Re: RicheyMB2]
#177714
02/12/08 03:55
02/12/08 03:55
|
Joined: Aug 2004
Posts: 1,305 New York
PrenceOfDarkness
OP
Serious User
|
OP
Serious User
Joined: Aug 2004
Posts: 1,305
New York
|
I know ho define the client and the server. I just do it in WED, like i said it works with send_var_to
"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: jcl]
#177718
02/12/08 15:13
02/12/08 15:13
|
Joined: Feb 2008
Posts: 39
RicheyMB2
Newbie
|
Newbie
Joined: Feb 2008
Posts: 39
|
|
|
|
|