Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: abstauber on Mon 10/02/2014 13:41:03

Title: export offset too high?
Post by: abstauber on Mon 10/02/2014 13:41:03
I'm currently trying to get back to some AGS scripting, but obviously I got quite rusty.

Could anyone please help me with this error?
Code (ags) Select

//AGS 3.3 RC1
Tiles.asc(484): Error (line 484): export offset too high; script data size too large?


In tiles.ash, I have a struct:
Code (ags) Select

struct ctile_sprites {
  DynamicSprite *spr;
  int code;
  short frm_speed[MAX_FRAME_TILE];
  short frames_in_use;
  short frame_counter;
  short ani_delay;
  short ani_delay_counter;
};


In tiles.asc I create the struct like this and try to export it (at the bottom of the script). The error occurs.
Code (ags) Select

ctile_sprites tile_sprites[NUM_MAX_SPRITES];
// a few lines later ...
export tile_sprites;


Now the interesting part is: when I overwrite those two lines to something stupid, the error remains
Code (ags) Select

int blargh;
export blargh;


When I now copy and paste those two lines a few lines above, it works fine. Like those script lines were haunted.
Am I missing something?

--EDIT: Sorry already found it myself:
A few lines earlier is a pretty huge struct (tiles[100000]) which I also export. It seems like I can't export anything else after that. I moved the needed lines above this mega struct and it works fine now.
Title: Re: export offset too high?
Post by: Crimson Wizard on Mon 10/02/2014 13:54:08
The solution is simple (sort of): don't use large static arrays, use dynamic ones and init them on game_start().

I remember Scavenger had a problem (http://www.adventuregamestudio.co.uk/forums/index.php?topic=48600) because of this: his compiled game became very large because of static script data saved in memory.
(He was using your PlatENG)

E: Right, the solution is not so simple, because AGS does not support dynamic arrays of custom structs (keep forgetting) :-/. This would require big rewrite. Nevermind.
Title: Re: export offset too high?
Post by: abstauber on Mon 10/02/2014 14:09:11
Hehe, I even posted in that thread and totally forgot about it.
Thanks for info - I simply keep in mind that my monster struct comes last. :)

Btw. the undo-bug struck again... argh, which lines did I change...