Array Not Initialised properly i think?
#1

I don't get that error, or any. however when i try printing something from this array it acts weird, here is the array.
pawn Код:
enum ARRAY_FORMAT
{  
    id,
    name[32],
    ids[9]
}
//Beach and Sea
new genBeachAndSea[][ARRAY_FORMAT] = {
    902, "Starfish", "[902]",
    903, "seaweed", "[903]",
    953, "CJ_OYSTER", "[953]",
    1461, "DYN_LIFE_P", "[1461]",
    1598, "beachball", "[1598]",
    1599, "fish1single", "[1599]",
    1600, "fish2single", "[1600]",
    1601, "fish3s", "[1601]",
    1602, "jellyfish", "[1602]",
    1603, "jellyfish01", "[1603]",
    1604, "fish3single", "[1604]",
    1605, "fish1s", "[1605]",
    1606, "fish2s", "[1606]",
    1607, "dolphin", "[1607]",
    1608, "shark", "[1608]",
    1609, "turtle", "[1609]",
    1610, "sandcastle1", "[1610]",
    1611, "sandcastle2", "[1611]",
    1637, "od_pat_hutb", "[1637]",
    1640, "beachtowel04", "[1640]",
    1641, "beachtowel03", "[1641]",
    1642, "beachtowel02", "[1642]",
    1643, "beachtowel01", "[1643]",
    2404, "CJ_SURF_BOARD", "[2404]",
    2405, "CJ_SURF_BOARD2", "[2405]",
    2406, "CJ_SURF_BOARD3", "[2406]",
    2410, "CJ_SURF_BOARD4", "[2410]",
    2782, "CJ_OYSTER_2", "[2782]"
};
there are about 40 more like this but i haven't tested them yet. when i try doing
pawn Код:
public message()
{
    print(genBeachAndSea[10][ids]);
    print(genBeachAndSea[5][ids]);
    return 1;
}
i get
Код:
[23:12:26] (null)
[23:12:26] (null)
in my log. and when i try doing
[pawn]
public message()
{
print(genBeachAndSea[0][name]);
print(genBeachAndSea[1][name]);
return 1;
}
[pawn]
i get
Код:
[23:12:07] (null)
[23:12:07] tarfish
i have spent the last 30 minutes debugging these arrays from misc formatting problems but i can't seem to get around this. Testing seems to show that doing arrayname[0][name] will return null, and arrayname[1][name] will return the name column of row 0. :/ could this be due to having large arrays or something?
Reply
#2

try this

pawn Код:
printf("id: %d - Name: %s - Strid: %s", genBeachAndSea[0][ids], genBeachAndSea[0][name], genBeachAndSea[0][ids]);
show me the output ^^
Reply
#3

You forgot to separate the information in each of the other indexes in the array. You're putting all the information into the first array of the multidimensional array, I'm surprised you aren't receiving an error.
pawn Код:
new genBeachAndSea[][ARRAY_FORMAT] = {
    { 902, "Starfish", "[902]" },
    { 903, "seaweed", "[903]" },
    { 953, "CJ_OYSTER", "[953]" },
    { 1461, "DYN_LIFE_P", "[1461]" },
    { 1598, "beachball", "[1598]" },
    { 1599, "fish1single", "[1599]" },
    { 1600, "fish2single", "[1600]" },
    { 1601, "fish3s", "[1601]" },
    { 1602, "jellyfish", "[1602]" },
    { 1603, "jellyfish01", "[1603]" },
    { 1604, "fish3single", "[1604]" },
    { 1605, "fish1s", "[1605]" },
    { 1606, "fish2s", "[1606]" },
    { 1607, "dolphin", "[1607]" },
    { 1608, "shark", "[1608]" },
    { 1609, "turtle", "[1609]" },
    { 1610, "sandcastle1", "[1610]" },
    { 1611, "sandcastle2", "[1611]" },
    { 1637, "od_pat_hutb", "[1637]" },
    { 1640, "beachtowel04", "[1640]" },
    { 1641, "beachtowel03", "[1641]" },
    { 1642, "beachtowel02", "[1642]" },
    { 1643, "beachtowel01", "[1643]" },
    { 2404, "CJ_SURF_BOARD", "[2404]" },
    { 2405, "CJ_SURF_BOARD2", "[2405]" },
    { 2406, "CJ_SURF_BOARD3", "[2406]" },
    { 2410, "CJ_SURF_BOARD4", "[2410]" },
    { 2782, "CJ_OYSTER_2", "[2782]" }
};
Reply
#4

