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,631 guests, and 7 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 2 of 3 1 2 3
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 Offline OP
Serious User
PrenceOfDarkness  Offline 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=02370cdad5cb6747cc308c432c26bb3d

send_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: PrenceOfDarkness] #177710
02/11/08 07:09
02/11/08 07:09
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
I have not looked into details, but don't think that your code can work. You must always check the event_type in a server or client event. Also parts of your code are never executed because "server" or "client" are nowhere defined.

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 Offline OP
Serious User
PrenceOfDarkness  Offline 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: PrenceOfDarkness] #177712
02/11/08 16:36
02/11/08 16:36
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
dlient and server are not defined automatically in Lite-C I think, because Lite-C handles defines differently and your code above would require two compiled version - one for the clients and one for the server.

Better evaluate the "connection" variable.

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
R
RicheyMB2 Offline
Newbie
RicheyMB2  Offline
Newbie
R

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 Offline OP
Serious User
PrenceOfDarkness  Offline 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: PrenceOfDarkness] #177715
02/12/08 09:47
02/12/08 09:47
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Prence: you can not define something in WED, nor does -sv and -cl #define something in lite-C. Please see: http://manual.conitec.net/define.htm. Use the connection variable to find out in which mode your app was started.

Richey: yes, that code should work. Maybe there's a bug. I'll look into it in detail, and let you know.

Re: why no send_skill_to? or send_skill_id ? [Re: jcl] #177716
02/12/08 10:02
02/12/08 10:02
Joined: Feb 2008
Posts: 39
R
RicheyMB2 Offline
Newbie
RicheyMB2  Offline
Newbie
R

Joined: Feb 2008
Posts: 39
I'm using A7.07 commercial if that is of assistance. Thanks.

Re: why no send_skill_to? or send_skill_id ? [Re: RicheyMB2] #177717
02/12/08 14:22
02/12/08 14:22
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Ok, I've looked into it and the reason for your problem was indeed a bug in 7.07 and 7.06. I had not noticed the bug so far because it didn't appear in my test scripts. But it appears under many other circumstances and is probably also a reason for Prence's problems. This will be fixed in the next version.

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
R
RicheyMB2 Offline
Newbie
RicheyMB2  Offline
Newbie
R

Joined: Feb 2008
Posts: 39
Thank you.

Page 2 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