ThreadBoard ArchivesSite FeaturesActiveworlds SupportHistoric Archives |
aw_query_5x5 (Sdk)
aw_query_5x5 // Sdkdr. squailboontAug 28, 2005, 8:02pm
My current 'handle_cell_begin' code:
void handle_cell_begin(void) { int sector_x = aw_sector_from_cell(aw_int(AW_CELL_X)) - query_x; int sector_z = aw_sector_from_cell(aw_int(AW_CELL_Z)) - query_z; sequence[sector_z+1][sector_x+1] = aw_int(AW_CELL_SEQUENCE); } works fine with the standard 3x3 aw_query; however, using aw_query_5x5 doesn't seem to quite work with this (the query simply goes into an infinite loop) Anyone know how this code should be written for the 5x5 query? deltaphcAug 28, 2005, 8:32pm
I ran into this very same problem.
The correct code: void handle_cell_begin(void) { int sector_x = aw_sector_from_cell(aw_int(AW_CELL_X)) - query_x; int sector_z = aw_sector_from_cell(aw_int(AW_CELL_Z)) - query_z; sequence[sector_z+2][sector_x+2] = aw_int(AW_CELL_SEQUENCE); } Should work. [View Quote] deltaphcAug 28, 2005, 8:36pm
Also, that code won't work for 3x3 query, like how the 3x3 query code
won't work for 5x5. So you should set a variable or something indicating whether you're doing a 3x3 or 5x5 query, then add the necessary if statement, etc. [View Quote] |