So, I'm trying to work out how to get information sent to the server.
If I am using an array method of storing data, and my item array looks like this:
(This exists on the server.)
dim itemsdescription$(1,3)
dim itemstats#(1,6)
rem With, for example, data being arranged like this:
rem Description Array
rem name of item
itemsdescription$(1,1)="Iron Sword"
rem item description
itemsdescription$(1,2)="An iron sword."
rem skill required to equip
itemsdescription$(1,3)="Swords"
rem Item Stats Array
rem Price if bought from NPC vendor
itemstats#(1,1)=100
rem Price if Sold to NPC vendor
itemstats#(1,2)=50
rem Damage
itemstats#(1,3)=100
rem Hit Chance Modifier
itemstats#(1,4)=-10 rem (would be used as a % ingame)
rem Level of Skill required to use
itemstats#(1,5)=2
rem Item Weight
itemstats#(1,6)=100
Now, if the player finds an item in-game. Say, s/he buys it from a vendor. What would be the best way to code this?
/* Player has bought item. Server is told to send information on item. */
rem Makes Packet
ItemPacket = mn create packet()
mn set memory size ItemPacket,1024
rem Server sends a packet with the array in it with this code:
mn get String ItemPacket,itemdescription$(1,1)
mn get String ItemPacket,itemdescription$(1,2)
mn get String ItemPacket,itemdescription$(1,3)
mn get int ItemPacket,itemstats#(1,1)
mn get int ItemPacket,itemstats#(1,2)
mn get int ItemPacket,itemstats#(1,3)
mn get int ItemPacket,itemstats#(1,4)
mn get int ItemPacket,itemstats#(1,5)
mn get int ItemPacket,itemstats#(1,6)
mn send UDP 0,ItemPacket,Client ID#,0,1
So, if that code is correct... [which I doubt. /newbie coder] then the Client that requested the packet will now have the packet.
Now the client can take the packet and use the data for things.
UDPPackets = mn Recv UDP(0,ItemPacket,Server ID,0)
dim itemsdescription$(1,3)
dim itemstats#(1,6)
Then I somehow make the packet fill up those arrays with the data that was put into them from the previous arrays.
Can I just load an entire array into a packet without doing all the fiddling about with individual elements? I don't see a command for that in the DarkNET documentation.
Once again, I've made a fairly vague question. Basically, I'm trying to work out the best way to make a client query a server for an array (or the contents of the array), and have it sent and recieved.
A code snippet of a system that does this would be appreciated.
Or else a pointer as to whether using arrays is the best way to do this... or if I should be doing it differently.
I'm waiting for my Dark Data purchase to be approved - at which point I might be able to use the databases in that for this, rather than arrays?
Thanks,
Vampire2948,