Код:
[23:37:01] id: 902 - Name:  - Strid:
also i changed in your printf, where the first id variable was pointing to the string id
pawn Код:
printf("id: %d - Name: %s - Strid: %s", genBeachAndSea[0][ids], genBeachAndSea[0][name], genBeachAndSea[0][ids]);
to
pawn Код:
printf("id: %d - Name: %s - Strid: %s", genBeachAndSea[0][id], genBeachAndSea[0][name], genBeachAndSea[0][ids]);
if thats what you meant
if not heres the output of what you had exactly in your post
Код:
[23:39:05] id: 0 - Name:  - Strid:
Reply
#5

Quote:
Originally Posted by Grim_
Посмотреть сообщение
You forgot to separate the information in each of the other indexes in the array. You're putting all the information into the first array of the multidimensional array, I'm surprised you aren't receiving an error.
pawn Код:
new genBeachAndSea[][ARRAY_FORMAT] = {
    { 902, "Starfish", "[902]" },
    { 903, "seaweed", "[903]" },
    { 953, "CJ_OYSTER", "[953]" },
    { 1461, "DYN_LIFE_P", "[1461]" },
    { 1598, "beachball", "[1598]" },
    { 1599, "fish1single", "[1599]" },
    { 1600, "fish2single", "[1600]" },
    { 1601, "fish3s", "[1601]" },
    { 1602, "jellyfish", "[1602]" },
    { 1603, "jellyfish01", "[1603]" },
    { 1604, "fish3single", "[1604]" },
    { 1605, "fish1s", "[1605]" },
    { 1606, "fish2s", "[1606]" },
    { 1607, "dolphin", "[1607]" },
    { 1608, "shark", "[1608]" },
    { 1609, "turtle", "[1609]" },
    { 1610, "sandcastle1", "[1610]" },
    { 1611, "sandcastle2", "[1611]" },
    { 1637, "od_pat_hutb", "[1637]" },
    { 1640, "beachtowel04", "[1640]" },
    { 1641, "beachtowel03", "[1641]" },
    { 1642, "beachtowel02", "[1642]" },
    { 1643, "beachtowel01", "[1643]" },
    { 2404, "CJ_SURF_BOARD", "[2404]" },
    { 2405, "CJ_SURF_BOARD2", "[2405]" },
    { 2406, "CJ_SURF_BOARD3", "[2406]" },
    { 2410, "CJ_SURF_BOARD4", "[2410]" },
    { 2782, "CJ_OYSTER_2", "[2782]" }
};
i believe i was recieving an error with those, but it may have been something else, ill add them and try again, 7,000 lines here i come :/

