Gamestudio Links
Zorro Links
Newest Posts
hello all
by jcl. 09/24/19 09:04
Right AssetsFix for trading Forex on IG?
by Andy60. 09/23/19 21:11
Converting fbx file to mdl7
by Dark_Light. 09/23/19 15:50
New system for Zorro S subscriptions
by jcl. 09/23/19 08:34
IG plugin initial release
by Andy60. 09/23/19 07:40
Any chance of PBR materials with A8?
by Dooley. 09/22/19 21:43
Levels, textures, etc for A8
by Dooley. 09/22/19 03:57
AUM Magazine
Latest Screens
The Space Between
Pogostuck: Rage With Your Friends
Worst Case Z
AckCon'18 - Lotter vs the World 2 - Preview Release
Who's Online Now
8 registered members (svenbob, Tamas, MatPed, Superku, kvm, jenGs, 3run, 1 invisible), 642 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Zylo, Hjuutgckk, Dark_Light, oxygenjoe, web20tpo
18292 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
send_data_to - using multiple structs? #448655
02/14/15 23:10
02/14/15 23:10
Joined: Mar 2010
Posts: 120
Switzerland
T
TehV Offline OP
Member
TehV  Offline OP
Member
T

Joined: Mar 2010
Posts: 120
Switzerland
So, the example shows how I can send custom data by defining and transferring a struct using send_data_to. However, I'm not entirely sure if I'm limited to a single type of struct or if I can use multiple different structs depending on what I need to transfer and figure out what it was on the receiving end.

In other words, I'm wondering if I can do something similar to what you can do with strings in EVENT_STRING to figure out which string was updated (event_type == EVENT_STRING && str == mystring).

It would be really useful for me if I didn't have to create a one-fits-all struct to cover everything I need if most of the time a smaller struct would do the job just as well.

Is this possible and what would be the best way to go about doing this?

Re: send_data_to - using multiple structs? [Re: TehV] #448656
02/15/15 01:10
02/15/15 01:10
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
When you send a struct, you simply send the bytes from a startaddress till an offset to this startaddress.
So just make your own messaging system and say the first byte will decide afterwards which event type / struct is used. Thats it


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