On my misadventures through ZScript today, I ran into a rather odd occurance that could be explained by delving deep into territory that perhaps people should keep out of, which will get depreciated in ZC 3.0.
When calling global arrays within global arrays, both the array that is calling the array and any arrays that are to be called within said array must be declared in the same file. If they are declared in separate files, they will be imported and declared but attempting to call them within the global array that is to call it results in a compile error; specifically "Variable [name] is undeclared"
Let me show you the example I just did
//Requires std.zh, string.zh and tango.zh to be imported here //Tango styles used by the quest. //Text settings const int ITEMMESSAGE_TEXT_CSET = 0; const int ITEMMESSAGE_TEXT_COLOUR = 1; //Backdrop settings const int ITEMMESSAGE_BACKDROP_TILE = 30080; const int ITEMMESSAGE_BACKDROP_CSET = 5; const int ITEMMESSAGE_BACKDROP_WIDTH = 14; //In tiles const int ITEMMESSAGE_BACKDROP_HEIGHT = 4; //In tiles // "More..." icon combo and CSet const int ITEMMESSAGE_MORE_COMBO = 15536; const int ITEMMESSAGE_MORE_CSET = 5; // Cursor combo and CSet const int TQS_CURSOR_COMBO = 410; const int TQS_CURSOR_CSET = 0; // Menu sound effects const int TQS_SFX_MOVE = 5; const int TQS_SFX_SELECT = 21; const int TQS_SFX_CANCEL = 0; const int STYLE_MESSAGE = 0; //Both the following arrays must be declared in the same file. If you declare them in separate files, the compiler will spit out a "Variable [name] is undeclared" error //Standard message backdrop, run for item and FFC scripts that use arguments for text int StdMessageBackdrop[]= { TANGO_DRAW_TILE, //Top left corner ITEMMESSAGE_BACKDROP_TILE, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 0, 0, // X, Y (pixels) 1, 1, // Width, height (tiles) TANGO_DRAW_TILE, //Top right corner ITEMMESSAGE_BACKDROP_TILE+13, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 208, 0, // X, Y (pixels) 1, 1, // Width, height (tiles) TANGO_DRAW_TILE, //bottom left corner ITEMMESSAGE_BACKDROP_TILE+60, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 0, 48, // X, Y (pixels) 1, 1, // Width, height (tiles) TANGO_DRAW_TILE, //bottom right corner ITEMMESSAGE_BACKDROP_TILE+73, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 208, 48, // X, Y (pixels) 1, 1, // Width, height (tiles) TANGO_DRAW_TILE, //Top border. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+1, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 16, 0, // X, Y (pixels) 12, 1, // Width, height (tiles) TANGO_DRAW_TILE, //Middle. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+21, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 16, 16, // X, Y (pixels) 12, 2, // Width, height (tiles) TANGO_DRAW_TILE, //bottom border. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+61, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 16, 48, // X, Y (pixels) 12, 1, // Width, height (tiles) TANGO_DRAW_TILE, //Left border. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+20, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 0, 16, // X, Y (pixels) 1, 2, // Width, height (tiles) TANGO_DRAW_TILE, //Right border. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+33, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 208, 16, // X, Y (pixels) 1, 2, // Width, height (tiles) TANGO_DRAW_TILE, //Left edge of optional namebox. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+14, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 0, 64, // X, Y (pixels) 1, 1, // Width, height (tiles) TANGO_DRAW_TILE, //Middle of namebox. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+15, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 16, 64, // X, Y (pixels) 3, 1, // Width, height (tiles) TANGO_DRAW_TILE, //Right edge of namebox. Can be adjusted ITEMMESSAGE_BACKDROP_TILE+18, // Tile ITEMMESSAGE_BACKDROP_CSET, // CSet 64, 64, // X, Y (pixels) 1, 1, // Width, height (tiles) TANGO_DRAW_TEXT, //Current name. Can be adjusted MsgCurrentName, // String Pointer TANGO_FONT_LTTP_SMALL, //Font ITEMMESSAGE_TEXT_CSET, // CSet ITEMMESSAGE_TEXT_COLOUR, // Colour 4, 69, // X, Y (pixels) TANGO_DRAW_END }; int TANGO_FONT_LTTP_SMALL[] = { TANGO_FONT_BUILTIN, TANGO_FONT_PROPORTIONAL, FONT_Z3SMALL, 0, // Unused 6, // Character height 0, // Space between lines // Character widths, including any trailing space // ASCII characters 32 to 126 // sp ! " # $ % & ' ( ) * + , - . / 4, 2, 4, 6, 6, 4, 5, 2, 3, 3, 4, 4, 3, 4, 2, 4, // 0 1 2 3 4 5 6 7 8 9 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, // : ; < = > ? @ 2, 2, 4, 4, 4, 4, 6, // A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 5, 5, 4, 5, 4, 4, 5, 4, 2, 4, 5, 4, 6, 5, 5, 5, 6, 5, 4, 4, 5, 6, 6, 4, 4, 4, // [ \ ] ^ _ ` 4, 4, 4, 4, 4, 4, // Note: This font's capital and lowercase letters are identical, but // ZC spaces some of them differently. This appears to be unintentional, // so it is not duplicated here. // a b c d e f g h i j k l m n o p q r s t u v w x y z 5, 5, 4, 5, 4, 4, 5, 4, 2, 4, 5, 4, 6, 5, 5, 5, 6, 5, 4, 4, 5, 6, 6, 4, 4, 4, // { | } ~ 4, 2, 4, 5, // Additional characters 6, 10, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4 }; int MsgCurrentName[30] = "Hal Hunter"; //Buffer used for the name.