Gamestudio Links
Zorro Links
Newest Posts
Blobsculptor tools and objects download here
by NeoDumont. 03/28/24 03:01
Issue with Multi-Core WFO Training
by aliswee. 03/24/24 20:20
Why Zorro supports up to 72 cores?
by Edgar_Herrera. 03/23/24 21:41
Zorro Trader GPT
by TipmyPip. 03/06/24 09:27
VSCode instead of SED
by 3run. 03/01/24 19:06
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (Imhotep, opm), 785 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
sakolin, rajesh7827, juergen_wue, NITRO_FOREVER, jack0roses
19043 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: sending array [Re: Reconnoiter] #438932
03/23/14 18:54
03/23/14 18:54
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Your array is perfectly fine. But send_var_id expects a pointer to user defined variable. Pointer is the important part here. player_handle[i] is a handle, not a pointer. If you want to pass that specific content you have to pass the address of the variable. For Example &(player_handle[i]). Lite-C takes some of the complexity away for you, by automatically using pointers where appropriate. But this does not work in all cases.


Always learn from history, to be sure you make the same mistakes again...
Re: sending array [Re: Uhrwerk] #438959
03/24/14 15:01
03/24/14 15:01
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
I first thought that with pointer you meant the entity pointer, I overlooked that the var/array could also have a pointer.

But how do write the send line correctly?, I now have tried the following 2 but those resulted in the instant crash:

Code:
if (player_handle[i] != 0) send_var_id(id,&player_handle[i]);


Code:
if (player_handle[i] != 0) send_var_id(id,&(player_handle[i]));



Thank you for your patience wink

Re: sending array [Re: Reconnoiter] #438974
03/24/14 19:39
03/24/14 19:39
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
I didn't try it, when posting, sorry. My guess was that the second version is the correct one. Are you maybe forced to send the array as a whole?
Code:
if (player_handle[i] != 0) send_var_id(id,player_handle);



Always learn from history, to be sure you make the same mistakes again...
Re: sending array [Re: Uhrwerk] #438978
03/24/14 21:05
03/24/14 21:05
Joined: Nov 2006
Posts: 497
Ohio
xbox Offline
Senior Member
xbox  Offline
Senior Member

Joined: Nov 2006
Posts: 497
Ohio
I don't have any way of testing this, but if you have an array of handles and you need to pass a pointer instead, couldn't you do send_var_id(id, ptr_for_handle(player_handle[i]))

Re: sending array [Re: xbox] #438981
03/24/14 21:26
03/24/14 21:26
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
That would return a pointer to an entity of course...


Always learn from history, to be sure you make the same mistakes again...
Re: sending array [Re: Uhrwerk] #439003
03/25/14 10:17
03/25/14 10:17
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Quote:
Are you maybe forced to send the array as a whole?
, bingo, that worked tyty. Now I don't have to use the for loop here grin. Also this means less overhead right?

Quote:
I don't have any way of testing this, but if you have an array of handles and you need to pass a pointer instead, couldn't you do send_var_id(id, ptr_for_handle(player_handle[i]))
, I could be wrong but I have a feeling that sending a handle is more safe (I have it from AUM77).

Last edited by Reconnoiter; 03/25/14 10:21.
Re: sending array [Re: Reconnoiter] #439039
03/25/14 19:32
03/25/14 19:32
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You should always and exclusively send handles. Never ever send pointers! The point was just that you have to pass the pointer to send_var_id. That however is not the same as sending the pointer.


Always learn from history, to be sure you make the same mistakes again...
Page 2 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