yup heres the pawn output
Код:
NPP_EXEC: "PAWN Compile"
CD: E:\Real Life Game Mode\gamemodes
Current directory: E:\Real Life Game Mode\gamemodes
"E:\Real Life Game Mode\pawno\pawncc.exe" "mapedit.pwn" -; -(
Process started >>>
E:\Real Life Game Mode\pawno\include\objectarray.inc(3) : error 001: expected token: "-identifier-", but found "{"
E:\Real Life Game Mode\pawno\include\objectarray.inc(10) : warning 227: more initiallers than enum fields
E:\Real Life Game Mode\pawno\include\objectarray.inc(10) : warning 227: more initiallers than enum fields
E:\Real Life Game Mode\pawno\include\objectarray.inc(10) : error 018: initialization data exceeds declared size
mapedit.pwn(20) : error 017: undefined symbol "ids"
mapedit.pwn(159) : warning 203: symbol is never used: "airportAndAircraft"
mapedit.pwn(159) : warning 203: symbol is never used: "barItems"
mapedit.pwn(159) : warning 203: symbol is never used: "barsClubsCasinos"
mapedit.pwn(159) : warning 203: symbol is never used: "carParks"
mapedit.pwn(159) : warning 203: symbol is never used: "casinoItems"
mapedit.pwn(159) : warning 203: symbol is never used: "clothes"
mapedit.pwn(159) : warning 203: symbol is never used: "concreteAndRock"
mapedit.pwn(159) : warning 203: symbol is never used: "cranes"
mapedit.pwn(159) : warning 203: symbol is never used: "cratesDrumsAndRacks"
mapedit.pwn(159) : warning 203: symbol is never used: "doorsAndWindows"
mapedit.pwn(159) : warning 203: symbol is never used: "factoriesAndWarehouses"
mapedit.pwn(159) : warning 203: symbol is never used: "farmObjects"
mapedit.pwn(159) : warning 203: symbol is never used: "fencesWallsGatesAndBarriers"
mapedit.pwn(159) : warning 203: symbol is never used: "foodAndDrinks"
mapedit.pwn(159) : warning 203: symbol is never used: "furniture"
mapedit.pwn(159) : warning 203: symbol is never used: "garagesAndPetrolStations"
mapedit.pwn(159) : warning 203: symbol is never used: "genIndustrial"
mapedit.pwn(159) : warning 203: symbol is never used: "grassAndDirt"
mapedit.pwn(159) : warning 203: symbol is never used: "household"
mapedit.pwn(159) : warning 203: symbol is never used: "housesAndApartments"
mapedit.pwn(159) : warning 203: symbol is never used: "laddarsStairsAndScaffolding"
mapedit.pwn(159) : warning 203: symbol is never used: "military"
mapedit.pwn(159) : warning 203: symbol is never used: "officesAndSkyscrapers"
mapedit.pwn(159) : warning 203: symbol is never used: "otherBuildings"
mapedit.pwn(159) : warning 203: symbol is never used: "pickupsAndIcons"
mapedit.pwn(159) : warning 203: symbol is never used: "plants"
mapedit.pwn(159) : warning 203: symbol is never used: "railroads"
mapedit.pwn(159) : warning 203: symbol is never used: "ramps"
mapedit.pwn(159) : warning 203: symbol is never used: "restrauntsAndHotels"
mapedit.pwn(159) : warning 203: symbol is never used: "roadsBridgesAndTunnels"
mapedit.pwn(159) : warning 203: symbol is never used: "rocks"
mapedit.pwn(159) : warning 203: symbol is never used: "shipsDocksAndPiers"
mapedit.pwn(159) : warning 203: symbol is never used: "shopItems"
mapedit.pwn(159) : warning 203: symbol is never used: "special"
mapedit.pwn(159) : warning 203: symbol is never used: "sportsAndStadium"
mapedit.pwn(159) : warning 203: symbol is never used: "storesAndShops"
mapedit.pwn(159) : warning 203: symbol is never used: "streetAndRoadItems"
mapedit.pwn(159) : warning 203: symbol is never used: "tablesAndChairs"
mapedit.pwn(159) : warning 203: symbol is never used: "trash"
mapedit.pwn(159) : warning 203: symbol is never used: "trees"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
<<< Process finished.
================ READY ================
edit: wait, i noticed i had been messing up the num when i had been formatting those brackets in, i was using find and replace because its 7000 lines of arrays exactly like this one and i dont feel like wasting time.

edit: Thanks Grim_ it works, also since both of you helped me out a TON here, would you object to being in the credits for this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)