Thanks so far mate,
The ID String is a string in the form of this (example: -1,4,15 can be anything). This ID is used to ID each sector in the array, as saved file on disc and for multiplayer communication.
This ID based on the position of the sector. From the example above: -1 * sector_size#, 4 * sector_size#, 15 * sector_size#.
Some globals:
global sec_size# : sec_size# = 1024
global sec_range# : sec_range# = 5
// Sector List
type t_sec_list
id$ // This is the sector ID string, also used as filename and to extract position data
endtype
// Array (Made from Type)
dim sec_list(0) as t_sec_list
The first part of the sector function. It shows how I started the listing of sectors by getting the client positions, turning it into a string label and adding it to the array:
// Get the sectors, occupied by players
for ID = 1 to array count(client(0))
// Get the ID strings of the sectors, of each client
new_x# = client(ID).pos_x# / sector_size#
new_y# = client(ID).pos_y# / sector_size#
new_z# = client(ID).pos_z# / sector_size#
new_x# = val(remove$(str$(new_x#), find char(str$(new_x#),"."), len(str$(new_x#))))
new_y# = val(remove$(str$(new_y#), find char(str$(new_y#),"."), len(str$(new_y#))))
new_z# = val(remove$(str$(new_z#), find char(str$(new_z#),"."), len(str$(new_z#))))
// Add these to the sector list
array insert at bottom sec_list()
sec_list().id$ = str$(new_x#) + "," + str$(new_y#) + "," + str$(new_z#)
next ID
// Add all sectors into to range (sec_range#)
` I need some help with this part
// Load/unload all actual sectors based on this list
` Right here! (Don't need help with this one ;) )
I hope this makes it it clear of what I mean.
Regards Sph!nx
www.mental-image.net